diff --git a/packages/CLI11/.appveyor.yml b/packages/CLI11/.appveyor.yml index 59bb8326b6a00dcb870df92f866cd9f50f210d8e..56b090cd8bda54f606b041d846546dc9a5e24a1f 100644 --- a/packages/CLI11/.appveyor.yml +++ b/packages/CLI11/.appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.2.{build} +version: 2.2.0.{build} branches: only: @@ -19,7 +19,9 @@ install: build_script: - mkdir build - cd build - - ps: cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_GENERATOR="Visual Studio 14 2015" + - ps: + cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE_TESTS=ON + -DCMAKE_BUILD_TYPE=Debug -DCMAKE_GENERATOR="Visual Studio 14 2015" - ps: cmake --build . - cd .. - conan create . CLIUtils/CLI11 diff --git a/packages/CLI11/.ci/azure-build.yml b/packages/CLI11/.ci/azure-build.yml index f51620c52b512f376e0663da65ba7360951b9415..04ee5d6bee56a133303fd608fe99cdf86547bbbd 100644 --- a/packages/CLI11/.ci/azure-build.yml +++ b/packages/CLI11/.ci/azure-build.yml @@ -1,10 +1,23 @@ steps: + # Needed on GCC 4.8 docker image for some reason + - script: mkdir build + displayName: "Make build directory" -- task: CMake@1 - inputs: - cmakeArgs: .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) -DCMAKE_CXX_STANDARD=$(cli11.std) -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options) - displayName: 'Configure' + - task: CMake@1 + inputs: + cmakeArgs: + .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) + -DCMAKE_CXX_STANDARD=$(cli11.std) + -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) + -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options) + displayName: "Configure" -- script: cmake --build . - displayName: 'Build' - workingDirectory: build + - script: cmake --build . -- -j2 --keep-going + displayName: "Build Unix" + workingDirectory: build + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + - script: cmake --build . + displayName: "Build Windows" + workingDirectory: build + condition: eq( variables['Agent.OS'], 'Windows_NT' ) diff --git a/packages/CLI11/.ci/azure-cmake.yml b/packages/CLI11/.ci/azure-cmake.yml index 59b6ceb321340bd31aebcd0d9ddec3c10f385c66..a2f3d983a585112316520a6088cb2ff4436aa942 100644 --- a/packages/CLI11/.ci/azure-cmake.yml +++ b/packages/CLI11/.ci/azure-cmake.yml @@ -1,16 +1,17 @@ steps: + # Note that silkeh/clang does not include ca-certificates, so check the shasum for verification + - bash: | + wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" + echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256 + displayName: Download CMake -# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification -- bash: | - wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" - echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256 - displayName: Download CMake + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: "cmake*.tar.gz" + destinationFolder: "cmake_program" + displayName: Extract CMake -- task: ExtractFiles@1 - inputs: - archiveFilePatterns: 'cmake*.tar.gz' - destinationFolder: 'cmake_program' - displayName: Extract CMake - -- bash: echo "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin" - displayName: Add CMake to PATH + - bash: + echo + "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin" + displayName: Add CMake to PATH diff --git a/packages/CLI11/.ci/azure-test.yml b/packages/CLI11/.ci/azure-test.yml index cf89a99957a02488a4208fac757cdc454168678a..c9dc9a280c6fc67aea4075d4a185753758add88c 100644 --- a/packages/CLI11/.ci/azure-test.yml +++ b/packages/CLI11/.ci/azure-test.yml @@ -1,10 +1,9 @@ steps: + - script: ctest --output-on-failure -C $(cli11.build_type) -T test + displayName: "Test" + workingDirectory: build -- script: ctest --output-on-failure -C $(cli11.build_type) -T test - displayName: 'Test' - workingDirectory: build - -- task: PublishTestResults@2 - inputs: - testResultsFormat: 'cTest' - testResultsFiles: '**/Test.xml' + - task: PublishTestResults@2 + inputs: + testResultsFormat: "cTest" + testResultsFiles: "**/Test.xml" diff --git a/packages/CLI11/.ci/build_doxygen.sh b/packages/CLI11/.ci/build_doxygen.sh deleted file mode 100644 index bd877d53eff538b421943a44ed0f246c0a5b5b1b..0000000000000000000000000000000000000000 --- a/packages/CLI11/.ci/build_doxygen.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/env sh -# (Source me) - -set -evx - -#DOXYGEN_URL="http://doxygen.nl/files/doxygen-1.8.17.src.tar.gz" -DOXYGEN_URL="https://github.com/doxygen/doxygen/archive/Release_1_8_15.tar.gz" -cd "${DEPS_DIR}" - -if [[ ! -f "${DEPS_DIR}/doxygen/build/bin/doxygen" ]] ; then - echo "Downloading Doxygen" - mkdir -p doxygen - travis_retry wget --no-check-certificate --quiet -O - "${DOXYGEN_URL}" | tar --strip-components=1 -xz -C doxygen - cd doxygen - mkdir -p build - cd build - cmake .. - make -j2 -fi - -export PATH="${DEPS_DIR}/doxygen/build/bin:${PATH}" - -cd "${TRAVIS_BUILD_DIR}" - -set +evx diff --git a/packages/CLI11/.ci/build_lcov.sh b/packages/CLI11/.ci/build_lcov.sh deleted file mode 100644 index 7232e9987e0338ae2ba9ee7cf419e8df39cc1312..0000000000000000000000000000000000000000 --- a/packages/CLI11/.ci/build_lcov.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/env sh -# (Source me) -set -evx - -LCOV_URL="http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz" -cd "${DEPS_DIR}" - -if [[ ! -f "${DEPS_DIR}/lcov/bin/lcov" ]] ; then - echo "Downloading lcov" - mkdir -p lcov - travis_retry wget --no-check-certificate --quiet -O - "${LCOV_URL}" | tar --strip-components=1 -xz -C lcov -fi - -export PATH="${DEPS_DIR}/lcov/bin:${PATH}" -cd "${TRAVIS_BUILD_DIR}" - -set +evx diff --git a/packages/CLI11/.ci/make_and_test.sh b/packages/CLI11/.ci/make_and_test.sh deleted file mode 100755 index 07df22e881c04a2e5dd70cd7702b3159a765390b..0000000000000000000000000000000000000000 --- a/packages/CLI11/.ci/make_and_test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -echo -en "travis_fold:start:script.build\\r" -echo "Building..." -STD="$1" -shift -set -evx - - -mkdir -p build -cd build -cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=ON -DCMAKE_CXX_STANDARD="$STD" -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@ -cmake --build . -- -j2 - -set +evx -echo -en "travis_fold:end:script.build\\r" -echo -en "travis_fold:start:script.test\\r" -echo "Testing..." -set -evx - -ctest --output-on-failure - -set +evx -echo -en "travis_fold:end:script.test\\r" diff --git a/packages/CLI11/.ci/run_codecov.sh b/packages/CLI11/.ci/run_codecov.sh deleted file mode 100755 index fbc199ca579d50b6bdcbd9cd899b6db7c6ab7e0c..0000000000000000000000000000000000000000 --- a/packages/CLI11/.ci/run_codecov.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -echo -en "travis_fold:start:script.build\\r" -echo "Building..." -set -evx - -cd "${TRAVIS_BUILD_DIR}" -mkdir -p build -cd build -cmake .. -DCLI11_SINGLE_FILE_TESTS=OFF -DCLI11_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Coverage -cmake --build . -- -j2 -cmake --build . --target CLI11_coverage - -set +evx -echo -en "travis_fold:end:script.build\\r" -echo -en "travis_fold:start:script.lcov\\r" -echo "Capturing and uploading LCov..." -set -evx - -lcov --directory . --capture --output-file coverage.info # capture coverage info -lcov --remove coverage.info '*/tests/*' '*/examples/*' '*gtest*' '*gmock*' '/usr/*' --output-file coverage.info # filter out system -lcov --list coverage.info #debug info -# Uploading report to CodeCov -bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" - -set +evx -echo -en "travis_fold:end:script.lcov\\r" diff --git a/packages/CLI11/.clang-format b/packages/CLI11/.clang-format index 0879ffa4cea0605f51a216bfcabe49df2e5d5aa1..6a5d1063d050276b24fa61bdaaf93bd6e320cfa7 100644 --- a/packages/CLI11/.clang-format +++ b/packages/CLI11/.clang-format @@ -1,5 +1,5 @@ -Language: Cpp -BasedOnStyle: LLVM +Language: Cpp +BasedOnStyle: LLVM # AccessModifierOffset: -2 # AlignAfterOpenBracket: Align # AlignConsecutiveAssignments: false @@ -37,7 +37,7 @@ BinPackParameters: false # BreakConstructorInitializersBeforeComma: false # BreakAfterJavaFieldAnnotations: false # BreakStringLiterals: true -ColumnLimit: 120 +ColumnLimit: 120 # CommentPragmas: '^ IWYU pragma:' # ConstructorInitializerAllOnOneLineOrOnePerLine: false # ConstructorInitializerIndentWidth: 4 @@ -49,7 +49,7 @@ ColumnLimit: 120 # ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] # IncludeIsMainRegex: '$' # IndentCaseLabels: false -IndentWidth: 4 +IndentWidth: 4 # IndentWrappedFunctionNames: false # JavaScriptQuotes: Leave # JavaScriptWrapImports: true @@ -69,7 +69,7 @@ IndentWidth: 4 # PenaltyReturnTypeOnItsOwnLine: 60 # PointerAlignment: Right # ReflowComments: true -SortIncludes: true +SortIncludes: true # SpaceAfterCStyleCast: false # SpaceAfterTemplateKeyword: true # SpaceBeforeAssignmentOperators: true @@ -81,6 +81,6 @@ SpacesBeforeTrailingComments: 2 # SpacesInCStyleCastParentheses: false # SpacesInParentheses: false # SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never +Standard: Cpp11 +TabWidth: 4 +UseTab: Never diff --git a/packages/CLI11/.clang-tidy b/packages/CLI11/.clang-tidy index 075f35dc58ed5cfc91a62048bdbd91c319718685..82450d1b5a1047190bb6a7f02db561c582542fd8 100644 --- a/packages/CLI11/.clang-tidy +++ b/packages/CLI11/.clang-tidy @@ -1,24 +1,80 @@ # Checks that will be implemented in future PRs: # performance-unnecessary-value-param, hints to ~110 issues. Be careful with implementing the suggested changes of this one, as auto-fixes may break the code +# bugprone-forwarding-reference-overload probably should be enabled and fixed. +# clang-diagnostic-float-equal can be fixed by using _a from Catch::literals +# bugprone-exception-escape due to main being a bit simple in examples +# modernize-avoid-c-arrays trips up in TEMPLATE_TEST_CASE catch macro +# modernize-return-braced-init-list triggers on lambdas ? +# modernize-make-unique requires C++14 +# readability-avoid-const-params-in-decls Affected by the pre-compile split -FormatStyle: file - -Checks: ' --*, -google-*, --google-runtime-references, -llvm-include-order, -llvm-namespace-comment, -misc-throw-by-value-catch-by-reference, -modernize*, --modernize-use-trailing-return-type, -readability-container-size-empty, -' +Checks: | + *bugprone*, + -bugprone-easily-swappable-parameters, + -bugprone-forwarding-reference-overload, + -bugprone-exception-escape, + clang-analyzer-optin.cplusplus.VirtualCall, + clang-analyzer-optin.performance.Padding, + -clang-diagnostic-float-equal, + cppcoreguidelines-init-variables, + cppcoreguidelines-prefer-member-initializer, + cppcoreguidelines-pro-type-static-cast-downcast, + cppcoreguidelines-slicing, + google-*, + -google-runtime-references, + llvm-include-order, + llvm-namespace-comment, + misc-definitions-in-headers, + misc-misplaced-const, + misc-non-copyable-objects, + misc-static-assert, + misc-throw-by-value-catch-by-reference, + misc-throw-by-value-catch-by-reference, + misc-uniqueptr-reset-release, + misc-unused-parameters, + modernize*, + -modernize-use-trailing-return-type, + -modernize-concat-nested-namespaces, + -modernize-return-braced-init-list, + -modernize-make-unique, + *performance*, + -performance-unnecessary-value-param, + -performance-inefficient-string-concatenation, + readability-const-return-type, + readability-container-size-empty, + readability-delete-null-pointer, + readability-else-after-return, + readability-implicit-bool-conversion, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-misplaced-array-index, + readability-non-const-parameter, + readability-qualified-auto, + readability-redundant-function-ptr-dereference, + readability-redundant-smartptr-get, + readability-redundant-string-cstr, + readability-simplify-subscript-expr, + readability-static-accessed-through-instance, + readability-static-definition-in-anonymous-namespace, + readability-string-compare, + readability-suspicious-call-argument, + readability-uniqueptr-delete-release, -WarningsAsErrors: '*' +CheckOptions: + - key: google-readability-braces-around-statements.ShortStatementLines + value: "3" + - key: performance-for-range-copy.WarnOnAllAutoCopies + value: true + - key: performance-inefficient-string-concatenation.StrictMode + value: true + - key: performance-unnecessary-value-param.AllowedTypes + value: "exception_ptr$;" + - key: readability-implicit-bool-conversion.AllowPointerConditions + value: true + - key: modernize-use-nodiscard.ReplacementString + value: "CLI11_NODISCARD" -HeaderFilterRegex: '.*hpp' +HeaderFilterRegex: "CLI.*hpp" -CheckOptions: -- key: google-readability-braces-around-statements.ShortStatementLines - value: '3' +FormatStyle: file +# WarningsAsErrors: "*" diff --git a/packages/CLI11/.codecov.yml b/packages/CLI11/.codecov.yml index 4181c549820b70653821288e19344606eaba55f1..185bbad3f47599ffc86429c8dad69f5b61f64c32 100644 --- a/packages/CLI11/.codecov.yml +++ b/packages/CLI11/.codecov.yml @@ -1,4 +1,3 @@ - ignore: - "tests" - "examples" diff --git a/packages/CLI11/.editorconfig b/packages/CLI11/.editorconfig index 979b049507328cba4c21879adf35ff4c2f206593..3c6f665e6fcf8a0145dfd9a1617023cba2b4c29d 100644 --- a/packages/CLI11/.editorconfig +++ b/packages/CLI11/.editorconfig @@ -2,10 +2,12 @@ root = true [*] indent_style = space -indent_size = 4 insert_final_newline = true end_of_line = lf trim_trailing_whitespace = true +[*.cpp,*.hpp,*.py] +indent_size = 4 + [*.yml] indent_size = 2 diff --git a/packages/CLI11/.github/CONTRIBUTING.md b/packages/CLI11/.github/CONTRIBUTING.md index 2f44c9da7d1a6d849dc94d81aa24200c86fd6442..7d376345b11fefd9b30f4069869a0a6ace195f66 100644 --- a/packages/CLI11/.github/CONTRIBUTING.md +++ b/packages/CLI11/.github/CONTRIBUTING.md @@ -1,37 +1,51 @@ # Contributing -Thanks for considering to write a Pull Request (PR) for CLI11! Here are a few guidelines to get you started: +Thanks for considering to write a Pull Request (PR) for CLI11! Here are a few +guidelines to get you started: -Make sure you are comfortable with the license; all contributions are licensed under the original license. +Make sure you are comfortable with the license; all contributions are licensed +under the original license. ## Adding functionality Make sure any new functions you add are are: -* Documented by `///` documentation for Doxygen -* Mentioned in the instructions in the README, though brief mentions are okay -* Explained in your PR (or previously explained in an Issue mentioned in the PR) -* Completely covered by tests +- Documented by `///` documentation for Doxygen +- Mentioned in the instructions in the README, though brief mentions are okay +- Explained in your PR (or previously explained in an Issue mentioned in the PR) +- Completely covered by tests -In general, make sure the addition is well thought out and does not increase the complexity of CLI11 needlessly. +In general, make sure the addition is well thought out and does not increase the +complexity of CLI11 needlessly. ## Things you should know -* Once you make the PR, tests will run to make sure your code works on all supported platforms -* The test coverage is also measured, and that should remain 100% -* Formatting should be done with pre-commit, otherwise the format check will not pass. However, it is trivial to apply this to your PR, so don't worry about this check. If you do want to run it, see below. -* Everything must pass clang-tidy as well, run with `-DCLI11_CLANG_TIDY=ON` (if you set `-DCLI11_CLANG_TIDY_OPTIONS="-fix"`, make sure you use a single threaded build process, or just build one example target). -* Your changes must also conform to most of the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) rules checked by [cpplint](https://github.com/cpplint/cpplint). For unused cpplint filters and justifications, see [CPPLINT.cfg](/CPPLINT.cfg). +- Once you make the PR, tests will run to make sure your code works on all + supported platforms +- The test coverage is also measured, and that should remain 100% +- Formatting should be done with pre-commit, otherwise the format check will not + pass. However, it is trivial to apply this to your PR, so don't worry about + this check. If you do want to run it, see below. +- Everything must pass clang-tidy as well, run with + `-DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy)"` (if you set + `"$(which clang-tidy) -fix"`, make sure you use a single threaded build + process, or just build one example target). +- Your changes must also conform to most of the + [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) + rules checked by [cpplint](https://github.com/cpplint/cpplint). For unused + cpplint filters and justifications, see [CPPLINT.cfg](/CPPLINT.cfg). ## Pre-commit -Format is handled by pre-commit. You should install it (or use [pipx](https://pypa.github.io/pipx/)): +Format is handled by pre-commit. You should install it (or use +[pipx](https://pypa.github.io/pipx/)): ```bash python3 -m pip install pre-commit ``` -Then, you can run it on the items you've added to your staging area, or all files: +Then, you can run it on the items you've added to your staging area, or all +files: ```bash pre-commit run @@ -39,7 +53,8 @@ pre-commit run pre-commit run --all-files ``` -And, if you want to always use it, you can install it as a git hook (hence the name, pre-commit): +And, if you want to always use it, you can install it as a git hook (hence the +name, pre-commit): ```bash pre-commit install @@ -47,7 +62,8 @@ pre-commit install ## For developers releasing to Conan.io -This is now done by the CI system on tagged releases. Previously, the steps to make a Conan.io release were: +This is now done by the CI system on tagged releases. Previously, the steps to +make a Conan.io release were: ```bash conan remove '*' # optional, I like to be clean @@ -59,7 +75,10 @@ Here I've assumed that the remote is `cli11`. ## For maintainers: remember to add contributions -In a commit to a PR, just add "`@all-contributors please add <username> for <contributions>`" or similar (see <https://allcontributors.org>). Use `code` for code, `bug` if an issue was submitted, `platform` for packaging stuff, and `doc` for documentation updates. +In a commit to a PR, just add +"`@all-contributors please add <username> for <contributions>`" or similar (see +<https://allcontributors.org>). Use `code` for code, `bug` if an issue was +submitted, `platform` for packaging stuff, and `doc` for documentation updates. To run locally, do: @@ -70,14 +89,15 @@ yarn all-contributors add username code,bug ## For maintainers: Making a release -Remember to replace the emoji in the readme, being careful not to replace the ones in all-contributors if any overlap. +Remember to replace the emoji in the readme, being careful not to replace the +ones in all-contributors if any overlap. Steps: -* Update changelog if needed -* Update the version in `.appveyor.yml` and `include/CLI/Version.hpp`. -* Find and replace in README (new minor/major release only): - * Replace " 🆕" and "🆕 " with "" (ignores the description line) - * Check for `\/\/$` (vi syntax) to catch leftover `// 🆕` - * Replace "🚧" with "🆕" (manually ignore the description line) -* Make a release in the GitHub UI, use a name such as "Version X.Y(.Z): Title" +- Update changelog if needed +- Update the version in `.appveyor.yml` and `include/CLI/Version.hpp`. +- Find and replace in README (new minor/major release only): + - Replace " 🆕" and "🆕 " with "" (ignores the description line) + - Check for `\/\/$` (vi syntax) to catch leftover `// 🆕` + - Replace "🚧" with "🆕" (manually ignore the description line) +- Make a release in the GitHub UI, use a name such as "Version X.Y(.Z): Title" diff --git a/packages/CLI11/.github/actions/quick_cmake/action.yml b/packages/CLI11/.github/actions/quick_cmake/action.yml index 28a82780c77e531a783e311cada57f78a4a71e13..811f73fe277bf4a2a63839790db9e42017e5c35b 100644 --- a/packages/CLI11/.github/actions/quick_cmake/action.yml +++ b/packages/CLI11/.github/actions/quick_cmake/action.yml @@ -1,19 +1,19 @@ name: Quick CMake config -description: 'Runs CMake 3.4+ (if already setup)' +description: "Runs CMake 3.4+ (if already setup)" inputs: args: - description: 'Other arguments' + description: "Other arguments" required: false - default: '' + default: "" cmake-version: - description: 'The CMake version to run' + description: "The CMake version to run" required: true runs: using: composite steps: - name: CMake ${{ inputs.cmake-version }} - uses: jwlawson/actions-setup-cmake@v1.11 + uses: jwlawson/actions-setup-cmake@v1.12 with: cmake-version: "${{ inputs.cmake-version }}" - run: | diff --git a/packages/CLI11/.github/codecov.yml b/packages/CLI11/.github/codecov.yml new file mode 100644 index 0000000000000000000000000000000000000000..a0b066745da7867510001d22c19a367acc2ae88e --- /dev/null +++ b/packages/CLI11/.github/codecov.yml @@ -0,0 +1,7 @@ +codecov: + notify: + after_n_builds: 4 +coverage: + status: + project: + informational: true diff --git a/packages/CLI11/.github/dependabot.yml b/packages/CLI11/.github/dependabot.yml index 73273365c0dd0de34754b26f08c0f4d16a5a535c..2c7d1708395e202b3b3316391f35bf4183ebd045 100644 --- a/packages/CLI11/.github/dependabot.yml +++ b/packages/CLI11/.github/dependabot.yml @@ -5,12 +5,3 @@ updates: directory: "/" schedule: interval: "daily" - ignore: - # Official actions have moving tags like v1 - # that are used, so they don't need updates here - - dependency-name: "actions/checkout" - - dependency-name: "actions/setup-python" - - dependency-name: "actions/cache" - - dependency-name: "actions/upload-artifact" - - dependency-name: "actions/download-artifact" - - dependency-name: "actions/labeler" diff --git a/packages/CLI11/.github/labeler_merged.yml b/packages/CLI11/.github/labeler_merged.yml index 434ab5839ba92ff1a244b0edca9d6effea620c0b..96e1ca701d612a72091d307f9842dabe28d9e264 100644 --- a/packages/CLI11/.github/labeler_merged.yml +++ b/packages/CLI11/.github/labeler_merged.yml @@ -1,4 +1,4 @@ needs changelog: - - all: ['!CHANGELOG.md'] + - all: ["!CHANGELOG.md"] needs README: - - all: ['!README.md'] + - all: ["!README.md"] diff --git a/packages/CLI11/.github/workflows/build.yml b/packages/CLI11/.github/workflows/build.yml index a6f250409d9d2736f19a6adf26b84a9507e400ca..625502c6b33751730894729cabff3dff86f23e2f 100644 --- a/packages/CLI11/.github/workflows/build.yml +++ b/packages/CLI11/.github/workflows/build.yml @@ -13,46 +13,47 @@ jobs: name: Single header runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v2 - with: - submodules: true - - - uses: actions/setup-python@v2 - - - name: Prepare CMake config - run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON - - - name: Make package - run: cmake --build build --target package_source - - - name: Copy source packages - run: | - mkdir -p CLI11-Source - cp build/CLI11-*-Source.* CLI11-Source - cp build/CLI11-*-Source.* . - - - name: Make header - run: cmake --build build --target CLI11-generate-single-file - - - name: Copy file to main folder - run: cp build/include/CLI11.hpp CLI11.hpp - - - uses: actions/upload-artifact@v2 - with: - name: CLI11.hpp - path: CLI11.hpp - - - uses: actions/upload-artifact@v2 - with: - name: CLI11-Source - path: CLI11-Source - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - CLI11.hpp - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + with: + submodules: true + + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Prepare CMake config + run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON + + - name: Make package + run: cmake --build build --target package_source + + - name: Copy source packages + run: | + mkdir -p CLI11-Source + cp build/CLI11-*-Source.* CLI11-Source + cp build/CLI11-*-Source.* . + + - name: Make header + run: cmake --build build --target CLI11-generate-single-file + + - name: Copy file to main folder + run: cp build/include/CLI11.hpp CLI11.hpp + + - uses: actions/upload-artifact@v3 + with: + name: CLI11.hpp + path: CLI11.hpp + + - uses: actions/upload-artifact@v3 + with: + name: CLI11-Source + path: CLI11-Source + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + CLI11.hpp + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/CLI11/.github/workflows/pr_merged.yml b/packages/CLI11/.github/workflows/pr_merged.yml index 6fadc0fa80865e4cc77feb27af49d37d4c695a94..56f6f741f769d12b43ef12127f03d05046aa118b 100644 --- a/packages/CLI11/.github/workflows/pr_merged.yml +++ b/packages/CLI11/.github/workflows/pr_merged.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true steps: - - uses: actions/labeler@main - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/labeler_merged.yml + - uses: actions/labeler@main + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/labeler_merged.yml diff --git a/packages/CLI11/.github/workflows/tests.yml b/packages/CLI11/.github/workflows/tests.yml index a48b4e367526e2d34ba8aa30353d7df784c65aef..a0b9e6c81282b15389affd44e9f0f5e84f03de54 100644 --- a/packages/CLI11/.github/workflows/tests.yml +++ b/packages/CLI11/.github/workflows/tests.yml @@ -6,163 +6,245 @@ on: - v* pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: + coverage: + name: Coverage + runs-on: ubuntu-latest + strategy: + matrix: + std: ["11", "14", "17", "20"] + precompile: ["ON", "OFF"] + steps: + - uses: actions/checkout@v3 + + - name: Get LCov + run: | + wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz + tar -xzf lcov-1.16.tar.gz + cd lcov-1.16 + sudo make install + + - name: Configure + run: | + cmake -S . -B build \ + -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCLI11_SINGLE_FILE_TESTS=OFF \ + -DCLI11_EXAMPLES=OFF \ + -DCLI11_PRECOMPILED=${{matrix.precompile}} \ + -DCMAKE_BUILD_TYPE=Coverage + + - name: Build + run: cmake --build build -j4 + + - name: Test + run: cmake --build build --target CLI11_coverage + + - name: Prepare coverage + run: | + lcov --directory . --capture --output-file coverage.info + lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info + lcov --list coverage.info + working-directory: build + + - name: Upload coverage + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + ./codecov + working-directory: build + + clang-tidy: + name: Clang-Tidy + runs-on: ubuntu-latest + container: silkeh/clang:14 + steps: + - uses: actions/checkout@v3 + + - name: Configure + run: > + cmake -S . -B build -DCMAKE_CXX_STANDARD=17 + -DCMAKE_CXX_CLANG_TIDY="$(which + clang-tidy);--use-color;--warnings-as-errors=*" + + - name: Build + run: cmake --build build -j4 -- --keep-going + cuda-build: name: CUDA build only runs-on: ubuntu-latest container: nvidia/cuda:10.2-devel-ubuntu18.04 steps: - - uses: actions/checkout@v1 - with: - submodules: true - - name: Add wget - run: apt-get update && apt-get install -y wget - - name: Get cmake - uses: jwlawson/actions-setup-cmake@v1.11 - - name: Configure - run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON - - name: Build - run: cmake --build build -j2 - + - uses: actions/checkout@v1 + with: + submodules: true + - name: Add wget + run: apt-get update && apt-get install -y wget + - name: Get cmake + uses: jwlawson/actions-setup-cmake@v1.12 + - name: Configure + run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON + - name: Build + run: cmake --build build -j2 boost-build: name: Boost build runs-on: ubuntu-latest container: zouzias/boost:1.76.0 steps: - - uses: actions/checkout@v1 - with: - submodules: true - - name: Add deps - run: apt-get update && apt-get install make - - name: Get CMake - uses: jwlawson/actions-setup-cmake@v1.11 - - name: Configure - run: cmake -S . -B build -DCLI11_BOOST=ON - - name: Build - run: cmake --build build -j2 - - name: Run tests - run: ctest --output-on-failure - working-directory: build + - uses: actions/checkout@v1 + with: + submodules: true + - name: Add deps + run: apt-get update && apt-get install make + - name: Get CMake + uses: jwlawson/actions-setup-cmake@v1.12 + - name: Configure + run: cmake -S . -B build -DCLI11_BOOST=ON + - name: Build + run: cmake --build build -j2 + - name: Run tests + run: ctest --output-on-failure + working-directory: build + + meson-build: + name: Meson build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Prepare commands + run: | + pipx install meson + pipx install ninja + + - name: Configure + run: meson setup build-meson . -Dtests=true + + - name: Build + run: meson compile -C build-meson cmake-config: name: CMake config check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Check CMake 3.4 - with: - cmake-version: "3.4" - uses: ./.github/actions/quick_cmake - - - name: Check CMake 3.5 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.5" - if: success() || failure() - - - name: Check CMake 3.6 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.6" - if: success() || failure() - - - name: Check CMake 3.7 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.7" - if: success() || failure() - - - name: Check CMake 3.8 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.8" - if: success() || failure() - - - name: Check CMake 3.9 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.9" - if: success() || failure() - - - name: Check CMake 3.10 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.10" - if: success() || failure() - - - name: Check CMake 3.11 (full) - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.11" - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON - if: success() || failure() - - - name: Check CMake 3.12 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.12" - if: success() || failure() - - - name: Check CMake 3.13 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.13" - if: success() || failure() - - - name: Check CMake 3.14 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.14" - if: success() || failure() - - - name: Check CMake 3.15 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.15" - if: success() || failure() - - - name: Check CMake 3.16 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.16" - if: success() || failure() - - - name: Check CMake 3.17 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.17" - if: success() || failure() - - - name: Check CMake 3.18 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.18" - if: success() || failure() - - - name: Check CMake 3.19 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.19" - if: success() || failure() - - - name: Check CMake 3.20 - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.20" - if: success() || failure() - - - name: Check CMake 3.21 (full) - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.21" - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON - if: success() || failure() - - - name: Check CMake 3.22 (full) - uses: ./.github/actions/quick_cmake - with: - cmake-version: "3.22" - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON - if: success() || failure() + - uses: actions/checkout@v3 + + - name: Check CMake 3.4 + with: + cmake-version: "3.4" + uses: ./.github/actions/quick_cmake + + - name: Check CMake 3.5 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.5" + if: success() || failure() + + - name: Check CMake 3.6 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.6" + if: success() || failure() + + - name: Check CMake 3.7 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.7" + if: success() || failure() + + - name: Check CMake 3.8 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.8" + if: success() || failure() + + - name: Check CMake 3.9 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.9" + if: success() || failure() + + - name: Check CMake 3.10 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.10" + if: success() || failure() + + - name: Check CMake 3.11 (full) + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.11" + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON + if: success() || failure() + + - name: Check CMake 3.12 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.12" + if: success() || failure() + + - name: Check CMake 3.13 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.13" + if: success() || failure() + + - name: Check CMake 3.14 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.14" + if: success() || failure() + + - name: Check CMake 3.15 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.15" + if: success() || failure() + + - name: Check CMake 3.16 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.16" + if: success() || failure() + + - name: Check CMake 3.17 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.17" + if: success() || failure() + + - name: Check CMake 3.18 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.18" + if: success() || failure() + + - name: Check CMake 3.19 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.19" + if: success() || failure() + + - name: Check CMake 3.20 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.20" + if: success() || failure() + + - name: Check CMake 3.21 (full) + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.21" + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON + if: success() || failure() + + - name: Check CMake 3.22 (full) + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.22" + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON + if: success() || failure() diff --git a/packages/CLI11/.gitrepo b/packages/CLI11/.gitrepo index 9e19e3887de346a0389ceac098b60a6dd619ed04..9d9e10f1cda0a2c2c89c32188c30c3a0d76fad5a 100644 --- a/packages/CLI11/.gitrepo +++ b/packages/CLI11/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:CLIUtils/CLI11.git branch = main - commit = 70f8072f9dd2292fd0b9f9e5f58e279f60483ed3 - parent = ae4cfe8875caf314c7f66eec2e6d09d5ee321e6a + commit = faea921e4004af91763b8fde905de3baf24d3945 + parent = 8a1fd5ded4230d6e9b9bf69951058fc12a19ad4a method = merge cmdver = 0.4.3 diff --git a/packages/CLI11/.pre-commit-config.yaml b/packages/CLI11/.pre-commit-config.yaml index 84135427c6baa312b9911497c4b687a9bcfcacf9..0d6d0c0116207798b0c1c88a525ed43359d63789 100644 --- a/packages/CLI11/.pre-commit-config.yaml +++ b/packages/CLI11/.pre-commit-config.yaml @@ -2,62 +2,85 @@ ci: autoupdate_commit_msg: "chore(deps): pre-commit.ci autoupdate" autofix_commit_msg: "style: pre-commit.ci fixes" - repos: -- repo: https://github.com/psf/black - rev: 21.9b0 - hooks: - - id: black - -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 - hooks: - - id: check-added-large-files - - id: check-case-conflict - - id: check-merge-conflict - - id: check-symlinks - - id: check-yaml - - id: end-of-file-fixer - - id: mixed-line-ending - - id: trailing-whitespace - -- repo: https://github.com/pre-commit/mirrors-clang-format - rev: v13.0.0 - hooks: - - id: clang-format - -- repo: https://github.com/cheshirekow/cmake-format-precommit - rev: v0.6.13 - hooks: - - id: cmake-format - additional_dependencies: [pyyaml] - -- repo: https://github.com/markdownlint/markdownlint - rev: v0.11.0 - hooks: - - id: markdownlint - args: ["--style=scripts/mdlint_style.rb"] - -- repo: local - hooks: - - id: remarklint - name: remarklint - language: node - entry: remark - types: [markdown] - args: ["--frail", "--quiet"] - additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended, remark-lint-list-item-indent, remark-lint-no-undefined-references] - -- repo: local - hooks: - - id: disallow-caps - name: Disallow improper capitalization - language: pygrep - entry: PyBind|Numpy|Cmake|CCache|PyTest|Github - exclude: .pre-commit-config.yaml - -- repo: https://github.com/codespell-project/codespell - rev: v2.1.0 - hooks: - - id: codespell - args: ["-L", "atleast,ans,doub,inout"] + - repo: https://github.com/psf/black + rev: 22.6.0 + hooks: + - id: black + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v14.0.6 + hooks: + - id: clang-format + types_or: [c++, c, cuda] + + - repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + additional_dependencies: [pyyaml] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v2.7.1" + hooks: + - id: prettier + types_or: [yaml, markdown, html, css, scss, javascript, json] + args: [--prose-wrap=always] + + - repo: https://github.com/markdownlint/markdownlint + rev: v0.11.0 + hooks: + - id: markdownlint + args: ["--style=scripts/mdlint_style.rb"] + + # - repo: local + # hooks: + # - id: remarklint + # name: remarklint + # language: node + # entry: remark + # types: [markdown] + # args: ["--frail", "--quiet"] + # additional_dependencies: + # [ + # remark, + # remark-lint, + # remark-cli, + # remark-preset-lint-recommended, + # remark-lint-list-item-indent, + # remark-lint-no-undefined-references, + # ] + + - repo: local + hooks: + - id: disallow-caps + name: Disallow improper capitalization + language: pygrep + entry: PyBind|Numpy|Cmake|CCache|PyTest|Github + exclude: .pre-commit-config.yaml + + - repo: local + hooks: + - id: avoid-msvc-macro + name: Avoid MSVC <=2017 min/max macro (use extra parens) + language: pygrep + entry: \b(min|max)\( + exclude: .pre-commit-config.yaml + + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ["-L", "atleast,ans,doub,inout"] diff --git a/packages/CLI11/CHANGELOG.md b/packages/CLI11/CHANGELOG.md index e35ca38676833f3891fbbd8ea8f0ed8a0808588c..04b9cd2a9bee4ccf1845fd689e84b49a8e4ac4f4 100644 --- a/packages/CLI11/CHANGELOG.md +++ b/packages/CLI11/CHANGELOG.md @@ -1,20 +1,96 @@ # Changelog +## Version 2.2: Option and Configuration Flexibility + +New features include support for output of an empty vector, a summing option +policy that can be applied more broadly, and an option to validate optional +arguments to discriminate from positional arguments. A new validator to check +for files on a default path is included to allow one or more default paths for +configuration files or other file arguments. A number of bug fixes and code +cleanup for various build configurations. Clean up of some error outputs and +extension of existing capability to new types or situations. + +There is a possible minor breaking change in behavior of certain types which +wrapped an integer, such as `std::atomic<int>` or `std::optional<int>` when used +in a flag. The default behavior is now as a single argument value vs. summing +all the arguments. The default summing behavior is now restricted to pure +integral types, int64_t, int, uint32_t, etc. Use the new `sum` multi option +policy to revert to the older behavior. The summing behavior on wrapper types +was not originally intended. + +- Add `MultiOptionPolicy::Sum` and refactor the `add_flag` to fix a bug when + using `std::optional<bool>` as type. [#709][] +- Add support for an empty vector result in TOML and as a default string. + [#660][] +- Add `.validate_optional_arguments()` to support discriminating positional + arguments from vector option arguments. [#668][] +- Add `CLI::FileOnDefaultPath` to check for files on a specified default path. + [#698][] +- Change default value display in help messages from `=XXXX` to `[XXXXX]` to + make it clearer. [#666][] +- Modify the Range Validator to support additional types and clean up the error + output. [#690][] +- Bugfix: The trigger on parse modifier did not work on positional argument.s + [#713][] +- Bugfix: The single header file generation was missing custom namespace + generation. [#707][] +- Bugfix: Clean up File Error handling in the argument processing. [#678][] +- Bugfix: Fix a stack overflow error if nameless commands had fallthrough. + [#665][] +- Bugfix: A subcommand callback could be executed multiple times if it was a + member of an option group. [#666][] +- Bugfix: Fix an issue with vectors of multi argument types where partial + argument sets did not result in an error. [#661][] +- Bugfix: Fix an issue with type the template matching on C++20 and add some CI + builds for C++20. [#663][] +- Bugfix: Fix typo in C++20 detection on MSVC. [#706][] +- Bugfix: An issue where the detection of RTTI being disabled on certain MSVC + platforms did not disable the use of dynamic cast calls. [#666][] +- Bugfix: Resolve strict-overflow warning on some GCC compilers. [#666][] +- Backend: Add additional tests concerning the use of aliases for option groups + in config files. [#666][] +- Build: Add support for testing in meson and cleanup symbolic link generation. + [#701][], [#697][] +- Build: Support building in WebAssembly. [#679][] + +[#660]: https://github.com/CLIUtils/CLI11/pull/660 +[#661]: https://github.com/CLIUtils/CLI11/pull/661 +[#663]: https://github.com/CLIUtils/CLI11/pull/663 +[#665]: https://github.com/CLIUtils/CLI11/pull/665 +[#666]: https://github.com/CLIUtils/CLI11/pull/666 +[#668]: https://github.com/CLIUtils/CLI11/pull/668 +[#678]: https://github.com/CLIUtils/CLI11/pull/678 +[#679]: https://github.com/CLIUtils/CLI11/pull/679 +[#690]: https://github.com/CLIUtils/CLI11/pull/690 +[#697]: https://github.com/CLIUtils/CLI11/pull/697 +[#698]: https://github.com/CLIUtils/CLI11/pull/698 +[#701]: https://github.com/CLIUtils/CLI11/pull/701 +[#706]: https://github.com/CLIUtils/CLI11/pull/706 +[#707]: https://github.com/CLIUtils/CLI11/pull/707 +[#709]: https://github.com/CLIUtils/CLI11/pull/709 +[#713]: https://github.com/CLIUtils/CLI11/pull/713 + ## Version 2.1: Names and callbacks The name restrictions for options and subcommands are now much looser, allowing a wider variety of characters than before, even spaces can be used (use quotes to include a space in most shells). The default configuration parser was improved, allowing your configuration to sit in a larger file. And option -callbacks have a few new settings, allowing them to be run even if the option -is not passed, or every time the option is parsed. - -* Option/subcommand name restrictions have been relaxed. Most characters are now allowed. [#627][] -* The config parser can accept streams, specify a specific section, and inline comment characters are supported [#630][] -* `force_callback` & `trigger_on_parse` added, allowing a callback to always run on parse even if not present or every time the option is parsed [#631][] -* Bugfix(cmake): Only add `CONFIGURE_DEPENDS` if CLI11 is the main project [#633][] -* Bugfix(cmake): Ensure the cmake/pkg-config files install to a arch independent path [#635][] -* Bugfix: The single header file generation was missing the include guard. [#620][] +callbacks have a few new settings, allowing them to be run even if the option is +not passed, or every time the option is parsed. + +- Option/subcommand name restrictions have been relaxed. Most characters are now + allowed. [#627][] +- The config parser can accept streams, specify a specific section, and inline + comment characters are supported [#630][] +- `force_callback` & `trigger_on_parse` added, allowing a callback to always run + on parse even if not present or every time the option is parsed [#631][] +- Bugfix(cmake): Only add `CONFIGURE_DEPENDS` if CLI11 is the main project + [#633][] +- Bugfix(cmake): Ensure the cmake/pkg-config files install to a arch independent + path [#635][] +- Bugfix: The single header file generation was missing the include guard. + [#620][] [#620]: https://github.com/CLIUtils/CLI11/pull/620 [#627]: https://github.com/CLIUtils/CLI11/pull/627 @@ -25,9 +101,10 @@ is not passed, or every time the option is parsed. ### Version 2.1.1: Quick Windows fix -* A collision with `min`/`max` macros on Windows has been fixed. [#642][] -* Tests pass with Boost again [#646][] -* Running the pre-commit hooks in development no longer requires docker for clang-format [#647][] +- A collision with `min`/`max` macros on Windows has been fixed. [#642][] +- Tests pass with Boost again [#646][] +- Running the pre-commit hooks in development no longer requires docker for + clang-format [#647][] [#642]: https://github.com/CLIUtils/CLI11/pull/642 [#646]: https://github.com/CLIUtils/CLI11/pull/646 @@ -35,11 +112,11 @@ is not passed, or every time the option is parsed. ## Version 2.1.2: Better subproject builds -* Use `main` for the main branch of the repository [#657][] -* Bugfix(cmake): Enforce at least C++11 when using CMake target [#656][] -* Build: Don't run doxygen and CTest includes if a submodule [#656][] -* Build: Avoid a warning on CMake 3.22 [#656][] -* Build: Support compiling the tests with an external copy of Catch2 [#653][] +- Use `main` for the main branch of the repository [#657][] +- Bugfix(cmake): Enforce at least C++11 when using CMake target [#656][] +- Build: Don't run doxygen and CTest includes if a submodule [#656][] +- Build: Avoid a warning on CMake 3.22 [#656][] +- Build: Support compiling the tests with an external copy of Catch2 [#653][] [#653]: https://github.com/CLIUtils/CLI11/pull/653 [#656]: https://github.com/CLIUtils/CLI11/pull/656 @@ -49,40 +126,43 @@ is not passed, or every time the option is parsed. This version focuses on cleaning up deprecated functionality, and some minor default changes. The config processing is TOML compliant now. Atomics and -complex numbers are directly supported, along with other container -improvements. A new version flag option has finally been added. Subcommands are -significantly improved with new features and bugfixes for corner cases. This -release contains a lot of backend cleanup, including a complete overhaul of the -testing system and single file generation system. - -* Built-in config format is TOML compliant now [#435][] - * Support multiline TOML [#528][] - * Support for configurable quotes [#599][] - * Support short/positional options in config mode [#443][] -* More powerful containers, support for `%%` separator [#423][] -* Support atomic types [#520][] and complex types natively [#423][] -* Add a type validator `CLI::TypeValidator<TYPE>` [#526][] -* Add a version flag easily [#452][], with help message [#601][] -* Support `->silent()` on subcommands. [#529][] -* Add alias section to help for subcommands [#545][] -* Allow quotes to specify a program name [#605][] -* Backend: redesigned MakeSingleFiles to have a higher level of manual control, to support future features. [#546][] -* Backend: moved testing from GTest to Catch2 [#574][] -* Bugfix: avoid duplicated and missed calls to the final callback [#584][] -* Bugfix: support embedded newlines in more places [#592][] -* Bugfix: avoid listing helpall as a required flag [#530][] -* Bugfix: avoid a clash with WINDOWS define [#563][] -* Bugfix: the help flag didn't get processed when a config file was required [#606][] -* Bugfix: fix description of non-configurable subcommands in config [#604][] -* Build: support pkg-config [#523][] +complex numbers are directly supported, along with other container improvements. +A new version flag option has finally been added. Subcommands are significantly +improved with new features and bugfixes for corner cases. This release contains +a lot of backend cleanup, including a complete overhaul of the testing system +and single file generation system. + +- Built-in config format is TOML compliant now [#435][] + - Support multiline TOML [#528][] + - Support for configurable quotes [#599][] + - Support short/positional options in config mode [#443][] +- More powerful containers, support for `%%` separator [#423][] +- Support atomic types [#520][] and complex types natively [#423][] +- Add a type validator `CLI::TypeValidator<TYPE>` [#526][] +- Add a version flag easily [#452][], with help message [#601][] +- Support `->silent()` on subcommands. [#529][] +- Add alias section to help for subcommands [#545][] +- Allow quotes to specify a program name [#605][] +- Backend: redesigned MakeSingleFiles to have a higher level of manual control, + to support future features. [#546][] +- Backend: moved testing from GTest to Catch2 [#574][] +- Bugfix: avoid duplicated and missed calls to the final callback [#584][] +- Bugfix: support embedded newlines in more places [#592][] +- Bugfix: avoid listing helpall as a required flag [#530][] +- Bugfix: avoid a clash with WINDOWS define [#563][] +- Bugfix: the help flag didn't get processed when a config file was required + [#606][] +- Bugfix: fix description of non-configurable subcommands in config [#604][] +- Build: support pkg-config [#523][] > ### Converting from CLI11 1.9 > -> * Removed deprecated set commands, use validators instead. [#565][] -> * The final "defaulted" bool has been removed, use `->capture_default_str()` -> instead. Use `app.option_defaults()->always_capture_default()` to set this for -> all future options. [#597][] -> * Use `add_option` on a complex number instead of `add_complex`, which has been removed. +> - Removed deprecated set commands, use validators instead. [#565][] +> - The final "defaulted" bool has been removed, use `->capture_default_str()` +> instead. Use `app.option_defaults()->always_capture_default()` to set this +> for all future options. [#597][] +> - Use `add_option` on a complex number instead of `add_complex`, which has +> been removed. [#423]: https://github.com/CLIUtils/CLI11/pull/423 [#435]: https://github.com/CLIUtils/CLI11/pull/435 @@ -110,48 +190,61 @@ testing system and single file generation system. ## Version 1.9: Config files and cleanup -Config file handling was revamped to fix common issues, and now supports reading [TOML](https://github.com/toml-lang/toml). +Config file handling was revamped to fix common issues, and now supports reading +[TOML](https://github.com/toml-lang/toml). Adding options is significantly more powerful with support for things like `std::tuple` and `std::array`, including with transforms. Several new -configuration options were added to facilitate a wider variety of apps. GCC -4.7 is no longer supported. - -* Config files refactored, supports TOML (may become default output in 2.0) [#362][] -* Added two template parameter form of `add_option`, allowing `std::optional` to be supported without a special import [#285][] -* `string_view` now supported in reasonable places [#300][], [#285][] -* `immediate_callback`, `final_callback`, and `parse_complete_callback` added to support controlling the App callback order [#292][], [#313][] -* Multiple positional arguments maintain order if `positionals_at_end` is set. [#306][] -* Pair/tuple/array now supported, and validators indexed to specific components in the objects [#307][], [#310][] -* Footer callbacks supported [#309][] -* Subcommands now support needs (including nameless subcommands) [#317][] -* More flexible type size, more useful `add_complex` [#325][], [#370][] -* Added new validators `CLI::NonNegativeNumber` and `CLI::PositiveNumber` [#342][] -* Transform now supports arrays [#349][] -* Option groups can be hidden [#356][] -* Add `CLI::deprecate_option` and `CLI::retire_option` functions [#358][] -* More flexible and safer Option `default_val` [#387][] -* Backend: Cleaner type traits [#286][] -* Backend: File checking updates [#341][] -* Backend: Using pre-commit to format, checked in GitHub Actions [#336][] -* Backend: Clang-tidy checked again, CMake option now `CL11_CLANG_TIDY` [#390][] -* Backend: Warning cleanup, more checks from klocwork [#350][], Effective C++ [#354][], clang-tidy [#360][], CUDA NVCC [#365][], cross compile [#373][], sign conversion [#382][], and cpplint [#400][] -* Docs: CLI11 Tutorial now hosted in the same repository [#304][], [#318][], [#374][] -* Bugfix: Fixed undefined behavior in `checked_multiply` [#290][] -* Bugfix: `->check()` was adding the name to the wrong validator [#320][] -* Bugfix: Resetting config option works properly [#301][] -* Bugfix: Hidden flags were showing up in error printout [#333][] -* Bugfix: Enum conversion no longer broken if stream operator added [#348][] -* Build: The meson build system supported [#299][] -* Build: GCC 4.7 is no longer supported, due mostly to GoogleTest. GCC 4.8+ is now required. [#160][] -* Build: Restructured significant portions of CMake build system [#394][] +configuration options were added to facilitate a wider variety of apps. GCC 4.7 +is no longer supported. + +- Config files refactored, supports TOML (may become default output in 2.0) + [#362][] +- Added two template parameter form of `add_option`, allowing `std::optional` to + be supported without a special import [#285][] +- `string_view` now supported in reasonable places [#300][], [#285][] +- `immediate_callback`, `final_callback`, and `parse_complete_callback` added to + support controlling the App callback order [#292][], [#313][] +- Multiple positional arguments maintain order if `positionals_at_end` is set. + [#306][] +- Pair/tuple/array now supported, and validators indexed to specific components + in the objects [#307][], [#310][] +- Footer callbacks supported [#309][] +- Subcommands now support needs (including nameless subcommands) [#317][] +- More flexible type size, more useful `add_complex` [#325][], [#370][] +- Added new validators `CLI::NonNegativeNumber` and `CLI::PositiveNumber` + [#342][] +- Transform now supports arrays [#349][] +- Option groups can be hidden [#356][] +- Add `CLI::deprecate_option` and `CLI::retire_option` functions [#358][] +- More flexible and safer Option `default_val` [#387][] +- Backend: Cleaner type traits [#286][] +- Backend: File checking updates [#341][] +- Backend: Using pre-commit to format, checked in GitHub Actions [#336][] +- Backend: Clang-tidy checked again, CMake option now `CL11_CLANG_TIDY` [#390][] +- Backend: Warning cleanup, more checks from klocwork [#350][], Effective C++ + [#354][], clang-tidy [#360][], CUDA NVCC [#365][], cross compile [#373][], + sign conversion [#382][], and cpplint [#400][] +- Docs: CLI11 Tutorial now hosted in the same repository [#304][], [#318][], + [#374][] +- Bugfix: Fixed undefined behavior in `checked_multiply` [#290][] +- Bugfix: `->check()` was adding the name to the wrong validator [#320][] +- Bugfix: Resetting config option works properly [#301][] +- Bugfix: Hidden flags were showing up in error printout [#333][] +- Bugfix: Enum conversion no longer broken if stream operator added [#348][] +- Build: The meson build system supported [#299][] +- Build: GCC 4.7 is no longer supported, due mostly to GoogleTest. GCC 4.8+ is + now required. [#160][] +- Build: Restructured significant portions of CMake build system [#394][] > ### Converting from CLI11 1.8 > -> * Some deprecated methods dropped -> * `add_set*` should be replaced with `->check`/`->transform` and `CLI::IsMember` since 1.8 -> * `get_defaultval` was replaced by `get_default_str` in 1.8 -> * The true/false 4th argument to `add_option` is expected to be removed in 2.0, use `->capture_default_str()` since 1.8 +> - Some deprecated methods dropped +> - `add_set*` should be replaced with `->check`/`->transform` and +> `CLI::IsMember` since 1.8 +> - `get_defaultval` was replaced by `get_default_str` in 1.8 +> - The true/false 4th argument to `add_option` is expected to be removed in +> 2.0, use `->capture_default_str()` since 1.8 [#160]: https://github.com/CLIUtils/CLI11/pull/160 [#285]: https://github.com/CLIUtils/CLI11/pull/285 @@ -197,13 +290,13 @@ configuration options were added to facilitate a wider variety of apps. GCC This is a patch version that backports fixes from the development of 2.0. -* Support relative inclusion [#475][] -* Fix cases where spaces in paths could break CMake support [#471][] -* Fix an issue with string conversion [#421][] -* Cross-compiling improvement for Conan.io [#430][] -* Fix option group default propagation [#450][] -* Fix for C++20 [#459][] -* Support compiling with RTTI off [#461][] +- Support relative inclusion [#475][] +- Fix cases where spaces in paths could break CMake support [#471][] +- Fix an issue with string conversion [#421][] +- Cross-compiling improvement for Conan.io [#430][] +- Fix option group default propagation [#450][] +- Fix for C++20 [#459][] +- Support compiling with RTTI off [#461][] [#421]: https://github.com/CLIUtils/CLI11/pull/421 [#430]: https://github.com/CLIUtils/CLI11/pull/430 @@ -215,41 +308,73 @@ This is a patch version that backports fixes from the development of 2.0. ## Version 1.8: Transformers, default strings, and flags -Set handling has been completely replaced by a new backend that works as a Validator or Transformer. This provides a single interface instead of the 16 different functions in App. It also allows ordered collections to be used, custom functions for filtering, and better help and error messages. You can also use a collection of pairs (like `std::map`) to transform the match into an output. Also new are inverted flags, which can cancel or reduce the count of flags, and can also support general flag types. A new `add_option_fn` lets you more easily program CLI11 options with the types you choose. Vector options now support a custom separator. Apps can now be composed with unnamed subcommand support. The final bool "defaults" flag when creating options has been replaced by `->capture_default_str()` (ending an old limitation in construction made this possible); the old method is still available but may be removed in future versions. - -* Replaced default help capture: `.add_option("name", value, "", True)` becomes `.add_option("name", value)->capture_default_str()` [#242][] -* Added `.always_capture_default()` [#242][] -* New `CLI::IsMember` validator replaces set validation [#222][] -* `IsMember` also supports container of pairs, transform allows modification of result [#228][] -* Added new Transformers, `CLI::AsNumberWithUnit` and `CLI::AsSizeValue` [#253][] -* Much more powerful flags with different values [#211][], general types [#235][] -* `add_option` now supports bool due to unified bool handling [#211][] -* Support for composable unnamed subcommands [#216][] -* Reparsing is better supported with `.remaining_for_passthrough()` [#265][] -* Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][] -* Validators added for IP4 addresses and positive numbers [#210][] and numbers [#262][] -* Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][] -* Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][] -* Added `validate_positionals` [#262][] -* Positional parsing is much more powerful [#251][], duplicates supported [#247][] -* Validators can be negated with `!` [#230][], and now handle tname functions [#228][] -* Better enum support and streaming helper [#233][] and [#228][] -* Cleanup for shadow warnings [#232][] -* Better alignment on multiline descriptions [#269][] -* Better support for aarch64 [#266][] -* Respect `BUILD_TESTING` only if CLI11 is the main project; otherwise, `CLI11_TESTING` must be used [#277][] -* Drop auto-detection of experimental optional and boost::optional; must be enabled explicitly (too fragile) [#277][] [#279][] +Set handling has been completely replaced by a new backend that works as a +Validator or Transformer. This provides a single interface instead of the 16 +different functions in App. It also allows ordered collections to be used, +custom functions for filtering, and better help and error messages. You can also +use a collection of pairs (like `std::map`) to transform the match into an +output. Also new are inverted flags, which can cancel or reduce the count of +flags, and can also support general flag types. A new `add_option_fn` lets you +more easily program CLI11 options with the types you choose. Vector options now +support a custom separator. Apps can now be composed with unnamed subcommand +support. The final bool "defaults" flag when creating options has been replaced +by `->capture_default_str()` (ending an old limitation in construction made this +possible); the old method is still available but may be removed in future +versions. + +- Replaced default help capture: `.add_option("name", value, "", True)` becomes + `.add_option("name", value)->capture_default_str()` [#242][] +- Added `.always_capture_default()` [#242][] +- New `CLI::IsMember` validator replaces set validation [#222][] +- `IsMember` also supports container of pairs, transform allows modification of + result [#228][] +- Added new Transformers, `CLI::AsNumberWithUnit` and `CLI::AsSizeValue` + [#253][] +- Much more powerful flags with different values [#211][], general types + [#235][] +- `add_option` now supports bool due to unified bool handling [#211][] +- Support for composable unnamed subcommands [#216][] +- Reparsing is better supported with `.remaining_for_passthrough()` [#265][] +- Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][] +- Validators added for IP4 addresses and positive numbers [#210][] and numbers + [#262][] +- Minimum required Boost for optional Optionals has been corrected to 1.61 + [#226][] +- Positionals can stop options from being parsed with `app.positionals_at_end()` + [#223][] +- Added `validate_positionals` [#262][] +- Positional parsing is much more powerful [#251][], duplicates supported + [#247][] +- Validators can be negated with `!` [#230][], and now handle tname functions + [#228][] +- Better enum support and streaming helper [#233][] and [#228][] +- Cleanup for shadow warnings [#232][] +- Better alignment on multiline descriptions [#269][] +- Better support for aarch64 [#266][] +- Respect `BUILD_TESTING` only if CLI11 is the main project; otherwise, + `CLI11_TESTING` must be used [#277][] +- Drop auto-detection of experimental optional and boost::optional; must be + enabled explicitly (too fragile) [#277][] [#279][] > ### Converting from CLI11 1.7 > -> * `.add_option(..., true)` should be replaced by `.add_option(...)->capture_default_str()` or `app.option_defaults()->always_capture_default()` can be used -> * `app.add_set("--name", value, {"choice1", "choice2"})` should become `app.add_option("--name", value)->check(CLI::IsMember({"choice1", "choice2"}))` -> * The `_ignore_case` version of this can be replaced by adding `CLI::ignore_case` to the argument list in `IsMember` -> * The `_ignore_underscore` version of this can be replaced by adding `CLI::ignore_underscore` to the argument list in `IsMember` -> * The `_ignore_case_underscore` version of this can be replaced by adding both functions listed above to the argument list in `IsMember` -> * If you want an exact match to the original choice after one of the modifier functions matches, use `->transform` instead of `->check` -> * The `_mutable` versions of this can be replaced by passing a pointer or shared pointer into `IsMember` -> * An error with sets now produces a `ValidationError` instead of a `ConversionError` +> - `.add_option(..., true)` should be replaced by +> `.add_option(...)->capture_default_str()` or +> `app.option_defaults()->always_capture_default()` can be used +> - `app.add_set("--name", value, {"choice1", "choice2"})` should become +> `app.add_option("--name", value)->check(CLI::IsMember({"choice1", "choice2"}))` +> - The `_ignore_case` version of this can be replaced by adding +> `CLI::ignore_case` to the argument list in `IsMember` +> - The `_ignore_underscore` version of this can be replaced by adding +> `CLI::ignore_underscore` to the argument list in `IsMember` +> - The `_ignore_case_underscore` version of this can be replaced by adding both +> functions listed above to the argument list in `IsMember` +> - If you want an exact match to the original choice after one of the modifier +> functions matches, use `->transform` instead of `->check` +> - The `_mutable` versions of this can be replaced by passing a pointer or +> shared pointer into `IsMember` +> - An error with sets now produces a `ValidationError` instead of a +> `ConversionError` [#209]: https://github.com/CLIUtils/CLI11/pull/209 [#210]: https://github.com/CLIUtils/CLI11/pull/210 @@ -278,29 +403,50 @@ Set handling has been completely replaced by a new backend that works as a Valid ## Version 1.7: Parse breakup -The parsing procedure now maps much more sensibly to complex, nested subcommand structures. Each phase of the parsing happens on all subcommands before moving on with the next phase of the parse. This allows several features, like required environment variables, to work properly even through subcommand boundaries. -Passing the same subcommand multiple times is better supported. Several new features were added as well, including Windows style option support, parsing strings directly, and ignoring underscores in names. Adding a set that you plan to change later must now be done with `add_mutable_set`. - -* Support Windows style options with `->allow_windows_style_options`. [#187][] On by default on Windows. [#190][] -* Added `parse(string)` to split up and parse a command-line style string directly. [#186][] -* Added `ignore_underscore` and related functions, to ignore underscores when matching names. [#185][] -* The default INI Config will now add quotes to strings with spaces [#195][] -* The default message now will mention the help-all flag also if present [#197][] -* Added `->description` to set Option descriptions [#199][] -* Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][] -* Subcommands now track how many times they were parsed in a parsing process. `count()` with no arguments will return the number of times a subcommand was encountered. [#178][] -* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#178][] -* Calling parse multiple times is now officially supported without `clear` (automatic). [#178][] -* Dropped the mostly undocumented `short_circuit` property, as help flag parsing is a bit more complex, and the default callback behavior of options now works properly. [#179][] -* Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][] -* Cleanup warnings [#191][] -* Remove deprecated names: `set_footer`, `set_name`, `set_callback`, and `set_type_name`. Use without the `set_` instead. [#192][] +The parsing procedure now maps much more sensibly to complex, nested subcommand +structures. Each phase of the parsing happens on all subcommands before moving +on with the next phase of the parse. This allows several features, like required +environment variables, to work properly even through subcommand boundaries. +Passing the same subcommand multiple times is better supported. Several new +features were added as well, including Windows style option support, parsing +strings directly, and ignoring underscores in names. Adding a set that you plan +to change later must now be done with `add_mutable_set`. + +- Support Windows style options with `->allow_windows_style_options`. [#187][] + On by default on Windows. [#190][] +- Added `parse(string)` to split up and parse a command-line style string + directly. [#186][] +- Added `ignore_underscore` and related functions, to ignore underscores when + matching names. [#185][] +- The default INI Config will now add quotes to strings with spaces [#195][] +- The default message now will mention the help-all flag also if present + [#197][] +- Added `->description` to set Option descriptions [#199][] +- Mutating sets (introduced in Version 1.6) now have a clear add method, + `add_mutable_set*`, since the set reference should not expire [#200][] +- Subcommands now track how many times they were parsed in a parsing process. + `count()` with no arguments will return the number of times a subcommand was + encountered. [#178][] +- Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and + `requirements`; all subcommands complete a phase before moving on. [#178][] +- Calling parse multiple times is now officially supported without `clear` + (automatic). [#178][] +- Dropped the mostly undocumented `short_circuit` property, as help flag parsing + is a bit more complex, and the default callback behavior of options now works + properly. [#179][] +- Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][] +- Cleanup warnings [#191][] +- Remove deprecated names: `set_footer`, `set_name`, `set_callback`, and + `set_type_name`. Use without the `set_` instead. [#192][] > ### Converting from CLI11 1.6 > -> * `->short_circuit()` is no longer needed, just remove it if you were using it - raising an exception will happen in the proper place now without it. -> * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature -> * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously). +> - `->short_circuit()` is no longer needed, just remove it if you were using +> it - raising an exception will happen in the proper place now without it. +> - `->add_set*` becomes `->add_mutable_set*` if you were using the editable set +> feature +> - `footer`, `name`, `callback`, and `type_name` must be used instead of the +> `set_*` versions (deprecated previously). [#178]: https://github.com/CLIUtils/CLI11/pull/178 [#183]: https://github.com/CLIUtils/CLI11/pull/183 @@ -317,11 +463,12 @@ Passing the same subcommand multiple times is better supported. Several new feat ### Version 1.7.1: Quick patch -This version provides a quick patch for a (correct) warning from GCC 8 for the windows options code. +This version provides a quick patch for a (correct) warning from GCC 8 for the +windows options code. -* Fix for Windows style option parsing [#201][] -* Improve `add_subcommand` when throwing an exception [#204][] -* Better metadata for Conan package [#202][] +- Fix for Windows style option parsing [#201][] +- Improve `add_subcommand` when throwing an exception [#204][] +- Better metadata for Conan package [#202][] [#201]: https://github.com/CLIUtils/CLI11/pull/201 [#202]: https://github.com/CLIUtils/CLI11/pull/202 @@ -329,66 +476,78 @@ This version provides a quick patch for a (correct) warning from GCC 8 for the w ## Version 1.6: Formatting help -Added a new formatting system [#109][]. You can now set the formatter on Apps. This has also simplified the internals of Apps and Options a bit by separating most formatting code. +Added a new formatting system [#109][]. You can now set the formatter on Apps. +This has also simplified the internals of Apps and Options a bit by separating +most formatting code. -* Added `CLI::Formatter` and `formatter` slot for apps, inherited. -* `FormatterBase` is the minimum required. -* `FormatterLambda` provides for the easy addition of an arbitrary function. -* Added `help_all` support (not added by default). +- Added `CLI::Formatter` and `formatter` slot for apps, inherited. +- `FormatterBase` is the minimum required. +- `FormatterLambda` provides for the easy addition of an arbitrary function. +- Added `help_all` support (not added by default). Changes to the help system (most normal users will not notice this): -* Renamed `single_name` to `get_name(false, false)` (the default). -* The old `get_name()` is now `get_name(false, true)`. -* The old `get_pname()` is now `get_name(true, false)`. -* Removed `help_*` functions. -* Protected function `_has_help_positional` removed. -* `format_help` can now be chained. -* Added getters for the missing parts of options (help no longer uses any private parts). -* Help flags now use new `short_circuit` property to simplify parsing. [#121][] +- Renamed `single_name` to `get_name(false, false)` (the default). +- The old `get_name()` is now `get_name(false, true)`. +- The old `get_pname()` is now `get_name(true, false)`. +- Removed `help_*` functions. +- Protected function `_has_help_positional` removed. +- `format_help` can now be chained. +- Added getters for the missing parts of options (help no longer uses any + private parts). +- Help flags now use new `short_circuit` property to simplify parsing. [#121][] New for Config file reading and writing [#121][]: -* Overridable, bidirectional Config. -* ConfigINI provided and used by default. -* Renamed ini to config in many places. -* Has `config_formatter()` and `get_config_formatter()`. -* Dropped prefix argument from `config_to_str`. -* Added `ConfigItem`. -* Added an example of a custom config format using [nlohmann/json][]. [#138][] +- Overridable, bidirectional Config. +- ConfigINI provided and used by default. +- Renamed ini to config in many places. +- Has `config_formatter()` and `get_config_formatter()`. +- Dropped prefix argument from `config_to_str`. +- Added `ConfigItem`. +- Added an example of a custom config format using [nlohmann/json][]. [#138][] -Validators are now much more powerful [#118][], all built in validators upgraded to the new form: +Validators are now much more powerful [#118][], all built in validators upgraded +to the new form: -* A subclass of `CLI::Validator` is now also accepted. -* They now can set the type name to things like `PATH` and `INT in [1-4]`. -* Validators can be combined with `&` and `|`. -* Old form simple validators are still accepted. +- A subclass of `CLI::Validator` is now also accepted. +- They now can set the type name to things like `PATH` and `INT in [1-4]`. +- Validators can be combined with `&` and `|`. +- Old form simple validators are still accepted. Other changes: -* Fixing `parse(args)`'s `args` setting and ordering after parse. [#141][] -* Replaced `set_custom_option` with `type_name` and `type_size` instead of `set_custom_option`. Methods return `this`. [#136][] -* Dropped `set_` on Option's `type_name`, `default_str`, and `default_val`. [#136][] -* Removed `set_` from App's `failure_message`, `footer`, `callback`, and `name`. [#136][] -* Fixed support `N<-1` for `type_size`. [#140][] -* Added `->each()` to make adding custom callbacks easier. [#126][] -* Allow empty options `add_option("-n",{})` to be edited later with `each` [#142][] -* Added filter argument to `get_subcommands`, `get_options`; use empty filter `{}` to avoid filtering. -* Added `get_groups()` to get groups. -* Better support for manual options with `get_option`, `set_results`, and `empty`. [#119][] -* `lname` and `sname` have getters, added `const get_parent`. [#120][] -* Using `add_set` will now capture L-values for sets, allowing further modification. [#113][] -* Dropped duplicate way to run `get_type_name` (`get_typeval`). -* Removed `requires` in favor of `needs` (deprecated in last version). [#112][] -* Const added to argv. [#126][] +- Fixing `parse(args)`'s `args` setting and ordering after parse. [#141][] +- Replaced `set_custom_option` with `type_name` and `type_size` instead of + `set_custom_option`. Methods return `this`. [#136][] +- Dropped `set_` on Option's `type_name`, `default_str`, and `default_val`. + [#136][] +- Removed `set_` from App's `failure_message`, `footer`, `callback`, and `name`. + [#136][] +- Fixed support `N<-1` for `type_size`. [#140][] +- Added `->each()` to make adding custom callbacks easier. [#126][] +- Allow empty options `add_option("-n",{})` to be edited later with `each` + [#142][] +- Added filter argument to `get_subcommands`, `get_options`; use empty filter + `{}` to avoid filtering. +- Added `get_groups()` to get groups. +- Better support for manual options with `get_option`, `set_results`, and + `empty`. [#119][] +- `lname` and `sname` have getters, added `const get_parent`. [#120][] +- Using `add_set` will now capture L-values for sets, allowing further + modification. [#113][] +- Dropped duplicate way to run `get_type_name` (`get_typeval`). +- Removed `requires` in favor of `needs` (deprecated in last version). [#112][] +- Const added to argv. [#126][] Backend and testing changes: -* Internally, `type_name` is now a lambda function; for sets, this reads the set live. [#116][] -* Cleaner tests without `app.reset()` (and `reset` is now `clear`). [#141][] -* Better CMake policy handling. [#110][] -* Includes are properly sorted. [#120][] -* Testing (only) now uses submodules. [#111][] +- Internally, `type_name` is now a lambda function; for sets, this reads the set + live. [#116][] +- Cleaner tests without `app.reset()` (and `reset` is now `clear`). [#141][] +- Better CMake policy handling. [#110][] +- Includes are properly sorted. [#120][] +- Testing (only) now uses submodules. [#111][] [#109]: https://github.com/CLIUtils/CLI11/pull/109 [#110]: https://github.com/CLIUtils/CLI11/pull/110 @@ -406,18 +565,19 @@ Backend and testing changes: [#140]: https://github.com/CLIUtils/CLI11/pull/140 [#141]: https://github.com/CLIUtils/CLI11/pull/141 [#142]: https://github.com/CLIUtils/CLI11/pull/142 - [nlohmann/json]: https://github.com/nlohmann/json ### Version 1.6.1: Platform fixes -This version provides a few fixes for special cases, such as mixing with `Windows.h` and better defaults -for systems like Hunter. The one new feature is the ability to produce "branded" single file output for -providing custom namespaces or custom macro names. +This version provides a few fixes for special cases, such as mixing with +`Windows.h` and better defaults for systems like Hunter. The one new feature is +the ability to produce "branded" single file output for providing custom +namespaces or custom macro names. -* Added fix and test for including Windows.h [#145][] -* No longer build single file by default if main project, supports systems stuck on Python 2.6 [#149][], [#151][] -* Branding support for single file output [#150][] +- Added fix and test for including Windows.h [#145][] +- No longer build single file by default if main project, supports systems stuck + on Python 2.6 [#149][], [#151][] +- Branding support for single file output [#150][] [#145]: https://github.com/CLIUtils/CLI11/pull/145 [#149]: https://github.com/CLIUtils/CLI11/pull/149 @@ -426,19 +586,23 @@ providing custom namespaces or custom macro names. ### Version 1.6.2: Help-all -This version fixes some formatting bugs with help-all. It also adds fixes for several warnings, including an experimental optional error on Clang 7. Several smaller fixes. - -* Fixed help-all formatting [#163][] - * Printing help-all on nested command now fixed (App) - * Missing space after help-all restored (Default formatter) - * More detail printed on help all (Default formatter) - * Help-all subcommands get indented with inner blank lines removed (Default formatter) - * `detail::find_and_replace` added to utilities -* Fixed CMake install as subproject with `CLI11_INSTALL` flag. [#156][] -* Fixed warning about local variable hiding class member with MSVC [#157][] -* Fixed compile error with default settings on Clang 7 and libc++ [#158][] -* Fixed special case of `--help` on subcommands (general fix planned for 1.7) [#168][] -* Removing an option with links [#179][] +This version fixes some formatting bugs with help-all. It also adds fixes for +several warnings, including an experimental optional error on Clang 7. Several +smaller fixes. + +- Fixed help-all formatting [#163][] + - Printing help-all on nested command now fixed (App) + - Missing space after help-all restored (Default formatter) + - More detail printed on help all (Default formatter) + - Help-all subcommands get indented with inner blank lines removed (Default + formatter) + - `detail::find_and_replace` added to utilities +- Fixed CMake install as subproject with `CLI11_INSTALL` flag. [#156][] +- Fixed warning about local variable hiding class member with MSVC [#157][] +- Fixed compile error with default settings on Clang 7 and libc++ [#158][] +- Fixed special case of `--help` on subcommands (general fix planned for 1.7) + [#168][] +- Removing an option with links [#179][] [#156]: https://github.com/CLIUtils/CLI11/issues/156 [#157]: https://github.com/CLIUtils/CLI11/issues/157 @@ -449,28 +613,39 @@ This version fixes some formatting bugs with help-all. It also adds fixes for se ## Version 1.5: Optionals -This version introduced support for optionals, along with clarification and examples of custom conversion overloads. Enums now have been dropped from the automatic conversion system, allowing explicit protection for out-of-range ints (or a completely custom conversion). This version has some internal cleanup and improved support for the newest compilers. Several bugs were fixed, as well. +This version introduced support for optionals, along with clarification and +examples of custom conversion overloads. Enums now have been dropped from the +automatic conversion system, allowing explicit protection for out-of-range ints +(or a completely custom conversion). This version has some internal cleanup and +improved support for the newest compilers. Several bugs were fixed, as well. Note: This is the final release with `requires`, please switch to `needs`. -* Fix unlimited short options eating two values before checking for positionals when no space present [#90][] -* Symmetric exclude text when excluding options, exclude can be called multiple times [#64][] -* Support for `std::optional`, `std::experimental::optional`, and `boost::optional` added if `__has_include` is supported [#95][] -* All macros/CMake variables now start with `CLI11_` instead of just `CLI_` [#95][] -* The internal stream was not being cleared before use in some cases. Fixed. [#95][] -* Using an enum now requires explicit conversion overload [#97][] -* The separator `--` now is removed when it ends unlimited arguments [#100][] +- Fix unlimited short options eating two values before checking for positionals + when no space present [#90][] +- Symmetric exclude text when excluding options, exclude can be called multiple + times [#64][] +- Support for `std::optional`, `std::experimental::optional`, and + `boost::optional` added if `__has_include` is supported [#95][] +- All macros/CMake variables now start with `CLI11_` instead of just `CLI_` + [#95][] +- The internal stream was not being cleared before use in some cases. Fixed. + [#95][] +- Using an enum now requires explicit conversion overload [#97][] +- The separator `--` now is removed when it ends unlimited arguments [#100][] Other, non-user facing changes: -* Added `Macros.hpp` with better C++ mode discovery [#95][] -* Deprecated macros added for all platforms -* C++17 is now tested on supported platforms [#95][] -* Informational printout now added to CTest [#95][] -* Better single file generation [#95][] -* Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest) -* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92][] -* Examples now run as part of testing [#99][] +- Added `Macros.hpp` with better C++ mode discovery [#95][] +- Deprecated macros added for all platforms +- C++17 is now tested on supported platforms [#95][] +- Informational printout now added to CTest [#95][] +- Better single file generation [#95][] +- Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next + version of GTest) +- Types now have a specific size, separate from the expected number - cleaner + and more powerful internally [#92][] +- Examples now run as part of testing [#99][] [#64]: https://github.com/CLIUtils/CLI11/issues/64 [#90]: https://github.com/CLIUtils/CLI11/issues/90 @@ -482,15 +657,19 @@ Other, non-user facing changes: ### Version 1.5.1: Access -This patch release adds better access to the App programmatically, to assist with writing custom converters to other formats. It also improves the help output, and uses a new feature in CLI11 1.5 to fix an old "quirk" in the way unlimited options and positionals interact. +This patch release adds better access to the App programmatically, to assist +with writing custom converters to other formats. It also improves the help +output, and uses a new feature in CLI11 1.5 to fix an old "quirk" in the way +unlimited options and positionals interact. -* Make mixing unlimited positionals and options more intuitive [#102][] -* Add missing getters `get_options` and `get_description` to App [#105][] -* The app name now can be set, and will override the auto name if present [#105][] -* Add `(REQUIRED)` for required options [#104][] -* Print simple name for Needs/Excludes [#104][] -* Use Needs instead of Requires in help print [#104][] -* Groups now are listed in the original definition order [#106][] +- Make mixing unlimited positionals and options more intuitive [#102][] +- Add missing getters `get_options` and `get_description` to App [#105][] +- The app name now can be set, and will override the auto name if present + [#105][] +- Add `(REQUIRED)` for required options [#104][] +- Print simple name for Needs/Excludes [#104][] +- Use Needs instead of Requires in help print [#104][] +- Groups now are listed in the original definition order [#106][] [#102]: https://github.com/CLIUtils/CLI11/issues/102 [#104]: https://github.com/CLIUtils/CLI11/pull/104 @@ -499,35 +678,44 @@ This patch release adds better access to the App programmatically, to assist wit ### Version 1.5.2: LICENSE in single header mode -This is a quick patch release that makes LICENSE part of the single header file, making it easier to include. Minor cleanup from codacy. No significant code changes from 1.5.1. +This is a quick patch release that makes LICENSE part of the single header file, +making it easier to include. Minor cleanup from codacy. No significant code +changes from 1.5.1. ### Version 1.5.3: Compiler compatibility -This version fixes older AppleClang compilers by removing the optimization for casting. The minimum version of Boost Optional supported has been clarified to be 1.58. CUDA 7.0 NVCC is now supported. +This version fixes older AppleClang compilers by removing the optimization for +casting. The minimum version of Boost Optional supported has been clarified to +be 1.58. CUDA 7.0 NVCC is now supported. ### Version 1.5.4: Optionals -This version fixes the optional search in the single file version; some macros were not yet defined when it did the search. You can define the `CLI11_*_OPTIONAL` macros to 0 if needed to eliminate the search. +This version fixes the optional search in the single file version; some macros +were not yet defined when it did the search. You can define the +`CLI11_*_OPTIONAL` macros to 0 if needed to eliminate the search. ## Version 1.4: More feedback -This version adds lots of smaller fixes and additions after the refactor in version 1.3. More ways to download and use CLI11 in CMake have been added. INI files have improved support. - -* Lexical cast is now more strict than before [#68][] and fails on overflow [#84][] -* Added `get_parent()` to access the parent from a subcommand -* Added `ExistingPath` validator [#73][] -* `app.allow_ini_extras()` added to allow extras in INI files [#70][] -* Multiline INI comments now supported -* Descriptions can now be written with `config_to_str` [#66][] -* Double printing of error message fixed [#77][] -* Renamed `requires` to `needs` to avoid C++20 keyword [#75][], [#82][] -* MakeSingleHeader now works if outside of git [#78][] -* Adding install support for CMake [#79][], improved support for `find_package` [#83][], [#84][] -* Added support for Conan.io [#83][] +This version adds lots of smaller fixes and additions after the refactor in +version 1.3. More ways to download and use CLI11 in CMake have been added. INI +files have improved support. + +- Lexical cast is now more strict than before [#68][] and fails on overflow + [#84][] +- Added `get_parent()` to access the parent from a subcommand +- Added `ExistingPath` validator [#73][] +- `app.allow_ini_extras()` added to allow extras in INI files [#70][] +- Multiline INI comments now supported +- Descriptions can now be written with `config_to_str` [#66][] +- Double printing of error message fixed [#77][] +- Renamed `requires` to `needs` to avoid C++20 keyword [#75][], [#82][] +- MakeSingleHeader now works if outside of git [#78][] +- Adding install support for CMake [#79][], improved support for `find_package` + [#83][], [#84][] +- Added support for Conan.io [#83][] [#70]: https://github.com/CLIUtils/CLI11/issues/70 [#75]: https://github.com/CLIUtils/CLI11/issues/75 - [#84]: https://github.com/CLIUtils/CLI11/pull/84 [#83]: https://github.com/CLIUtils/CLI11/pull/83 [#82]: https://github.com/CLIUtils/CLI11/pull/82 @@ -540,162 +728,237 @@ This version adds lots of smaller fixes and additions after the refactor in vers ## Version 1.3: Refactor -This version focused on refactoring several key systems to ensure correct behavior in the interaction of different settings. Most caveats about -features only working on the main App have been addressed, and extra arguments have been reworked. Inheritance -of defaults makes configuring CLI11 much easier without having to subclass. Policies add new ways to handle multiple arguments to match your -favorite CLI programs. Error messages and help messages are better and more flexible. Several bugs and odd behaviors in the parser have been fixed. - -* Added a version macro, `CLI11_VERSION`, along with `*_MAJOR`, `*_MINOR`, and `*_PATCH`, for programmatic access to the version. -* Reworked the way defaults are set and inherited; explicit control given to user with `->option_defaults()` [#48](https://github.com/CLIUtils/CLI11/pull/48) -* Hidden options now are based on an empty group name, instead of special "hidden" keyword [#48](https://github.com/CLIUtils/CLI11/pull/48) -* `parse` no longer returns (so `CLI11_PARSE` is always usable) [#37](https://github.com/CLIUtils/CLI11/pull/37) -* Added `remaining()` and `remaining_size()` [#37](https://github.com/CLIUtils/CLI11/pull/37) -* `allow_extras` and `prefix_command` are now valid on subcommands [#37](https://github.com/CLIUtils/CLI11/pull/37) -* Added `take_last` to only take last value passed [#40](https://github.com/CLIUtils/CLI11/pull/40) -* Added `multi_option_policy` and shortcuts to provide more control than just a take last policy [#59](https://github.com/CLIUtils/CLI11/pull/59) -* More detailed error messages in a few cases [#41](https://github.com/CLIUtils/CLI11/pull/41) -* Footers can be added to help [#42](https://github.com/CLIUtils/CLI11/pull/42) -* Help flags are easier to customize [#43](https://github.com/CLIUtils/CLI11/pull/43) -* Subcommand now support groups [#46](https://github.com/CLIUtils/CLI11/pull/46) -* `CLI::RuntimeError` added, for easy exit with error codes [#45](https://github.com/CLIUtils/CLI11/pull/45) -* The clang-format script is now no longer "hidden" [#48](https://github.com/CLIUtils/CLI11/pull/48) -* The order is now preserved for subcommands (list and callbacks) [#49](https://github.com/CLIUtils/CLI11/pull/49) -* Tests now run individually, utilizing CMake 3.10 additions if possible [#50](https://github.com/CLIUtils/CLI11/pull/50) -* Failure messages are now customizable, with a shorter default [#52](https://github.com/CLIUtils/CLI11/pull/52) -* Some improvements to error codes [#53](https://github.com/CLIUtils/CLI11/pull/53) -* `require_subcommand` now offers a two-argument form and negative values on the one-argument form are more useful [#51](https://github.com/CLIUtils/CLI11/pull/51) -* Subcommands no longer match after the max required number is obtained [#51](https://github.com/CLIUtils/CLI11/pull/51) -* Unlimited options no longer prioritize over remaining/unlimited positionals [#51](https://github.com/CLIUtils/CLI11/pull/51) -* Added `->transform` which modifies the string parsed [#54](https://github.com/CLIUtils/CLI11/pull/54) -* Changed of API in validators to `void(std::string &)` (const for users), throwing providing nicer errors [#54](https://github.com/CLIUtils/CLI11/pull/54) -* Added `CLI::ArgumentMismatch` [#56](https://github.com/CLIUtils/CLI11/pull/56) and fixed missing failure if one arg expected [#55](https://github.com/CLIUtils/CLI11/issues/55) -* Support for minimum unlimited expected arguments [#56](https://github.com/CLIUtils/CLI11/pull/56) -* Single internal arg parse function [#56](https://github.com/CLIUtils/CLI11/pull/56) -* Allow options to be disabled from INI file, rename `add_config` to `set_config` [#60](https://github.com/CLIUtils/CLI11/pull/60) +This version focused on refactoring several key systems to ensure correct +behavior in the interaction of different settings. Most caveats about features +only working on the main App have been addressed, and extra arguments have been +reworked. Inheritance of defaults makes configuring CLI11 much easier without +having to subclass. Policies add new ways to handle multiple arguments to match +your favorite CLI programs. Error messages and help messages are better and more +flexible. Several bugs and odd behaviors in the parser have been fixed. + +- Added a version macro, `CLI11_VERSION`, along with `*_MAJOR`, `*_MINOR`, and + `*_PATCH`, for programmatic access to the version. +- Reworked the way defaults are set and inherited; explicit control given to + user with `->option_defaults()` + [#48](https://github.com/CLIUtils/CLI11/pull/48) +- Hidden options now are based on an empty group name, instead of special + "hidden" keyword [#48](https://github.com/CLIUtils/CLI11/pull/48) +- `parse` no longer returns (so `CLI11_PARSE` is always usable) + [#37](https://github.com/CLIUtils/CLI11/pull/37) +- Added `remaining()` and `remaining_size()` + [#37](https://github.com/CLIUtils/CLI11/pull/37) +- `allow_extras` and `prefix_command` are now valid on subcommands + [#37](https://github.com/CLIUtils/CLI11/pull/37) +- Added `take_last` to only take last value passed + [#40](https://github.com/CLIUtils/CLI11/pull/40) +- Added `multi_option_policy` and shortcuts to provide more control than just a + take last policy [#59](https://github.com/CLIUtils/CLI11/pull/59) +- More detailed error messages in a few cases + [#41](https://github.com/CLIUtils/CLI11/pull/41) +- Footers can be added to help [#42](https://github.com/CLIUtils/CLI11/pull/42) +- Help flags are easier to customize + [#43](https://github.com/CLIUtils/CLI11/pull/43) +- Subcommand now support groups [#46](https://github.com/CLIUtils/CLI11/pull/46) +- `CLI::RuntimeError` added, for easy exit with error codes + [#45](https://github.com/CLIUtils/CLI11/pull/45) +- The clang-format script is now no longer "hidden" + [#48](https://github.com/CLIUtils/CLI11/pull/48) +- The order is now preserved for subcommands (list and callbacks) + [#49](https://github.com/CLIUtils/CLI11/pull/49) +- Tests now run individually, utilizing CMake 3.10 additions if possible + [#50](https://github.com/CLIUtils/CLI11/pull/50) +- Failure messages are now customizable, with a shorter default + [#52](https://github.com/CLIUtils/CLI11/pull/52) +- Some improvements to error codes + [#53](https://github.com/CLIUtils/CLI11/pull/53) +- `require_subcommand` now offers a two-argument form and negative values on the + one-argument form are more useful + [#51](https://github.com/CLIUtils/CLI11/pull/51) +- Subcommands no longer match after the max required number is obtained + [#51](https://github.com/CLIUtils/CLI11/pull/51) +- Unlimited options no longer prioritize over remaining/unlimited positionals + [#51](https://github.com/CLIUtils/CLI11/pull/51) +- Added `->transform` which modifies the string parsed + [#54](https://github.com/CLIUtils/CLI11/pull/54) +- Changed of API in validators to `void(std::string &)` (const for users), + throwing providing nicer errors + [#54](https://github.com/CLIUtils/CLI11/pull/54) +- Added `CLI::ArgumentMismatch` [#56](https://github.com/CLIUtils/CLI11/pull/56) + and fixed missing failure if one arg expected + [#55](https://github.com/CLIUtils/CLI11/issues/55) +- Support for minimum unlimited expected arguments + [#56](https://github.com/CLIUtils/CLI11/pull/56) +- Single internal arg parse function + [#56](https://github.com/CLIUtils/CLI11/pull/56) +- Allow options to be disabled from INI file, rename `add_config` to + `set_config` [#60](https://github.com/CLIUtils/CLI11/pull/60) > ### Converting from CLI11 1.2 > -> * `app.parse` no longer returns a vector. Instead, use `app.remaining(true)`. -> * `"hidden"` is no longer a special group name, instead use `""` -> * Validators API has changed to return an error string; use `.empty()` to get the old bool back -> * Use `.set_help_flag` instead of accessing the help pointer directly (discouraged, but not removed yet) -> * `add_config` has been renamed to `set_config` -> * Errors thrown in some cases are slightly more specific +> - `app.parse` no longer returns a vector. Instead, use `app.remaining(true)`. +> - `"hidden"` is no longer a special group name, instead use `""` +> - Validators API has changed to return an error string; use `.empty()` to get +> the old bool back +> - Use `.set_help_flag` instead of accessing the help pointer directly +> (discouraged, but not removed yet) +> - `add_config` has been renamed to `set_config` +> - Errors thrown in some cases are slightly more specific ## Version 1.2: Stability -This release focuses on making CLI11 behave properly in corner cases, and with config files on the command line. This includes fixes for a variety of reported issues. A few features were added to make life easier, as well; such as a new flag callback and a macro for the parse command. - -* Added functional form of flag [#33](https://github.com/CLIUtils/CLI11/pull/33), automatic on C++14 -* Fixed Config file search if passed on command line [#30](https://github.com/CLIUtils/CLI11/issues/30) -* Added `CLI11_PARSE(app, argc, argv)` macro for simple parse commands (does not support returning arg) -* The name string can now contain spaces around commas [#29](https://github.com/CLIUtils/CLI11/pull/29) -* `set_default_str` now only sets string, and `set_default_val` will evaluate the default string given [#26](https://github.com/CLIUtils/CLI11/issues/26) -* Required positionals now take priority over subcommands [#23](https://github.com/CLIUtils/CLI11/issues/23) -* Extra requirements enforced by Travis +This release focuses on making CLI11 behave properly in corner cases, and with +config files on the command line. This includes fixes for a variety of reported +issues. A few features were added to make life easier, as well; such as a new +flag callback and a macro for the parse command. + +- Added functional form of flag + [#33](https://github.com/CLIUtils/CLI11/pull/33), automatic on C++14 +- Fixed Config file search if passed on command line + [#30](https://github.com/CLIUtils/CLI11/issues/30) +- Added `CLI11_PARSE(app, argc, argv)` macro for simple parse commands (does not + support returning arg) +- The name string can now contain spaces around commas + [#29](https://github.com/CLIUtils/CLI11/pull/29) +- `set_default_str` now only sets string, and `set_default_val` will evaluate + the default string given [#26](https://github.com/CLIUtils/CLI11/issues/26) +- Required positionals now take priority over subcommands + [#23](https://github.com/CLIUtils/CLI11/issues/23) +- Extra requirements enforced by Travis ## Version 1.1: Feedback -This release incorporates feedback from the release announcement. The examples are slowly being expanded, some corner cases improved, and some new functionality for tricky parsing situations. - -* Added simple support for enumerations, allow non-printable objects [#12](https://github.com/CLIUtils/CLI11/issues/12) -* Added `app.parse_order()` with original parse order ([#13](https://github.com/CLIUtils/CLI11/issues/13), [#16](https://github.com/CLIUtils/CLI11/pull/16)) -* Added `prefix_command()`, which is like `allow_extras` but instantly stops and returns. ([#8](https://github.com/CLIUtils/CLI11/issues/8), [#17](https://github.com/CLIUtils/CLI11/pull/17)) -* Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10), [#20](https://github.com/CLIUtils/CLI11/pull/20)) -* Some improvements to CMake, detect Python and no dependencies on Python 2 (like Python 3) ([#18](https://github.com/CLIUtils/CLI11/issues/18), [#21](https://github.com/CLIUtils/CLI11/pull/21)) +This release incorporates feedback from the release announcement. The examples +are slowly being expanded, some corner cases improved, and some new +functionality for tricky parsing situations. + +- Added simple support for enumerations, allow non-printable objects + [#12](https://github.com/CLIUtils/CLI11/issues/12) +- Added `app.parse_order()` with original parse order + ([#13](https://github.com/CLIUtils/CLI11/issues/13), + [#16](https://github.com/CLIUtils/CLI11/pull/16)) +- Added `prefix_command()`, which is like `allow_extras` but instantly stops and + returns. ([#8](https://github.com/CLIUtils/CLI11/issues/8), + [#17](https://github.com/CLIUtils/CLI11/pull/17)) +- Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10), + [#20](https://github.com/CLIUtils/CLI11/pull/20)) +- Some improvements to CMake, detect Python and no dependencies on Python 2 + (like Python 3) ([#18](https://github.com/CLIUtils/CLI11/issues/18), + [#21](https://github.com/CLIUtils/CLI11/pull/21)) ## Version 1.0: Official release -This is the first stable release for CLI11. Future releases will try to remain backward compatible and will follow semantic versioning if possible. There were a few small changes since version 0.9: +This is the first stable release for CLI11. Future releases will try to remain +backward compatible and will follow semantic versioning if possible. There were +a few small changes since version 0.9: -* Cleanup using `clang-tidy` and `clang-format` -* Small improvements to Timers, easier to subclass Error -* Move to 3-Clause BSD license +- Cleanup using `clang-tidy` and `clang-format` +- Small improvements to Timers, easier to subclass Error +- Move to 3-Clause BSD license ## Version 0.9: Polish -This release focused on cleaning up the most exotic compiler warnings, fixing a few oddities of the config parser, and added a more natural method to check subcommands. +This release focused on cleaning up the most exotic compiler warnings, fixing a +few oddities of the config parser, and added a more natural method to check +subcommands. -* Better CMake named target (CLI11) -* More warnings added, fixed -* Ini output now includes `=false` when `default_also` is true -* Ini no longer lists the help pointer -* Added test for inclusion in multiple files and linking, fixed issues (rarely needed for CLI, but nice for tools) -* Support for complex numbers -* Subcommands now test true/false directly or with `->parsed()`, cleaner parse +- Better CMake named target (CLI11) +- More warnings added, fixed +- Ini output now includes `=false` when `default_also` is true +- Ini no longer lists the help pointer +- Added test for inclusion in multiple files and linking, fixed issues (rarely + needed for CLI, but nice for tools) +- Support for complex numbers +- Subcommands now test true/false directly or with `->parsed()`, cleaner parse ## Version 0.8: CLIUtils This release moved the repository to the CLIUtils main organization. -* Moved to CLIUtils on GitHub -* Fixed docs build and a few links +- Moved to CLIUtils on GitHub +- Fixed docs build and a few links ## Version 0.7: Code coverage 100% -Lots of small bugs fixed when adding code coverage, better in edge cases. Much more powerful ini support. +Lots of small bugs fixed when adding code coverage, better in edge cases. Much +more powerful ini support. -* Allow comments in ini files (lines starting with `;`) -* Ini files support flags, vectors, subcommands -* Added CodeCov code coverage reports -* Lots of small bugfixes related to adding tests to increase coverage to 100% -* Error handling now uses scoped enum in errors -* Reparsing rules changed a little to accommodate Ini files. Callbacks are now called when parsing INI, and reset any time results are added. -* Adding extra utilities in full version only, `Timer` (not needed for parsing, but useful for general CLI applications). -* Better support for custom `add_options` like functions. +- Allow comments in ini files (lines starting with `;`) +- Ini files support flags, vectors, subcommands +- Added CodeCov code coverage reports +- Lots of small bugfixes related to adding tests to increase coverage to 100% +- Error handling now uses scoped enum in errors +- Reparsing rules changed a little to accommodate Ini files. Callbacks are now + called when parsing INI, and reset any time results are added. +- Adding extra utilities in full version only, `Timer` (not needed for parsing, + but useful for general CLI applications). +- Better support for custom `add_options` like functions. ## Version 0.6: Cleanup -Lots of cleanup and docs additions made it into this release. Parsing is simpler and more robust; fall through option added and works as expected; much more consistent variable names internally. +Lots of cleanup and docs additions made it into this release. Parsing is simpler +and more robust; fall through option added and works as expected; much more +consistent variable names internally. -* Simplified parsing to use `vector<string>` only -* Fixed fallthrough, made it optional as well (default: off): `.fallthrough()`. -* Added string versions of `->requires()` and `->excludes()` for consistency. -* Renamed protected members for internal consistency, grouped docs. -* Added the ability to add a number to `.require_subcommand()`. +- Simplified parsing to use `vector<string>` only +- Fixed fallthrough, made it optional as well (default: off): `.fallthrough()`. +- Added string versions of `->requires()` and `->excludes()` for consistency. +- Renamed protected members for internal consistency, grouped docs. +- Added the ability to add a number to `.require_subcommand()`. ## Version 0.5: Windows support -* Allow `Hidden` options. -* Throw `OptionAlreadyAdded` errors for matching subcommands or options, with ignore-case included, tests -* `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. Subcommands inherit setting from parent App on creation. -* Subcommands now can be "chained", that is, left over arguments can now include subcommands that then get parsed. Subcommands are now a list (`get_subcommands`). Added `got_subcommand(App_or_name)` to check for subcommands. -* Added `.allow_extras()` to disable error on failure. Parse returns a vector of leftover options. Renamed error to `ExtrasError`, and now triggers on extra options too. -* Added `require_subcommand` to `App`, to simplify forcing subcommands. Do **not** do `add_subcommand()->require_subcommand`, since that is the subcommand, not the main `App`. -* Added printout of ini file text given parsed options, skips flags. -* Support for quotes and spaces in ini files -* Fixes to allow support for Windows (added Appveyor) (Uses `-`, not `/` syntax) +- Allow `Hidden` options. +- Throw `OptionAlreadyAdded` errors for matching subcommands or options, with + ignore-case included, tests +- `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. + Subcommands inherit setting from parent App on creation. +- Subcommands now can be "chained", that is, left over arguments can now include + subcommands that then get parsed. Subcommands are now a list + (`get_subcommands`). Added `got_subcommand(App_or_name)` to check for + subcommands. +- Added `.allow_extras()` to disable error on failure. Parse returns a vector of + leftover options. Renamed error to `ExtrasError`, and now triggers on extra + options too. +- Added `require_subcommand` to `App`, to simplify forcing subcommands. Do + **not** do `add_subcommand()->require_subcommand`, since that is the + subcommand, not the main `App`. +- Added printout of ini file text given parsed options, skips flags. +- Support for quotes and spaces in ini files +- Fixes to allow support for Windows (added Appveyor) (Uses `-`, not `/` syntax) ## Version 0.4: Ini support -* Updates to help print -* Removed `run`, please use `parse` unless you subclass and add it -* Supports ini files mixed with command line, tested -* Added Range for further Plumbum compatibility -* Added function to print out ini file +- Updates to help print +- Removed `run`, please use `parse` unless you subclass and add it +- Supports ini files mixed with command line, tested +- Added Range for further Plumbum compatibility +- Added function to print out ini file ## Version 0.3: Plumbum compatibility -* Added `->requires`, `->excludes`, and `->envname` from [Plumbum](http://plumbum.readthedocs.io/en/latest/) -* Supports `->mandatory` from Plumbum -* More tests for help strings, improvements in formatting -* Support type and set syntax in positionals help strings -* Added help groups, with `->group("name")` syntax -* Added initial support for ini file reading with `add_config` option. -* Supports GCC 4.7 again -* Clang 3.5 now required for tests due to googlemock usage, 3.4 should still work otherwise -* Changes `setup` for an explicit help bool in constructor/`add_subcommand` +- Added `->requires`, `->excludes`, and `->envname` from + [Plumbum](http://plumbum.readthedocs.io/en/latest/) +- Supports `->mandatory` from Plumbum +- More tests for help strings, improvements in formatting +- Support type and set syntax in positionals help strings +- Added help groups, with `->group("name")` syntax +- Added initial support for ini file reading with `add_config` option. +- Supports GCC 4.7 again +- Clang 3.5 now required for tests due to googlemock usage, 3.4 should still + work otherwise +- Changes `setup` for an explicit help bool in constructor/`add_subcommand` ## Version 0.2: Leaner and meaner -* Moved to simpler syntax, where `Option` pointers are returned and operated on -* Removed `make_` style options -* Simplified Validators, now only requires `->check(function)` -* Removed Combiners -* Fixed pointers to Options, stored in `unique_ptr` now -* Added `Option_p` and `App_p`, mostly for internal use -* Startup sequence, including help flag, can be modified by subclasses +- Moved to simpler syntax, where `Option` pointers are returned and operated on +- Removed `make_` style options +- Simplified Validators, now only requires `->check(function)` +- Removed Combiners +- Fixed pointers to Options, stored in `unique_ptr` now +- Added `Option_p` and `App_p`, mostly for internal use +- Startup sequence, including help flag, can be modified by subclasses ## Version 0.1: First release -First release before major cleanup. Still has make syntax and combiners; very clever syntax but not the best or most commonly expected way to work. +First release before major cleanup. Still has make syntax and combiners; very +clever syntax but not the best or most commonly expected way to work. diff --git a/packages/CLI11/CLI11.hpp.in b/packages/CLI11/CLI11.hpp.in index 9439a4300340b110681be4d38e05da15451e7bf7..83f228ebf0cfeb2eb9da1dd0e18e03ef0c731431 100644 --- a/packages/CLI11/CLI11.hpp.in +++ b/packages/CLI11/CLI11.hpp.in @@ -5,7 +5,7 @@ // This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts // from: {git} // -// CLI11 {version} Copyright (c) 2017-2021 University of Cincinnati, developed by Henry +// CLI11 {version} Copyright (c) 2017-2022 University of Cincinnati, developed by Henry // Schreiner under NSF AWARD 1414736. All rights reserved. // // Redistribution and use in source and binary forms of CLI11, with or without @@ -46,24 +46,38 @@ namespace {namespace} {{ {string_tools_hpp} +{string_tools_inl_hpp} + {error_hpp} {type_tools_hpp} {split_hpp} +{split_inl_hpp} + {config_fwd_hpp} {validators_hpp} +{validators_inl_hpp} + {formatter_fwd_hpp} {option_hpp} +{option_inl_hpp} + {app_hpp} +{app_inl_hpp} + {config_hpp} +{config_inl_hpp} + {formatter_hpp} +{formatter_inl_hpp} + }} // namespace {namespace} diff --git a/packages/CLI11/CMakeLists.txt b/packages/CLI11/CMakeLists.txt index 1f4313ff59743a81a75ce1f5e15d3afa29c7c5ed..31bbbbb6cbf6cdda4b6512eb253a0dfec3868cc6 100644 --- a/packages/CLI11/CMakeLists.txt +++ b/packages/CLI11/CMakeLists.txt @@ -27,6 +27,8 @@ project( LANGUAGES CXX VERSION ${VERSION_STRING}) +list(APPEND CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/cmake") + # Print the version number of CMake if this is the main project if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) message(STATUS "CMake ${CMAKE_VERSION}") @@ -77,6 +79,7 @@ endif() option(CLI11_WARNINGS_AS_ERRORS "Turn all warnings into errors (for CI)") option(CLI11_SINGLE_FILE "Generate a single header file") +option(CLI11_PRECOMPILED "Generate a precompiled static library instead of a header-only" OFF) cmake_dependent_option(CLI11_SANITIZERS "Download the sanitizers CMake config" OFF "NOT CMAKE_VERSION VERSION_LESS 3.11" OFF) @@ -105,12 +108,10 @@ cmake_dependent_option( CLI11_CUDA_TESTS "Build the tests with NVCC to check for warnings there - requires CMake 3.9+" OFF "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME" OFF) -cmake_dependent_option( - CLI11_CLANG_TIDY "Look for and use Clang-Tidy" OFF - "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME;NOT CMAKE_VERSION VERSION_LESS 3.6" OFF) -set(CLI11_CLANG_TIDY_OPTIONS - "" - CACHE STRING "Clang tidy options, such as -fix, semicolon separated") +if(CLI11_PRECOMPILED AND CLI11_SINGLE_FILE) + # Sanity check + message(FATAL_ERROR "CLI11_PRECOMPILE and CLI11_SINGLE_FILE are mutually exclusive") +endif() if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) @@ -129,59 +130,9 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif() -# Special target that adds warnings. Is not exported. -add_library(CLI11_warnings INTERFACE) - -set(unix-warnings -Wall -Wextra -pedantic -Wshadow -Wsign-conversion -Wswitch-enum) - -# Buggy in GCC 4.8 -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) - list(APPEND unix-warnings -Weffc++) -endif() - -target_compile_options( - CLI11_warnings - INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++> - $<$<CXX_COMPILER_ID:MSVC>:/W4 - $<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:/WX>> - $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${unix-warnings} - $<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:-Werror>>) - -if(NOT CMAKE_VERSION VERSION_LESS 3.13) - target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>) -endif() +include(CLI11Warnings) -# Allow IDE's to group targets into folders -add_library(CLI11 INTERFACE) -add_library(CLI11::CLI11 ALIAS CLI11) # for add_subdirectory calls - -# Duplicated because CMake adds the current source dir if you don't. -target_include_directories(CLI11 INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> - $<INSTALL_INTERFACE:include>) - -if(CMAKE_VERSION VERSION_LESS 3.8) - # This might not be a complete list - target_compile_features( - CLI11 - INTERFACE cxx_lambdas - cxx_nullptr - cxx_override - cxx_range_for - cxx_right_angle_brackets - cxx_strong_enums - cxx_constexpr - cxx_auto_type) -else() - target_compile_features(CLI11 INTERFACE cxx_std_11) -endif() - -# To see in IDE, headers must be listed for target -set(header-patterns "${PROJECT_SOURCE_DIR}/include/CLI/*") -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND NOT CMAKE_VERSION VERSION_LESS 3.12) - list(INSERT header-patterns 0 CONFIGURE_DEPENDS) -endif() - -file(GLOB CLI11_headers ${header-patterns}) +add_subdirectory(src) # Allow tests to be run on CUDA if(CLI11_CUDA_TESTS) @@ -191,22 +142,8 @@ if(CLI11_CUDA_TESTS) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe --display_error_number") endif() -# Prepare Clang-Tidy -if(CLI11_CLANG_TIDY) - find_program( - CLANG_TIDY_EXE - NAMES "clang-tidy" - DOC "Path to clang-tidy executable" REQUIRED) - - set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" ${CLI11_CLANG_TIDY_OPTIONS}) -endif() - # This folder should be installed if(CLI11_INSTALL) - install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - - # Make an export target - install(TARGETS CLI11 EXPORT CLI11Targets) # Use find_package on the installed package # Since we have no custom code, we can directly write this @@ -239,41 +176,6 @@ if(CLI11_INSTALL) export(PACKAGE CLI11) endif() -if(CLI11_SINGLE_FILE) - # Single file test - if(CMAKE_VERSION VERSION_LESS 3.12) - find_package(PythonInterp REQUIRED) - add_executable(Python::Interpreter IMPORTED) - set_target_properties(Python::Interpreter PROPERTIES IMPORTED_LOCATION "${PYTHON_EXECUTABLE}" - VERSION "${PYTHON_VERSION_STRING}") - else() - find_package( - Python - COMPONENTS Interpreter - REQUIRED) - endif() - - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" - COMMAND - Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/scripts/MakeSingleHeader.py" - ${CLI11_headers} --main "${CMAKE_CURRENT_SOURCE_DIR}/CLI11.hpp.in" --output - "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" --version "${CLI11_VERSION}" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/CLI/CLI.hpp" ${CLI11_headers}) - add_custom_target(CLI11-generate-single-file ALL - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp") - set_property(TARGET CLI11-generate-single-file PROPERTY FOLDER "Scripts") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" DESTINATION include) - add_library(CLI11_SINGLE INTERFACE) - target_link_libraries(CLI11_SINGLE INTERFACE CLI11) - add_dependencies(CLI11_SINGLE CLI11-generate-single-file) - target_compile_definitions(CLI11_SINGLE INTERFACE -DCLI11_SINGLE_FILE) - target_include_directories( - CLI11_SINGLE INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/> - $<INSTALL_INTERFACE:include>) -endif() - if(CLI11_BUILD_TESTS) include(CTest) add_subdirectory(tests) diff --git a/packages/CLI11/LICENSE b/packages/CLI11/LICENSE index 17739d11c50b5a51574549ef1cf2534a7dcd0bc0..71c4770317617032abe4bc36a4ab98d470f4d20c 100644 --- a/packages/CLI11/LICENSE +++ b/packages/CLI11/LICENSE @@ -1,4 +1,4 @@ -CLI11 1.8 Copyright (c) 2017-2019 University of Cincinnati, developed by Henry +CLI11 2.2 Copyright (c) 2017-2022 University of Cincinnati, developed by Henry Schreiner under NSF AWARD 1414736. All rights reserved. Redistribution and use in source and binary forms of CLI11, with or without diff --git a/packages/CLI11/README.md b/packages/CLI11/README.md index ad1ac1e97b63de4b8c4501b74831c149c3633d21..989ef43b2a665865b897a96243e3d1f8c9c17921 100644 --- a/packages/CLI11/README.md +++ b/packages/CLI11/README.md @@ -7,8 +7,7 @@ [![Build Status AppVeyor][appveyor-badge]][appveyor] [![Code Coverage][codecov-badge]][codecov] [![Codacy Badge][codacy-badge]][codacy-link] -[![License: BSD][license-badge]](./LICENSE) -[![DOI][doi-badge]][doi-link] +[![License: BSD][license-badge]](./LICENSE) [![DOI][doi-badge]][doi-link] [![Gitter chat][gitter-badge]][gitter] [![Latest GHA release][releases-badge]][github releases] @@ -17,78 +16,101 @@ [![Conda Version][conda-badge]][conda-link] [![Try CLI11 2.1 online][wandbox-badge]][wandbox-link] -[What's new](./CHANGELOG.md) • -[Documentation][gitbook] • -[API Reference][api-docs] +[What's new](./CHANGELOG.md) • [Documentation][gitbook] • [API +Reference][api-docs] -CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface. +CLI11 is a command line parser for C++11 and beyond that provides a rich feature +set with a simple and intuitive interface. ## Table of Contents -* [Background](#background) - * [Introduction](#introduction) - * [Why write another CLI parser?](#why-write-another-cli-parser) - * [Other parsers](#other-parsers) - * [Features not supported by this library](#features-not-supported-by-this-library) -* [Install](#install) -* [Usage](#usage) - * [Adding options](#adding-options) - * [Option types](#option-types) - * [Example](#example) - * [Option options](#option-options) - * [Validators](#validators) - * [Transforming Validators](#transforming-validators) - * [Validator operations](#validator-operations) - * [Custom Validators](#custom-validators) - * [Querying Validators](#querying-validators) - * [Getting Results](#getting-results) - * [Subcommands](#subcommands) - * [Subcommand options](#subcommand-options) - * [Option groups](#option-groups) - * [Callbacks](#callbacks) - * [Configuration file](#configuration-file) - * [Inheriting defaults](#inheriting-defaults) - * [Formatting](#formatting) - * [Subclassing](#subclassing) - * [How it works](#how-it-works) - * [Utilities](#utilities) - * [Other libraries](#other-libraries) -* [API](#api) -* [Examples](#Examples) -* [Contribute](#contribute) -* [License](#license) - -Features that were added in the last released major version are marked with "🆕". Features only available in main are marked with "🚧". +- [Background](#background) + - [Introduction](#introduction) + - [Why write another CLI parser?](#why-write-another-cli-parser) + - [Other parsers](#other-parsers) + - [Features not supported by this library](#features-not-supported-by-this-library) +- [Install](#install) +- [Usage](#usage) + - [Adding options](#adding-options) + - [Option types](#option-types) + - [Example](#example) + - [Option options](#option-options) + - [Validators](#validators) + - [Transforming Validators](#transforming-validators) + - [Validator operations](#validator-operations) + - [Custom Validators](#custom-validators) + - [Querying Validators](#querying-validators) + - [Getting Results](#getting-results) + - [Subcommands](#subcommands) + - [Subcommand options](#subcommand-options) + - [Option groups](#option-groups) + - [Callbacks](#callbacks) + - [Configuration file](#configuration-file) + - [Inheriting defaults](#inheriting-defaults) + - [Formatting](#formatting) + - [Subclassing](#subclassing) + - [How it works](#how-it-works) + - [Utilities](#utilities) + - [Other libraries](#other-libraries) +- [API](#api) +- [Examples](#Examples) +- [Contribute](#contribute) +- [License](#license) + +Features that were added in the last released minor version are marked with +"🆕". Features only available in main are marked with "🚧". ## Background ### Introduction -CLI11 provides all the features you expect in a powerful command line parser, with a beautiful, minimal syntax and no dependencies beyond C++11. It is header only, and comes in a single file form for easy inclusion in projects. It is easy to use for small projects, but powerful enough for complex command line projects, and can be customized for frameworks. -It is tested on [Azure][] and [GitHub Actions][actions-link], and was originally used by the [GooFit GPU fitting framework][goofit]. It was inspired by [`plumbum.cli`][plumbum] for Python. CLI11 has a user friendly introduction in this README, a more in-depth tutorial [GitBook][], as well as [API documentation][api-docs] generated by Travis. -See the [changelog](./CHANGELOG.md) or [GitHub Releases][] for details for current and past releases. Also see the [Version 1.0 post][], [Version 1.3 post][], [Version 1.6 post][], or [Version 2.0 post][] for more information. - -You can be notified when new releases are made by subscribing to <https://github.com/CLIUtils/CLI11/releases.atom> on an RSS reader, like Feedly, or use the releases mode of the GitHub watching tool. +CLI11 provides all the features you expect in a powerful command line parser, +with a beautiful, minimal syntax and no dependencies beyond C++11. It is header +only, and comes in a single file form for easy inclusion in projects. It is easy +to use for small projects, but powerful enough for complex command line +projects, and can be customized for frameworks. It is tested on [Azure][] and +[GitHub Actions][actions-link], and was originally used by the [GooFit GPU +fitting framework][goofit]. It was inspired by [`plumbum.cli`][plumbum] for +Python. CLI11 has a user friendly introduction in this README, a more in-depth +tutorial [GitBook][], as well as [API documentation][api-docs] generated by +Travis. See the [changelog](./CHANGELOG.md) or [GitHub Releases][] for details +for current and past releases. Also see the [Version 1.0 post][], [Version 1.3 +post][], [Version 1.6 post][], or [Version 2.0 post][] for more information. + +You can be notified when new releases are made by subscribing to +<https://github.com/CLIUtils/CLI11/releases.atom> on an RSS reader, like Feedly, +or use the releases mode of the GitHub watching tool. ### Why write another CLI parser? An acceptable CLI parser library should be all of the following: -* Easy to include (i.e., header only, one file if possible, **no external requirements**). -* Short, simple syntax: This is one of the main reasons to use a CLI parser, it should make variables from the command line nearly as easy to define as any other variables. If most of your program is hidden in CLI parsing, this is a problem for readability. -* C++11 or better: Should work with GCC 4.8+ (default on CentOS/RHEL 7), Clang 3.4+, AppleClang 7+, NVCC 7.0+, or MSVC 2015+. -* Work on Linux, macOS, and Windows. -* Well tested on all common platforms and compilers. "Well" is defined as having good coverage measured by [CodeCov][]. -* Clear help printing. -* Nice error messages. -* Standard shell idioms supported naturally, like grouping flags, a positional separator, etc. -* Easy to execute, with help, parse errors, etc. providing correct exit and details. -* Easy to extend as part of a framework that provides "applications" to users. -* Usable subcommand syntax, with support for multiple subcommands, nested subcommands, option groups, and optional fallthrough (explained later). -* Ability to add a configuration file (`TOML`, `INI`, or custom format), and produce it as well. -* Produce real values that can be used directly in code, not something you have pay compute time to look up, for HPC applications. -* Work with standard types, simple custom types, and extensible to exotic types. -* Permissively licensed. +- Easy to include (i.e., header only, one file if possible, **no external + requirements**). +- Short, simple syntax: This is one of the main reasons to use a CLI parser, it + should make variables from the command line nearly as easy to define as any + other variables. If most of your program is hidden in CLI parsing, this is a + problem for readability. +- C++11 or better: Should work with GCC 4.8+ (default on CentOS/RHEL 7), Clang + 3.4+, AppleClang 7+, NVCC 7.0+, or MSVC 2015+. +- Work on Linux, macOS, and Windows. +- Well tested on all common platforms and compilers. "Well" is defined as having + good coverage measured by [CodeCov][]. +- Clear help printing. +- Nice error messages. +- Standard shell idioms supported naturally, like grouping flags, a positional + separator, etc. +- Easy to execute, with help, parse errors, etc. providing correct exit and + details. +- Easy to extend as part of a framework that provides "applications" to users. +- Usable subcommand syntax, with support for multiple subcommands, nested + subcommands, option groups, and optional fallthrough (explained later). +- Ability to add a configuration file (`TOML`, `INI`, or custom format), and + produce it as well. +- Produce real values that can be used directly in code, not something you have + pay compute time to look up, for HPC applications. +- Work with common types, simple custom types, and extensible to exotic types. +- Permissively licensed. ### Other parsers @@ -110,37 +132,64 @@ After I wrote this, I also found the following libraries: | [GetOpt][] | Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors). | | [ProgramOptions.hxx][] | Interesting library, less powerful and no subcommands. Nice callback system. | | [Args][] | Also interesting, and supports subcommands. I like the optional-like design, but CLI11 is cleaner and provides direct value access, and is less verbose. | -| [Argument Aggregator][] | I'm a big fan of the [fmt][] library, and the try-catch statement looks familiar. :thumbsup: Doesn't seem to support subcommands. | +| [Argument Aggregator][] | I'm a big fan of the [fmt][] library, and the try-catch statement looks familiar. :thumbsup: Doesn't seem to support subcommands. | | [Clara][] | Simple library built for the excellent [Catch][] testing framework. Unique syntax, limited scope. | | [Argh!][] | Very minimalistic C++11 parser, single header. Don't have many features. No help generation?!?! At least it's exception-free. | | [CLI][] | Custom language and parser. Huge build-system overkill for very little benefit. Last release in 2009, but still occasionally active. | | [argparse][] | C++17 single file argument parser. Design seems similar to CLI11 in some ways. The author has several other interesting projects. | +| [lyra][] | a simple header only parser with composable options. Might work well for simple standardized parsing | -See [Awesome C++][] for a less-biased list of parsers. You can also find other single file libraries at [Single file libs][]. +See [Awesome C++][] for a less-biased list of parsers. You can also find other +single file libraries at [Single file libs][]. </p></details> <br/> -None of these libraries fulfill all the above requirements, or really even come close. As you probably have already guessed, CLI11 does. -So, this library was designed to provide a great syntax, good compiler compatibility, and minimal installation fuss. +None of these libraries fulfill all the above requirements, or really even come +close. As you probably have already guessed, CLI11 does. So, this library was +designed to provide a great syntax, good compiler compatibility, and minimal +installation fuss. ### Features not supported by this library -There are some other possible "features" that are intentionally not supported by this library: - -* Non-standard variations on syntax, like `-long` options. This is non-standard and should be avoided, so that is enforced by this library. -* Completion of partial options, such as Python's `argparse` supplies for incomplete arguments. It's better not to guess. Most third party command line parsers for python actually reimplement command line parsing rather than using argparse because of this perceived design flaw (recent versions do have an option to disable it). -* Autocomplete: This might eventually be added to both Plumbum and CLI11, but it is not supported yet. -* Wide strings / unicode: Since this uses the standard library only, it might be hard to properly implement, but I would be open to suggestions in how to do this. +There are some other possible "features" that are intentionally not supported by +this library: + +- Non-standard variations on syntax, like `-long` options. This is non-standard + and should be avoided, so that is enforced by this library. +- Completion of partial options, such as Python's `argparse` supplies for + incomplete arguments. It's better not to guess. Most third party command line + parsers for python actually reimplement command line parsing rather than using + argparse because of this perceived design flaw (recent versions do have an + option to disable it). +- Autocomplete: This might eventually be added to both Plumbum and CLI11, but it + is not supported yet. +- Wide strings / unicode: Since this uses the standard library only, it might be + hard to properly implement, but I would be open to suggestions in how to do + this. ## Install To use, there are several methods: -* All-in-one local header: Copy `CLI11.hpp` from the [most recent release][github releases] into your include directory, and you are set. This is combined from the source files for every release. This includes the entire command parser library, but does not include separate utilities (like `Timer`, `AutoTimer`). The utilities are completely self contained and can be copied separately. -* All-in-one global header: Like above, but copying the file to a shared folder location like `/opt/CLI11`. Then, the C++ include path has to be extended to point at this folder. With CMake, use `include_directories(/opt/CLI11)` -* Local headers and target: Use `CLI/*.hpp` files. You could check out the repository as a git submodule, for example. With CMake, you can use `add_subdirectory` and the `CLI11::CLI11` interface target when linking. If not using a submodule, you must ensure that the copied files are located inside the same tree directory than your current project, to prevent an error with CMake and `add_subdirectory`. -* Global headers: Use `CLI/*.hpp` files stored in a shared folder. You could check out the git repository to a system-wide folder, for example `/opt/`. With CMake, you could add to the include path via: +- All-in-one local header: Copy `CLI11.hpp` from the [most recent + release][github releases] into your include directory, and you are set. This + is combined from the source files for every release. This includes the entire + command parser library, but does not include separate utilities (like `Timer`, + `AutoTimer`). The utilities are completely self contained and can be copied + separately. +- All-in-one global header: Like above, but copying the file to a shared folder + location like `/opt/CLI11`. Then, the C++ include path has to be extended to + point at this folder. With CMake, use `include_directories(/opt/CLI11)` +- Local headers and target: Use `CLI/*.hpp` files. You could check out the + repository as a git submodule, for example. With CMake, you can use + `add_subdirectory` and the `CLI11::CLI11` interface target when linking. If + not using a submodule, you must ensure that the copied files are located + inside the same tree directory than your current project, to prevent an error + with CMake and `add_subdirectory`. +- Global headers: Use `CLI/*.hpp` files stored in a shared folder. You could + check out the git repository to a system-wide folder, for example `/opt/`. + With CMake, you could add to the include path via: ```bash if(NOT DEFINED CLI11_DIR) @@ -149,7 +198,8 @@ endif() include_directories(${CLI11_DIR}/include) ``` -And then in the source code (adding several headers might be needed to prevent linker errors): +And then in the source code (adding several headers might be needed to prevent +linker errors): ```cpp #include "CLI/App.hpp" @@ -157,23 +207,36 @@ And then in the source code (adding several headers might be needed to prevent l #include "CLI/Config.hpp" ``` -* Global headers and target: configuring and installing the project is required for linking CLI11 to your project in the same way as you would do with any other external library. With CMake, this step allows using `find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a specific folder like `/opt/CLI11`, then you have to pass `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use [Conan.io][conan-link] or [Hunter][]. - (These are just conveniences to allow you to use your favorite method of managing packages; it's just header only so including the correct path and - using C++11 is all you really need.) -* Via FetchContent in CMake 3.14+ (or 3.11+ with more work): you can add this with fetch-content, then use the `CLI11::CLI11` target as above, and CMake will download the project in the configure stage: +- Global headers and target: configuring and installing the project is required + for linking CLI11 to your project in the same way as you would do with any + other external library. With CMake, this step allows using + `find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target + when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a + specific folder like `/opt/CLI11`, then you have to pass + `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use + [Conan.io][conan-link] or [Hunter][]. (These are just conveniences to allow + you to use your favorite method of managing packages; it's just header only so + including the correct path and using C++11 is all you really need.) +- Via FetchContent in CMake 3.14+ (or 3.11+ with more work): you can add this + with fetch-content, then use the `CLI11::CLI11` target as above, and CMake + will download the project in the configure stage: ```cmake include(FetchContent) FetchContent_Declare( cli11 GIT_REPOSITORY https://github.com/CLIUtils/CLI11 - GIT_TAG v2.1.2 + GIT_TAG v2.2.0 ) FetchContent_MakeAvailable(cli11) ``` -It is highly recommended that you use the git hash for `GIT_TAG` instead of a tag or branch, as that will both be more secure, as well as faster to reconfigure - CMake will not have to reach out to the internet to see if the tag moved. You can also download just the single header file from the releases using `file(DOWNLOAD`. +It is highly recommended that you use the git hash for `GIT_TAG` instead of a +tag or branch, as that will both be more secure, as well as faster to +reconfigure - CMake will not have to reach out to the internet to see if the tag +moved. You can also download just the single header file from the releases using +`file(DOWNLOAD`. To build the tests, checkout the repository and use CMake: @@ -185,15 +248,24 @@ CTEST_OUTPUT_ON_FAILURE=1 cmake --build build -t test <details><summary>Note: Special instructions for GCC 8</summary><p> -If you are using GCC 8 and using it in C++17 mode with CLI11. CLI11 makes use of the `<filesystem>` header if available, but specifically for this compiler, the `filesystem` library is separate from the standard library and needs to be linked separately. So it is available but CLI11 doesn't use it by default. +If you are using GCC 8 and using it in C++17 mode with CLI11. CLI11 makes use of +the `<filesystem>` header if available, but specifically for this compiler, the +`filesystem` library is separate from the standard library and needs to be +linked separately. So it is available but CLI11 doesn't use it by default. -Specifically `libstdc++fs` needs to be added to the linking list and `CLI11_HAS_FILESYSTEM=1` has to be defined. Then the filesystem variant of the Validators could be used on GCC 8. GCC 9+ does not have this issue so the `<filesystem>` is used by default. +Specifically `libstdc++fs` needs to be added to the linking list and +`CLI11_HAS_FILESYSTEM=1` has to be defined. Then the filesystem variant of the +Validators could be used on GCC 8. GCC 9+ does not have this issue so the +`<filesystem>` is used by default. There may also be other cases where a specific library needs to be linked. -Defining `CLI11_HAS_FILESYSTEM=0` which will remove the usage and hence any linking issue. +Defining `CLI11_HAS_FILESYSTEM=0` which will remove the usage and hence any +linking issue. -In some cases certain clang compilations may require linking against `libc++fs`. These situations have not been encountered so the specific situations requiring them are unknown yet. +In some cases certain clang compilations may require linking against `libc++fs`. +These situations have not been encountered so the specific situations requiring +them are unknown yet. </p></details> </br> @@ -202,7 +274,8 @@ In some cases certain clang compilations may require linking against `libc++fs`. ### Adding options -To set up, add options, and run, your main function will look something like this: +To set up, add options, and run, your main function will look something like +this: ```cpp int main(int argc, char** argv) { @@ -226,23 +299,33 @@ try { } ``` -The try/catch block ensures that `-h,--help` or a parse error will exit with the correct return code (selected from `CLI::ExitCodes`). (The return here should be inside `main`). You should not assume that the option values have been set inside the catch block; for example, help flags intentionally short-circuit all other processing for speed and to ensure required options and the like do not interfere. +The try/catch block ensures that `-h,--help` or a parse error will exit with the +correct return code (selected from `CLI::ExitCodes`). (The return here should be +inside `main`). You should not assume that the option values have been set +inside the catch block; for example, help flags intentionally short-circuit all +other processing for speed and to ensure required options and the like do not +interfere. </p></details> </br> -The initialization is just one line, adding options is just two each. The parse macro is just one line (or 5 for the contents of the macro). After the app runs, the filename will be set to the correct value if it was passed, otherwise it will be set to the default. You can check to see if this was passed on the command line with `app.count("--file")`. +The initialization is just one line, adding options is just two each. The parse +macro is just one line (or 5 for the contents of the macro). After the app runs, +the filename will be set to the correct value if it was passed, otherwise it +will be set to the default. You can check to see if this was passed on the +command line with `app.count("--file")`. #### Option types -While all options internally are the same type, there are several ways to add an option depending on what you need. The supported values are: +While all options internally are the same type, there are several ways to add an +option depending on what you need. The supported values are: ```cpp // Add options app.add_option(option_name, help_str="") app.add_option(option_name, - variable_to_bind_to, // bool, char(see note), int, float, vector, enum, std::atomic, or string-like, or anything with a defined conversion from a string or that takes an int, double, or string in a constructor. Also allowed are tuples, std::array or std::pair. Also supported are complex numbers, wrapper types, and containers besides vectorof any other supported type. + variable_to_bind_to, // bool, char(see note), int, float, vector, enum, std::atomic, or string-like, or anything with a defined conversion from a string or that takes an int, double, or string in a constructor. Also allowed are tuples, std::array or std::pair. Also supported are complex numbers, wrapper types, and containers besides vectors of any other supported type. help_string="") app.add_option_function<type>(option_name, @@ -276,18 +359,32 @@ App* subcom = app.add_subcommand(name, description); Option_group *app.add_option_group(name,description); ``` -An option name may start with any character except ('-', ' ', '\n', and '!') 🆕. For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n')🆕. For the `add_flag*` functions '{' and '!' have special meaning which is why they are not allowed. Names are given as a comma separated string, with the dash or dashes. An option or flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form. - -The `add_option_function<type>(...` function will typically require the template parameter be given unless a `std::function` object with an exact match is passed. The type can be any type supported by the `add_option` function. The function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` possibly) if the value is not valid. - -The two parameter template overload can be used in cases where you want to restrict the input such as +An option name may start with any character except ('-', ' ', '\n', and '!'). +For long options, after the first character all characters are allowed except +('=',':','{',' ', '\n'). For the `add_flag*` functions '{' and '!' have special +meaning which is why they are not allowed. Names are given as a comma separated +string, with the dash or dashes. An option or flag can have as many names as you +want, and afterward, using `count`, you can use any of the names, with dashes as +needed, to count the options. One of the names is allowed to be given without +proceeding dash(es); if present the option is a positional option, and that name +will be used on the help line for its positional form. + +The `add_option_function<type>(...` function will typically require the template +parameter be given unless a `std::function` object with an exact match is +passed. The type can be any type supported by the `add_option` function. The +function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` +possibly) if the value is not valid. + +The two parameter template overload can be used in cases where you want to +restrict the input such as ```cpp double val app.add_option<double,unsigned int>("-v",val); ``` -which would first verify the input is convertible to an `unsigned int` before assigning it. Or using some variant type +which would first verify the input is convertible to an `unsigned int` before +assigning it. Or using some variant type ```cpp using vtype=std::variant<int, double, std::string>; @@ -297,9 +394,19 @@ app.add_option<vtype,int>("--vi",v1); app.add_option<vtype,double>("--vf",v1); ``` -otherwise the output would default to a string. The `add_option` can be used with any integral or floating point types, enumerations, or strings. Or any type that takes an int, double, or std\::string in an assignment operator or constructor. If an object can take multiple varieties of those, std::string takes precedence, then double then int. To better control which one is used or to use another type for the underlying conversions use the two parameter template to directly specify the conversion type. +otherwise the output would default to a string. The `add_option` can be used +with any integral or floating point types, enumerations, or strings. Or any type +that takes an int, double, or std\::string in an assignment operator or +constructor. If an object can take multiple varieties of those, std::string +takes precedence, then double then int. To better control which one is used or +to use another type for the underlying conversions use the two parameter +template to directly specify the conversion type. -Types such as (std or boost) `optional<int>`, `optional<double>`, and `optional<string>` and any other wrapper types are supported directly. For purposes of CLI11 wrapper types are those which `value_type` definition. See [CLI11 Advanced Topics/Custom Converters][] for information on how you can add your own converters for additional types. +Types such as (std or boost) `optional<int>`, `optional<double>`, and +`optional<string>` and any other wrapper types are supported directly. For +purposes of CLI11 wrapper types are those which `value_type` definition. See +[CLI11 Advanced Topics/Custom Converters][] for information on how you can add +your own converters for additional types. Vector types can also be used in the two parameter template overload @@ -308,135 +415,269 @@ std::vector<double> v1; app.add_option<std::vector<double>,int>("--vs",v1); ``` -would load a vector of doubles but ensure all values can be represented as integers. +would load a vector of doubles but ensure all values can be represented as +integers. -Automatic direct capture of the default string is disabled when using the two parameter template. Use `set_default_str(...)` or `->default_function(std::string())` to set the default string or capture function directly for these cases. +Automatic direct capture of the default string is disabled when using the two +parameter template. Use `set_default_str(...)` or +`->default_function(std::string())` to set the default string or capture +function directly for these cases. -Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example: +Flag options specified through the `add_flag*` functions allow a syntax for the +option names to default particular options to a false value or any other value +if some flags are passed. For example: ```cpp app.add_flag("--flag,!--no-flag",result,"help for flag"); ``` -specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is -passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An -alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous -example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the -default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum -all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited). -The default value can be any value. For example if you wished to define a numerical flag: +specifies that if `--flag` is passed on the command line result will be true or +contain a value of 1. If `--no-flag` is passed `result` will contain false or -1 +if `result` is a signed integer type, or 0 if it is an unsigned type. An +alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; +this is equivalent to the previous example. This also works for short form +options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but +an integer value the default behavior is to take the last value given, while if +`variable_to_bind_to` is an integer type the behavior will be to sum all the +given arguments and return the result. This can be modified if needed by +changing the `multi_option_policy` on each flag (this is not inherited). The +default value can be any value. For example if you wished to define a numerical +flag: ```cpp app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag") ``` -Using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type. +Using any of those flags on the command line will result in the specified number +in the output. Similar things can be done for string values, and enumerations, +as long as the default value can be converted to the given type. -On a `C++14` compiler, you can pass a callback function directly to `.add_flag`, while in C++11 mode you'll need to use `.add_flag_function` if you want a callback function. The function will be given the number of times the flag was passed. You can throw a relevant `CLI::ParseError` to signal a failure. +On a `C++14` compiler, you can pass a callback function directly to `.add_flag`, +while in C++11 mode you'll need to use `.add_flag_function` if you want a +callback function. The function will be given the number of times the flag was +passed. You can throw a relevant `CLI::ParseError` to signal a failure. #### Example -* `"one,-o,--one"`: Valid as long as not a flag, would create an option that can be specified positionally, or with `-o` or `--one` -* `"this"` Can only be passed positionally -* `"-a,-b,-c"` No limit to the number of non-positional option names +- `"one,-o,--one"`: Valid as long as not a flag, would create an option that can + be specified positionally, or with `-o` or `--one` +- `"this"` Can only be passed positionally +- `"-a,-b,-c"` No limit to the number of non-positional option names -The add commands return a pointer to an internally stored `Option`. -This option can be used directly to check for the count (`->count()`) after parsing to avoid a string based lookup. +The add commands return a pointer to an internally stored `Option`. This option +can be used directly to check for the count (`->count()`) after parsing to avoid +a string based lookup. #### Option options Before parsing, you can set the following options: -* `->required()`: The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works. -* `->expected(N)`: Take `N` values instead of as many as possible, only for vector args. If negative, require at least `-N`; end with `--` or another recognized option or subcommand. -* `->expected(MIN,MAX)`: Set a range of expected values to accompany an option. `expected(0,1)` is the equivalent of making a flag. -* `->type_name(typename)`: Set the name of an Option's type (`type_name_fn` allows a function instead) -* `->type_size(N)`: Set the intrinsic size of an option value. The parser will require multiples of this number if negative. Most of the time this is detected automatically though can be modified for specific use cases. -* `->type_size(MIN,MAX)`: Set the intrinsic size of an option to a range. -* `->needs(opt)`: This option requires another option to also be present, opt is an `Option` pointer. Options can be removed from the `needs` with `remove_needs(opt)`. The option can also be specified with a string containing the name of the option -* `->excludes(opt)`: This option cannot be given with `opt` present, opt is an `Option` pointer. Can also be given as a string containing the name of the option. Options can be removed from the excludes list with `->remove_excludes(opt)` -* `->envname(name)`: Gets the value from the environment if present and not passed on the command line. -* `->group(name)`: The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `""` will not show up in the help print (hidden). -* `->ignore_case()`: Ignore the case on the command line (also works on subcommands, does not affect arguments). -* `->ignore_underscore()`: Ignore any underscores in the options names (also works on subcommands, does not affect arguments). For example "option_one" will match with "optionone". This does not apply to short form options since they only have one character -* `->disable_flag_override()`: From the command line long form flag options can be assigned a value on the command line using the `=` notation `--flag=value`. If this behavior is not desired, the `disable_flag_override()` disables it and will generate an exception if it is done on the command line. The `=` does not work with short form flag options. -* `->allow_extra_args(true/false)`: If set to true the option will take an unlimited number of arguments like a vector, if false it will limit the number of arguments to the size of the type used in the option. Default value depends on the nature of the type use, containers default to true, others default to false. -* `->delimiter(char)`: Allows specification of a custom delimiter for separating single arguments into vector arguments, for example specifying `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a vector value. -* `->description(str)`: Set/change the description. -* `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, and `->join()`. This will only affect options expecting 1 argument or bool flags (which do not inherit their default but always start with a specific policy). `->join(delim)` can also be used to join with a specific delimiter. This equivalent to calling `->delimiter(delim)` and `->join()` -* `->check(std::string(const std::string &), validator_name="",validator_description="")`: Define a check function. The function should return a non empty string with the error message if the check fails -* `->check(Validator)`: Use a Validator object to do the check see [Validators](#validators) for a description of available Validators and how to create new ones. -* `->transform(std::string(std::string &), validator_name="",validator_description=")`: Converts the input string into the output string, in-place in the parsed options. -* `->transform(Validator)`: Uses a Validator object to do the transformation see [Validators](#validators) for a description of available Validators and how to create new ones. -* `->each(void(const std::string &)>`: Run this function on each value received, as it is received. It should throw a `ValidationError` if an error is encountered. -* `->configurable(false)`: Disable this option from being in a configuration file. -* `->capture_default_str()`: Store the current value attached and display it in the help string. -* `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses. -* `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. -* `->default_str(string)`: Set the default string directly (NO VALIDATION OR CALLBACKS). This string will also be used as a default value if no arguments are passed and the value is requested. -* `->default_val(value)`: Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). The callback may be triggered if the `run_callback_for_default` is set. -* `->run_callback_for_default()`: This will force the option callback to be executed or the variable set when the `default_val` is set. -* `->option_text(string)`: Sets the text between the option name and description. -* `->force_callback()`: 🆕 Causes the option callback or value set to be triggered even if the option was not present in parsing. -* `->trigger_on_parse()`: 🆕 If set, causes the callback and all associated validation checks for the option to be executed when the option value is parsed vs. at the end of all parsing. This could cause the callback to be executed multiple times. - -These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. The `each` function takes any function that has the signature `void(const std::string&)`; it should throw a `ValidationError` when validation fails. The help message will have the name of the parent option prepended. Since `each`, `check` and `transform` use the same underlying mechanism, you can chain as many as you want, and they will be executed in order. Operations added through `transform` are executed first in reverse order of addition, and `check` and `each` are run following the transform functions in order of addition. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results. +- `->required()`: The program will quit if this option is not present. This is + `mandatory` in Plumbum, but required options seems to be a more standard term. + For compatibility, `->mandatory()` also works. +- `->expected(N)`: Take `N` values instead of as many as possible, only for + vector args. If negative, require at least `-N`; end with `--` or another + recognized option or subcommand. +- `->expected(MIN,MAX)`: Set a range of expected values to accompany an option. + `expected(0,1)` is the equivalent of making a flag. +- `->type_name(typename)`: Set the name of an Option's type (`type_name_fn` + allows a function instead) +- `->type_size(N)`: Set the intrinsic size of an option value. The parser will + require multiples of this number if negative. Most of the time this is + detected automatically though can be modified for specific use cases. +- `->type_size(MIN,MAX)`: Set the intrinsic size of an option to a range. +- `->needs(opt)`: This option requires another option to also be present, opt is + an `Option` pointer. Options can be removed from the `needs` with + `remove_needs(opt)`. The option can also be specified with a string containing + the name of the option +- `->excludes(opt)`: This option cannot be given with `opt` present, opt is an + `Option` pointer. Can also be given as a string containing the name of the + option. Options can be removed from the excludes list with + `->remove_excludes(opt)` +- `->envname(name)`: Gets the value from the environment if present and not + passed on the command line. +- `->group(name)`: The help group to put the option in. No effect for positional + options. Defaults to `"Options"`. `""` will not show up in the help print + (hidden). +- `->ignore_case()`: Ignore the case on the command line (also works on + subcommands, does not affect arguments). +- `->ignore_underscore()`: Ignore any underscores in the options names (also + works on subcommands, does not affect arguments). For example "option_one" + will match with "optionone". This does not apply to short form options since + they only have one character +- `->disable_flag_override()`: From the command line long form flag options can + be assigned a value on the command line using the `=` notation `--flag=value`. + If this behavior is not desired, the `disable_flag_override()` disables it and + will generate an exception if it is done on the command line. The `=` does not + work with short form flag options. +- `->allow_extra_args(true/false)`: If set to true the option will take an + unlimited number of arguments like a vector, if false it will limit the number + of arguments to the size of the type used in the option. Default value depends + on the nature of the type use, containers default to true, others default to + false. +- `->delimiter(char)`: Allows specification of a custom delimiter for separating + single arguments into vector arguments, for example specifying + `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 + elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a + vector value. +- `->description(str)`: Set/change the description. +- `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option + policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, + and `->join()`. This will only affect options expecting 1 argument or bool + flags (which do not inherit their default but always start with a specific + policy). `->join(delim)` can also be used to join with a specific delimiter. + This equivalent to calling `->delimiter(delim)` and `->join()`. Valid values + are `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::Throw`, + `CLI::MultiOptionPolicy::TakeLast`, `CLI::MultiOptionPolicy::TakeFirst`, + `CLI::MultiOptionPolicy::Join`, `CLI::MultiOptionPolicy::TakeAll`, and + `CLI::MultiOptionPolicy::Sum` 🚧. +- `->check(std::string(const std::string &), validator_name="",validator_description="")`: + Define a check function. The function should return a non empty string with + the error message if the check fails +- `->check(Validator)`: Use a Validator object to do the check see + [Validators](#validators) for a description of available Validators and how to + create new ones. +- `->transform(std::string(std::string &), validator_name="",validator_description=")`: + Converts the input string into the output string, in-place in the parsed + options. +- `->transform(Validator)`: Uses a Validator object to do the transformation see + [Validators](#validators) for a description of available Validators and how to + create new ones. +- `->each(void(const std::string &)>`: Run this function on each value received, + as it is received. It should throw a `ValidationError` if an error is + encountered. +- `->configurable(false)`: Disable this option from being in a configuration + file. +- `->capture_default_str()`: Store the current value attached and display it in + the help string. +- `->default_function(std::string())`: Advanced: Change the function that + `capture_default_str()` uses. +- `->always_capture_default()`: Always run `capture_default_str()` when creating + new options. Only useful on an App's `option_defaults`. +- `->default_str(string)`: Set the default string directly (NO VALIDATION OR + CALLBACKS). This string will also be used as a default value if no arguments + are passed and the value is requested. +- `->default_val(value)`: Generate the default string from a value and validate + that the value is also valid. For options that assign directly to a value type + the value in that type is also updated. Value must be convertible to a + string(one of known types or have a stream operator). The callback may be + triggered if the `run_callback_for_default` is set. +- `->run_callback_for_default()`: This will force the option callback to be + executed or the variable set when the `default_val` is set. +- `->option_text(string)`: Sets the text between the option name and + description. +- `->force_callback()`: Causes the option callback or value set to be triggered + even if the option was not present in parsing. +- `->trigger_on_parse()`: If set, causes the callback and all associated + validation checks for the option to be executed when the option value is + parsed vs. at the end of all parsing. This could cause the callback to be + executed multiple times. Also works with positional options 🆕. + +These options return the `Option` pointer, so you can chain them together, and +even skip storing the pointer entirely. The `each` function takes any function +that has the signature `void(const std::string&)`; it should throw a +`ValidationError` when validation fails. The help message will have the name of +the parent option prepended. Since `each`, `check` and `transform` use the same +underlying mechanism, you can chain as many as you want, and they will be +executed in order. Operations added through `transform` are executed first in +reverse order of addition, and `check` and `each` are run following the +transform functions in order of addition. If you just want to see the +unconverted values, use `.results()` to get the `std::vector<std::string>` of +results. On the command line, options can be given as: -* `-a` (flag) -* `-abc` (flags can be combined) -* `-f filename` (option) -* `-ffilename` (no space required) -* `-abcf filename` (flags and option can be combined) -* `--long` (long flag) -* `--long_flag=true` (long flag with equals to override default value) -* `--file filename` (space) -* `--file=filename` (equals) - -If `allow_windows_style_options()` is specified in the application or subcommand options can also be given as: - -* `/a` (flag) -* `/f filename` (option) -* `/long` (long flag) -* `/file filename` (space) -* `/file:filename` (colon) -* `/long_flag:false` (long flag with : to override the default value) - * Windows style options do not allow combining short options or values not separated from the short option like with `-` options - -Long flag options may be given with an `=<value>` to allow specifying a false value, or some other value to the flag. See [config files](#configuration-file) for details on the values supported. NOTE: only the `=` or `:` for windows-style options may be used for this, using a space will result in the argument being interpreted as a positional argument. This syntax can override the default values, and can be disabled by using `disable_flag_override()`. - -Extra positional arguments will cause the program to exit, so at least one positional option with a vector is recommended if you want to allow extraneous arguments. -If you set `.allow_extras()` on the main `App`, you will not get an error. You can access the missing options using `remaining` (if you have subcommands, `app.remaining(true)` will get all remaining options, subcommands included). -If the remaining arguments are to processed by another `App` then the function `remaining_for_passthrough()` can be used to get the remaining arguments in reverse order such that `app.parse(vector)` works directly and could even be used inside a subcommand callback. - -You can access a vector of pointers to the parsed options in the original order using `parse_order()`. -If `--` is present in the command line that does not end an unlimited option, then -everything after that is positional only. +- `-a` (flag) +- `-abc` (flags can be combined) +- `-f filename` (option) +- `-ffilename` (no space required) +- `-abcf filename` (flags and option can be combined) +- `--long` (long flag) +- `--long_flag=true` (long flag with equals to override default value) +- `--file filename` (space) +- `--file=filename` (equals) + +If `allow_windows_style_options()` is specified in the application or subcommand +options can also be given as: + +- `/a` (flag) +- `/f filename` (option) +- `/long` (long flag) +- `/file filename` (space) +- `/file:filename` (colon) +- `/long_flag:false` (long flag with : to override the default value) + - Windows style options do not allow combining short options or values not + separated from the short option like with `-` options + +Long flag options may be given with an `=<value>` to allow specifying a false +value, or some other value to the flag. See [config files](#configuration-file) +for details on the values supported. NOTE: only the `=` or `:` for windows-style +options may be used for this, using a space will result in the argument being +interpreted as a positional argument. This syntax can override the default +values, and can be disabled by using `disable_flag_override()`. + +Extra positional arguments will cause the program to exit, so at least one +positional option with a vector is recommended if you want to allow extraneous +arguments. If you set `.allow_extras()` on the main `App`, you will not get an +error. You can access the missing options using `remaining` (if you have +subcommands, `app.remaining(true)` will get all remaining options, subcommands +included). If the remaining arguments are to processed by another `App` then the +function `remaining_for_passthrough()` can be used to get the remaining +arguments in reverse order such that `app.parse(vector)` works directly and +could even be used inside a subcommand callback. + +You can access a vector of pointers to the parsed options in the original order +using `parse_order()`. If `--` is present in the command line that does not end +an unlimited option, then everything after that is positional only. #### Validators -Validators are structures to check or modify inputs, they can be used to verify that an input meets certain criteria or transform it into another value. They are added through the `check` or `transform` functions. The differences between the two function are that checks do not modify the input whereas transforms can and are executed before any Validators added through `check`. + +Validators are structures to check or modify inputs, they can be used to verify +that an input meets certain criteria or transform it into another value. They +are added through the `check` or `transform` functions. The differences between +the two function are that checks do not modify the input whereas transforms can +and are executed before any Validators added through `check`. CLI11 has several Validators built-in that perform some common checks -* `CLI::IsMember(...)`: Require an option be a member of a given set. See [Transforming Validators](#transforming-validators) for more details. -* `CLI::Transformer(...)`: Modify the input using a map. See [Transforming Validators](#transforming-validators) for more details. -* `CLI::CheckedTransformer(...)`: Modify the input using a map, and require that the input is either in the set or already one of the outputs of the set. See [Transforming Validators](#transforming-validators) for more details. -* `CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching the unit and multiplying the number by the corresponding factor. It can be used as a base for transformers, that accept things like size values (`1 KB`) or durations (`0.33 ms`). -* `CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 or 2^10. -* `CLI::ExistingFile`: Requires that the file exists if given. -* `CLI::ExistingDirectory`: Requires that the directory exists. -* `CLI::ExistingPath`: Requires that the path (file or directory) exists. -* `CLI::NonexistentPath`: Requires that the path does not exist. -* `CLI::Range(min,max)`: Requires that the option be between min and max (make sure to use floating point if needed). Min defaults to 0. -* `CLI::Bounded(min,max)`: Modify the input such that it is always between min and max (make sure to use floating point if needed). Min defaults to 0. Will produce an error if conversion is not possible. -* `CLI::PositiveNumber`: Requires the number be greater than 0 -* `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0 -* `CLI::Number`: Requires the input be a number. -* `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. `'255.255.255.255'`, `'10.1.1.7'`. -* `CLI::TypeValidator<TYPE>`:Requires that the option be convertible to the specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that the input be convertible to an `unsigned int` regardless of the end conversion. - -These Validators can be used by simply passing the name into the `check` or `transform` methods on an option +- `CLI::IsMember(...)`: Require an option be a member of a given set. See + [Transforming Validators](#transforming-validators) for more details. +- `CLI::Transformer(...)`: Modify the input using a map. See + [Transforming Validators](#transforming-validators) for more details. +- `CLI::CheckedTransformer(...)`: Modify the input using a map, and require that + the input is either in the set or already one of the outputs of the set. See + [Transforming Validators](#transforming-validators) for more details. +- `CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching + the unit and multiplying the number by the corresponding factor. It can be + used as a base for transformers, that accept things like size values (`1 KB`) + or durations (`0.33 ms`). +- `CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, + `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 + or 2^10. +- `CLI::ExistingFile`: Requires that the file exists if given. +- `CLI::ExistingDirectory`: Requires that the directory exists. +- `CLI::ExistingPath`: Requires that the path (file or directory) exists. +- `CLI::NonexistentPath`: Requires that the path does not exist. +- `CLI::FileOnDefaultPath`: 🆕 Best used as a transform, Will check that a file + exists either directly or in a default path and update the path appropriately. + See [Transforming Validators](#transforming-validators) for more details +- `CLI::Range(min,max)`: Requires that the option be between min and max (make + sure to use floating point if needed). Min defaults to 0. +- `CLI::Bounded(min,max)`: Modify the input such that it is always between min + and max (make sure to use floating point if needed). Min defaults to 0. Will + produce an error if conversion is not possible. +- `CLI::PositiveNumber`: Requires the number be greater than 0 +- `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0 +- `CLI::Number`: Requires the input be a number. +- `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. + `'255.255.255.255'`, `'10.1.1.7'`. +- `CLI::TypeValidator<TYPE>`:Requires that the option be convertible to the + specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that + the input be convertible to an `unsigned int` regardless of the end + conversion. + +These Validators can be used by simply passing the name into the `check` or +`transform` methods on an option ```cpp ->check(CLI::ExistingFile); @@ -459,51 +700,116 @@ will produce a check for a number less than or equal to 0. ##### Transforming Validators -There are a few built in Validators that let you transform values if used with the `transform` function. If they also do some checks then they can be used `check` but some may do nothing in that case. - -* `CLI::Bounded(min,max)` will bound values between min and max and values outside of that range are limited to min or max, it will fail if the value cannot be converted and produce a `ValidationError` -* The `IsMember` Validator lets you specify a set of predefined options. You can pass any container or copyable pointer (including `std::shared_ptr`) to a container to this Validator; the container just needs to be iterable and have a `::value_type`. The key type should be convertible from a string, You can use an initializer list directly if you like. If you need to modify the set later, the pointer form lets you do that; the type message and check will correctly refer to the current version of the set. The container passed in can be a set, vector, or a map like structure. If used in the `transform` method the output value will be the matching key as it could be modified by filters. - -After specifying a set of options, you can also specify "filter" functions of the form `T(T)`, where `T` is the type of the values. The most common choices probably will be `CLI::ignore_case` an `CLI::ignore_underscore`, and `CLI::ignore_space`. These all work on strings but it is possible to define functions that work on other types. Here are some examples of `IsMember`: - -* `CLI::IsMember({"choice1", "choice2"})`: Select from exact match to choices. -* `CLI::IsMember({"choice1", "choice2"}, CLI::ignore_case, CLI::ignore_underscore)`: Match things like `Choice_1`, too. -* `CLI::IsMember(std::set<int>({2,3,4}))`: Most containers and types work; you just need `std::begin`, `std::end`, and `::value_type`. -* `CLI::IsMember(std::map<std::string, TYPE>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched value with the matched key. The value member of the map is not used in `IsMember`, so it can be any type. -* `auto p = std::make_shared<std::vector<std::string>>(std::initializer_list<std::string>("one", "two")); CLI::IsMember(p)`: You can modify `p` later. -* The `Transformer` and `CheckedTransformer` Validators transform one value into another. Any container or copyable pointer (including `std::shared_ptr`) to a container that generates pairs of values can be passed to these `Validator's`; the container just needs to be iterable and have a `::value_type` that consists of pairs. The key type should be convertible from a string, and the value type should be convertible to a string You can use an initializer list directly if you like. If you need to modify the map later, the pointer form lets you do that; the description message will correctly refer to the current version of the map. `Transformer` does not do any checking so values not in the map are ignored. `CheckedTransformer` takes an extra step of verifying that the value is either one of the map key values, in which case it is transformed, or one of the expected output values, and if not will generate a `ValidationError`. A Transformer placed using `check` will not do anything. - -After specifying a map of options, you can also specify "filter" just like in `CLI::IsMember`. -Here are some examples (`Transformer` and `CheckedTransformer` are interchangeable in the examples) -of `Transformer`: - -* `CLI::Transformer({{"key1", "map1"},{"key2","map2"}})`: Select from key values and produce map values. -* `CLI::Transformer(std::map<std::string,int>({"two",2},{"three",3},{"four",4}}))`: most maplike containers work, the `::value_type` needs to produce a pair of some kind. -* `CLI::CheckedTransformer(std::map<std::string, int>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched key with the value. `CheckedTransformer` also requires that the value either match one of the keys or match one of known outputs. -* `auto p = std::make_shared<CLI::TransformPairs<std::string>>(std::initializer_list<std::pair<std::string,std::string>>({"key1", "map1"},{"key2","map2"})); CLI::Transformer(p)`: You can modify `p` later. `TransformPairs<T>` is an alias for `std::vector<std::pair<<std::string,T>>` - -NOTES: If the container used in `IsMember`, `Transformer`, or `CheckedTransformer` has a `find` function like `std::unordered_map` or `std::map` then that function is used to do the searching. If it does not have a `find` function a linear search is performed. If there are filters present, the fast search is performed first, and if that fails a linear search with the filters on the key values is performed. +There are a few built in Validators that let you transform values if used with +the `transform` function. If they also do some checks then they can be used +`check` but some may do nothing in that case. + +- `CLI::Bounded(min,max)` will bound values between min and max and values + outside of that range are limited to min or max, it will fail if the value + cannot be converted and produce a `ValidationError` +- The `IsMember` Validator lets you specify a set of predefined options. You can + pass any container or copyable pointer (including `std::shared_ptr`) to a + container to this Validator; the container just needs to be iterable and have + a `::value_type`. The key type should be convertible from a string, You can + use an initializer list directly if you like. If you need to modify the set + later, the pointer form lets you do that; the type message and check will + correctly refer to the current version of the set. The container passed in can + be a set, vector, or a map like structure. If used in the `transform` method + the output value will be the matching key as it could be modified by filters. + +After specifying a set of options, you can also specify "filter" functions of +the form `T(T)`, where `T` is the type of the values. The most common choices +probably will be `CLI::ignore_case` an `CLI::ignore_underscore`, and +`CLI::ignore_space`. These all work on strings but it is possible to define +functions that work on other types. Here are some examples of `IsMember`: + +- `CLI::IsMember({"choice1", "choice2"})`: Select from exact match to choices. +- `CLI::IsMember({"choice1", "choice2"}, CLI::ignore_case, CLI::ignore_underscore)`: + Match things like `Choice_1`, too. +- `CLI::IsMember(std::set<int>({2,3,4}))`: Most containers and types work; you + just need `std::begin`, `std::end`, and `::value_type`. +- `CLI::IsMember(std::map<std::string, TYPE>({{"one", 1}, {"two", 2}}))`: You + can use maps; in `->transform()` these replace the matched value with the + matched key. The value member of the map is not used in `IsMember`, so it can + be any type. +- `auto p = std::make_shared<std::vector<std::string>>(std::initializer_list<std::string>("one", "two")); CLI::IsMember(p)`: + You can modify `p` later. +- The `Transformer` and `CheckedTransformer` Validators transform one value into + another. Any container or copyable pointer (including `std::shared_ptr`) to a + container that generates pairs of values can be passed to these `Validator's`; + the container just needs to be iterable and have a `::value_type` that + consists of pairs. The key type should be convertible from a string, and the + value type should be convertible to a string You can use an initializer list + directly if you like. If you need to modify the map later, the pointer form + lets you do that; the description message will correctly refer to the current + version of the map. `Transformer` does not do any checking so values not in + the map are ignored. `CheckedTransformer` takes an extra step of verifying + that the value is either one of the map key values, in which case it is + transformed, or one of the expected output values, and if not will generate a + `ValidationError`. A Transformer placed using `check` will not do anything. + +After specifying a map of options, you can also specify "filter" just like in +`CLI::IsMember`. Here are some examples (`Transformer` and `CheckedTransformer` +are interchangeable in the examples) of `Transformer`: + +- `CLI::Transformer({{"key1", "map1"},{"key2","map2"}})`: Select from key values + and produce map values. +- `CLI::Transformer(std::map<std::string,int>({"two",2},{"three",3},{"four",4}}))`: + most maplike containers work, the `::value_type` needs to produce a pair of + some kind. +- `CLI::CheckedTransformer(std::map<std::string, int>({{"one", 1}, {"two", 2}}))`: + You can use maps; in `->transform()` these replace the matched key with the + value. `CheckedTransformer` also requires that the value either match one of + the keys or match one of known outputs. +- `auto p = std::make_shared<CLI::TransformPairs<std::string>>(std::initializer_list<std::pair<std::string,std::string>>({"key1", "map1"},{"key2","map2"})); CLI::Transformer(p)`: + You can modify `p` later. `TransformPairs<T>` is an alias for + `std::vector<std::pair<<std::string,T>>` + +NOTES: If the container used in `IsMember`, `Transformer`, or +`CheckedTransformer` has a `find` function like `std::unordered_map` or +`std::map` then that function is used to do the searching. If it does not have a +`find` function a linear search is performed. If there are filters present, the +fast search is performed first, and if that fails a linear search with the +filters on the key values is performed. + +- `CLI::FileOnDefaultPath(default_path)`: 🆕 can be used to check for files in a + default path. If used as a transform it will first check that a file exists, + if it does nothing further is done, if it does not it tries to add a default + Path to the file and search there again. If the file does not exist an error + is returned normally but this can be disabled using + `CLI::FileOnDefaultPath(default_path, false)`. This allows multiple paths to + be chained using multiple transform calls. ##### Validator operations -Validators are copyable and have a few operations that can be performed on them to alter settings. Most of the built in Validators have a default description that is displayed in the help. This can be altered via `.description(validator_description)`. -The name of a Validator, which is useful for later reference from the `get_validator(name)` method of an `Option` can be set via `.name(validator_name)` -The operation function of a Validator can be set via -`.operation(std::function<std::string(std::string &>)`. The `.active()` function can activate or deactivate a Validator from the operation. A validator can be set to apply only to a specific element of the output. For example in a pair option `std::pair<int, std::string>` the first element may need to be a positive integer while the second may need to be a valid file. The `.application_index(int)` function can specify this. It is zero based and negative indices apply to all values. +Validators are copyable and have a few operations that can be performed on them +to alter settings. Most of the built in Validators have a default description +that is displayed in the help. This can be altered via +`.description(validator_description)`. The name of a Validator, which is useful +for later reference from the `get_validator(name)` method of an `Option` can be +set via `.name(validator_name)` The operation function of a Validator can be set +via `.operation(std::function<std::string(std::string &>)`. The `.active()` +function can activate or deactivate a Validator from the operation. A validator +can be set to apply only to a specific element of the output. For example in a +pair option `std::pair<int, std::string>` the first element may need to be a +positive integer while the second may need to be a valid file. The +`.application_index(int)` function can specify this. It is zero based and +negative indices apply to all values. ```cpp opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0)); opt->check(CLI::Validator(CLI::ExistingFile).application_index(1)); ``` -All the validator operation functions return a Validator reference allowing them to be chained. For example +All the validator operation functions return a Validator reference allowing them +to be chained. For example ```cpp opt->check(CLI::Range(10,20).description("range is limited to sensible values").active(false).name("range")); ``` -will specify a check on an option with a name "range", but deactivate it for the time being. -The check can later be activated through +will specify a check on an option with a name "range", but deactivate it for the +time being. The check can later be activated through ```cpp opt->get_validator("range")->active(); @@ -523,7 +829,8 @@ or if the operation function is set later they can be created with CLI::Validator(validator_description); ``` - It is also possible to create a subclass of `CLI::Validator`, in which case it can also set a custom description function, and operation function. +It is also possible to create a subclass of `CLI::Validator`, in which case it +can also set a custom description function, and operation function. ##### Querying Validators @@ -533,7 +840,9 @@ Once loaded into an Option, a pointer to a named Validator can be retrieved via opt->get_validator(name); ``` -This will retrieve a Validator with the given name or throw a `CLI::OptionNotFound` error. If no name is given or name is empty the first unnamed Validator will be returned or the first Validator if there is only one. +This will retrieve a Validator with the given name or throw a +`CLI::OptionNotFound` error. If no name is given or name is empty the first +unnamed Validator will be returned or the first Validator if there is only one. or @@ -541,107 +850,265 @@ or opt->get_validator(index); ``` -Which will return a validator in the index it is applied which isn't necessarily the order in which was defined. The pointer can be `nullptr` if an invalid index is given. -Validators have a few functions to query the current values: +Which will return a validator in the index it is applied which isn't necessarily +the order in which was defined. The pointer can be `nullptr` if an invalid index +is given. Validators have a few functions to query the current values: -* `get_description()`: Will return a description string -* `get_name()`: Will return the Validator name -* `get_active()`: Will return the current active state, true if the Validator is active. -* `get_application_index()`: Will return the current application index. -* `get_modifying()`: Will return true if the Validator is allowed to modify the input, this can be controlled via the `non_modifying()` method, though it is recommended to let `check` and `transform` option methods manipulate it if needed. +- `get_description()`: Will return a description string +- `get_name()`: Will return the Validator name +- `get_active()`: Will return the current active state, true if the Validator is + active. +- `get_application_index()`: Will return the current application index. +- `get_modifying()`: Will return true if the Validator is allowed to modify the + input, this can be controlled via the `non_modifying()` method, though it is + recommended to let `check` and `transform` option methods manipulate it if + needed. #### Getting results -In most cases, the fastest and easiest way is to return the results through a callback or variable specified in one of the `add_*` functions. But there are situations where this is not possible or desired. For these cases the results may be obtained through one of the following functions. Please note that these functions will do any type conversions and processing during the call so should not used in performance critical code: - -* `->results()`: Retrieves a vector of strings with all the results in the order they were given. -* `->results(variable_to_bind_to)`: Gets the results according to the MultiOptionPolicy and converts them just like the `add_option_function` with a variable. -* `Value=opt->as<type>()`: Returns the result or default value directly as the specified type if possible, can be vector to return all results, and a non-vector to get the result according to the MultiOptionPolicy in place. +In most cases, the fastest and easiest way is to return the results through a +callback or variable specified in one of the `add_*` functions. But there are +situations where this is not possible or desired. For these cases the results +may be obtained through one of the following functions. Please note that these +functions will do any type conversions and processing during the call so should +not used in performance critical code: + +- `->results()`: Retrieves a vector of strings with all the results in the order + they were given. +- `->results(variable_to_bind_to)`: Gets the results according to the + MultiOptionPolicy and converts them just like the `add_option_function` with a + variable. +- `Value=opt->as<type>()`: Returns the result or default value directly as the + specified type if possible, can be vector to return all results, and a + non-vector to get the result according to the MultiOptionPolicy in place. ### Subcommands -Subcommands are supported, and can be nested infinitely. To add a subcommand, call the `add_subcommand` method with a name and an optional description. This gives a pointer to an `App` that behaves just like the main app, and can take options or further subcommands. Add `->ignore_case()` to a subcommand to allow any variation of caps to also be accepted. `->ignore_underscore()` is similar, but for underscores. Children inherit the current setting from the parent. You cannot add multiple matching subcommand names at the same level (including `ignore_case` and `ignore_underscore`). - -If you want to require that at least one subcommand is given, use `.require_subcommand()` on the parent app. You can optionally give an exact number of subcommands to require, as well. If you give two arguments, that sets the min and max number allowed. -0 for the max number allowed will allow an unlimited number of subcommands. As a handy shortcut, a single negative value N will set "up to N" values. Limiting the maximum number allows you to keep arguments that match a previous -subcommand name from matching. - -If an `App` (main or subcommand) has been parsed on the command line, `->parsed` will be true (or convert directly to bool). -All `App`s have a `get_subcommands()` method, which returns a list of pointers to the subcommands passed on the command line. A `got_subcommand(App_or_name)` method is also provided that will check to see if an `App` pointer or a string name was collected on the command line. - -For many cases, however, using an app's callback capabilities may be easier. Every app has a set of callbacks that can be executed at various stages of parsing; a `C++` lambda function (with capture to get parsed values) can be used as input to the callback definition function. If you throw `CLI::Success` or `CLI::RuntimeError(return_value)`, you can -even exit the program through the callback. - -Multiple subcommands are allowed, to allow [`Click`][click] like series of commands (order is preserved). The same subcommand can be triggered multiple times but all positional arguments will take precedence over the second and future calls of the subcommand. `->count()` on the subcommand will return the number of times the subcommand was called. The subcommand callback will only be triggered once unless the `.immediate_callback()` flag is set or the callback is specified through the `parse_complete_callback()` function. The `final_callback()` is triggered only once. In which case the callback executes on completion of the subcommand arguments but after the arguments for that subcommand have been parsed, and can be triggered multiple times. - -Subcommands may also have an empty name either by calling `add_subcommand` with an empty string for the name or with no arguments. -Nameless subcommands function a similarly to groups in the main `App`. See [Option groups](#option-groups) to see how this might work. If an option is not defined in the main App, all nameless subcommands are checked as well. This allows for the options to be defined in a composable group. The `add_subcommand` function has an overload for adding a `shared_ptr<App>` so the subcommand(s) could be defined in different components and merged into a main `App`, or possibly multiple `Apps`. Multiple nameless subcommands are allowed. Callbacks for nameless subcommands are only triggered if any options from the subcommand were parsed. Subcommand names given through the `add_subcommand` method have the same restrictions as option names. +Subcommands are supported, and can be nested infinitely. To add a subcommand, +call the `add_subcommand` method with a name and an optional description. This +gives a pointer to an `App` that behaves just like the main app, and can take +options or further subcommands. Add `->ignore_case()` to a subcommand to allow +any variation of caps to also be accepted. `->ignore_underscore()` is similar, +but for underscores. Children inherit the current setting from the parent. You +cannot add multiple matching subcommand names at the same level (including +`ignore_case` and `ignore_underscore`). + +If you want to require that at least one subcommand is given, use +`.require_subcommand()` on the parent app. You can optionally give an exact +number of subcommands to require, as well. If you give two arguments, that sets +the min and max number allowed. 0 for the max number allowed will allow an +unlimited number of subcommands. As a handy shortcut, a single negative value N +will set "up to N" values. Limiting the maximum number allows you to keep +arguments that match a previous subcommand name from matching. + +If an `App` (main or subcommand) has been parsed on the command line, `->parsed` +will be true (or convert directly to bool). All `App`s have a +`get_subcommands()` method, which returns a list of pointers to the subcommands +passed on the command line. A `got_subcommand(App_or_name)` method is also +provided that will check to see if an `App` pointer or a string name was +collected on the command line. + +For many cases, however, using an app's callback capabilities may be easier. +Every app has a set of callbacks that can be executed at various stages of +parsing; a `C++` lambda function (with capture to get parsed values) can be used +as input to the callback definition function. If you throw `CLI::Success` or +`CLI::RuntimeError(return_value)`, you can even exit the program through the +callback. + +Multiple subcommands are allowed, to allow [`Click`][click] like series of +commands (order is preserved). The same subcommand can be triggered multiple +times but all positional arguments will take precedence over the second and +future calls of the subcommand. `->count()` on the subcommand will return the +number of times the subcommand was called. The subcommand callback will only be +triggered once unless the `.immediate_callback()` flag is set or the callback is +specified through the `parse_complete_callback()` function. The +`final_callback()` is triggered only once. In which case the callback executes +on completion of the subcommand arguments but after the arguments for that +subcommand have been parsed, and can be triggered multiple times. + +Subcommands may also have an empty name either by calling `add_subcommand` with +an empty string for the name or with no arguments. Nameless subcommands function +a similarly to groups in the main `App`. See [Option groups](#option-groups) to +see how this might work. If an option is not defined in the main App, all +nameless subcommands are checked as well. This allows for the options to be +defined in a composable group. The `add_subcommand` function has an overload for +adding a `shared_ptr<App>` so the subcommand(s) could be defined in different +components and merged into a main `App`, or possibly multiple `Apps`. Multiple +nameless subcommands are allowed. Callbacks for nameless subcommands are only +triggered if any options from the subcommand were parsed. Subcommand names given +through the `add_subcommand` method have the same restrictions as option names. #### Subcommand options -There are several options that are supported on the main app and subcommands and option_groups. These are: - -* `.ignore_case()`: Ignore the case of this subcommand. Inherited by added subcommands, so is usually used on the main `App`. -* `.ignore_underscore()`: Ignore any underscores in the subcommand name. Inherited by added subcommands, so is usually used on the main `App`. -* `.allow_windows_style_options()`: Allow command line options to be parsed in the form of `/s /long /file:file_name.ext` This option does not change how options are specified in the `add_option` calls or the ability to process options in the form of `-s --long --file=file_name.ext`. -* `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent option. Subcommands always are allowed to "fall through" as in they will first attempt to match on the current subcommand and if they fail will progressively check parents for matching subcommands. -* `.configurable()`: Allow the subcommand to be triggered from a configuration file. By default subcommand options in a configuration file do not trigger a subcommand but will just update default values. -* `.disable()`: Specify that the subcommand is disabled, if given with a bool value it will enable or disable the subcommand or option group. -* `.disabled_by_default()`: Specify that at the start of parsing the subcommand/option_group should be disabled. This is useful for allowing some Subcommands to trigger others. -* `.enabled_by_default()`: Specify that at the start of each parse the subcommand/option_group should be enabled. This is useful for allowing some Subcommands to disable others. -* `.silent()`: Specify that the subcommand is silent meaning that if used it won't show up in the subcommand list. This allows the use of subcommands as modifiers -* `.validate_positionals()`: Specify that positionals should pass validation before matching. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional or extra arguments. -* `.excludes(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, these subcommands cannot be given together. In the case of options, if the option is passed the subcommand cannot be used and will generate an error. -* `.needs(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, the subcommands will require the given option to have been given before this subcommand is validated which occurs prior to execution of any callback or after parsing is completed. -* `.require_option()`: Require 1 or more options or option groups be used. -* `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more. -* `.require_option(min, max)`: Explicitly set min and max allowed options or option groups. Setting `max` to 0 implies unlimited options. -* `.require_subcommand()`: Require 1 or more subcommands. -* `.require_subcommand(N)`: Require `N` subcommands if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more. -* `.require_subcommand(min, max)`: Explicitly set min and max allowed subcommands. Setting `max` to 0 is unlimited. -* `.add_subcommand(name="", description="")`: Add a subcommand, returns a pointer to the internally stored subcommand. -* `.add_subcommand(shared_ptr<App>)`: Add a subcommand by shared_ptr, returns a pointer to the internally stored subcommand. -* `.remove_subcommand(App)`: Remove a subcommand from the app or subcommand. -* `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on the command line. -* `.get_subcommands(filter)`: The list of subcommands that match a particular filter function. -* `.add_option_group(name="", description="")`: Add an [option group](#option-groups) to an App, an option group is specialized subcommand intended for containing groups of options or other groups for controlling how options interact. -* `.get_parent()`: Get the parent App or `nullptr` if called on main App. -* `.get_option(name)`: Get an option pointer by option name will throw if the specified option is not available, nameless subcommands are also searched -* `.get_option_no_throw(name)`: Get an option pointer by option name. This function will return a `nullptr` instead of throwing if the option is not available. -* `.get_options(filter)`: Get the list of all defined option pointers (useful for processing the app for custom output formats). -* `.parse_order()`: Get the list of option pointers in the order they were parsed (including duplicates). -* `.formatter(fmt)`: Set a formatter, with signature `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more details. -* `.description(str)`: Set/change the description. -* `.get_description()`: Access the description. -* `.alias(str)`: set an alias for the subcommand, this allows subcommands to be called by more than one name. -* `.parsed()`: True if this subcommand was given on the command line. -* `.count()`: Returns the number of times the subcommand was called. -* `.count(option_name)`: Returns the number of times a particular option was called. -* `.count_all()`: Returns the total number of arguments a particular subcommand processed, on the main App it returns the total number of processed commands. -* `.name(name)`: Add or change the name. -* `.callback(void() function)`: Set the callback for an app. Either sets the `pre_parse_callback` or the `final_callback` depending on the value of `immediate_callback`. See [Subcommand callbacks](#callbacks) for some additional details. -* `.parse_complete_callback(void() function)`: Set the callback that runs at the completion of parsing. For subcommands this is executed at the completion of the single subcommand and can be executed multiple times. See [Subcommand callbacks](#callbacks) for some additional details. -* `.final_callback(void() function)`: Set the callback that runs at the end of all processing. This is the last thing that is executed before returning. See [Subcommand callbacks](#callbacks) for some additional details. -* `.immediate_callback()`: Specifies whether the callback for a subcommand should be run as a `parse_complete_callback`(true) or `final_callback`(false). When used on the main app it will execute the main app callback prior to the callbacks for a subcommand if they do not also have the `immediate_callback` flag set. It is preferable to use the `parse_complete_callback` or `final_callback` directly instead of the `callback` and `immediate_callback` if one wishes to control the ordering and timing of callback. Though `immediate_callback` can be used to swap them if that is needed. -* `.pre_parse_callback(void(std::size_t) function)`: Set a callback that executes after the first argument of an application is processed. See [Subcommand callbacks](#callbacks) for some additional details. -* `.allow_extras()`: Do not throw an error if extra arguments are left over. -* `.positionals_at_end()`: Specify that positional arguments occur as the last arguments and throw an error if an unexpected positional is encountered. -* `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app. -* `.footer(message)`: Set text to appear at the bottom of the help string. -* `.footer(std::string())`: Set a callback to generate a string that will appear at the end of the help string. -* `.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option. -* `.set_version_flag(name, versionString or callback, help_message)`: Set the version flag name and version string or callback and optional help message, returns a pointer to the created option. -* `.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands. -* `.failure_message(func)`: Set the failure message function. Two provided: `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default). -* `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` will be hide the subcommand. -* `[option_name]`: retrieve a const pointer to an option given by `option_name` for Example `app["--flag1"]` will get a pointer to the option for the "--flag1" value, `app["--flag1"]->as<bool>()` will get the results of the command line for a flag. The operation will throw an exception if the option name is not valid. - -> Note: if you have a fixed number of required positional options, that will match before subcommand names. `{}` is an empty filter function, and any positional argument will match before repeated subcommand names. +There are several options that are supported on the main app and subcommands and +option_groups. These are: + +- `.ignore_case()`: Ignore the case of this subcommand. Inherited by added + subcommands, so is usually used on the main `App`. +- `.ignore_underscore()`: Ignore any underscores in the subcommand name. + Inherited by added subcommands, so is usually used on the main `App`. +- `.allow_windows_style_options()`: Allow command line options to be parsed in + the form of `/s /long /file:file_name.ext` This option does not change how + options are specified in the `add_option` calls or the ability to process + options in the form of `-s --long --file=file_name.ext`. +- `.fallthrough()`: Allow extra unmatched options and positionals to "fall + through" and be matched on a parent option. Subcommands always are allowed to + "fall through" as in they will first attempt to match on the current + subcommand and if they fail will progressively check parents for matching + subcommands. +- `.configurable()`: Allow the subcommand to be triggered from a configuration + file. By default subcommand options in a configuration file do not trigger a + subcommand but will just update default values. +- `.disable()`: Specify that the subcommand is disabled, if given with a bool + value it will enable or disable the subcommand or option group. +- `.disabled_by_default()`: Specify that at the start of parsing the + subcommand/option_group should be disabled. This is useful for allowing some + Subcommands to trigger others. +- `.enabled_by_default()`: Specify that at the start of each parse the + subcommand/option_group should be enabled. This is useful for allowing some + Subcommands to disable others. +- `.silent()`: Specify that the subcommand is silent meaning that if used it + won't show up in the subcommand list. This allows the use of subcommands as + modifiers +- `.validate_positionals()`: Specify that positionals should pass validation + before matching. Validation is specified through `transform`, `check`, and + `each` for an option. If an argument fails validation it is not an error and + matching proceeds to the next available positional or extra arguments. +- `.validate_optional_arguments()`:🆕 Specify that optional arguments should + pass validation before being assigned to an option. Validation is specified + through `transform`, `check`, and `each` for an option. If an argument fails + validation it is not an error and matching proceeds to the next available + positional subcommand or extra arguments. +- `.excludes(option_or_subcommand)`: If given an option pointer or pointer to + another subcommand, these subcommands cannot be given together. In the case of + options, if the option is passed the subcommand cannot be used and will + generate an error. +- `.needs(option_or_subcommand)`: If given an option pointer or pointer to + another subcommand, the subcommands will require the given option to have been + given before this subcommand is validated which occurs prior to execution of + any callback or after parsing is completed. +- `.require_option()`: Require 1 or more options or option groups be used. +- `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to + `N` if `N<0`. `N=0` resets to the default to 0 or more. +- `.require_option(min, max)`: Explicitly set min and max allowed options or + option groups. Setting `max` to 0 implies unlimited options. +- `.require_subcommand()`: Require 1 or more subcommands. +- `.require_subcommand(N)`: Require `N` subcommands if `N>0`, or up to `N` if + `N<0`. `N=0` resets to the default to 0 or more. +- `.require_subcommand(min, max)`: Explicitly set min and max allowed + subcommands. Setting `max` to 0 is unlimited. +- `.add_subcommand(name="", description="")`: Add a subcommand, returns a + pointer to the internally stored subcommand. +- `.add_subcommand(shared_ptr<App>)`: Add a subcommand by shared_ptr, returns a + pointer to the internally stored subcommand. +- `.remove_subcommand(App)`: Remove a subcommand from the app or subcommand. +- `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on + the command line. +- `.get_subcommands(filter)`: The list of subcommands that match a particular + filter function. +- `.add_option_group(name="", description="")`: Add an + [option group](#option-groups) to an App, an option group is specialized + subcommand intended for containing groups of options or other groups for + controlling how options interact. +- `.get_parent()`: Get the parent App or `nullptr` if called on main App. +- `.get_option(name)`: Get an option pointer by option name will throw if the + specified option is not available, nameless subcommands are also searched +- `.get_option_no_throw(name)`: Get an option pointer by option name. This + function will return a `nullptr` instead of throwing if the option is not + available. +- `.get_options(filter)`: Get the list of all defined option pointers (useful + for processing the app for custom output formats). +- `.parse_order()`: Get the list of option pointers in the order they were + parsed (including duplicates). +- `.formatter(fmt)`: Set a formatter, with signature + `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more + details. +- `.description(str)`: Set/change the description. +- `.get_description()`: Access the description. +- `.alias(str)`: set an alias for the subcommand, this allows subcommands to be + called by more than one name. +- `.parsed()`: True if this subcommand was given on the command line. +- `.count()`: Returns the number of times the subcommand was called. +- `.count(option_name)`: Returns the number of times a particular option was + called. +- `.count_all()`: Returns the total number of arguments a particular subcommand + processed, on the main App it returns the total number of processed commands. +- `.name(name)`: Add or change the name. +- `.callback(void() function)`: Set the callback for an app. Either sets the + `pre_parse_callback` or the `final_callback` depending on the value of + `immediate_callback`. See [Subcommand callbacks](#callbacks) for some + additional details. +- `.parse_complete_callback(void() function)`: Set the callback that runs at the + completion of parsing. For subcommands this is executed at the completion of + the single subcommand and can be executed multiple times. See + [Subcommand callbacks](#callbacks) for some additional details. +- `.final_callback(void() function)`: Set the callback that runs at the end of + all processing. This is the last thing that is executed before returning. See + [Subcommand callbacks](#callbacks) for some additional details. +- `.immediate_callback()`: Specifies whether the callback for a subcommand + should be run as a `parse_complete_callback`(true) or `final_callback`(false). + When used on the main app it will execute the main app callback prior to the + callbacks for a subcommand if they do not also have the `immediate_callback` + flag set. It is preferable to use the `parse_complete_callback` or + `final_callback` directly instead of the `callback` and `immediate_callback` + if one wishes to control the ordering and timing of callback. Though + `immediate_callback` can be used to swap them if that is needed. +- `.pre_parse_callback(void(std::size_t) function)`: Set a callback that + executes after the first argument of an application is processed. See + [Subcommand callbacks](#callbacks) for some additional details. +- `.allow_extras()`: Do not throw an error if extra arguments are left over. +- `.positionals_at_end()`: Specify that positional arguments occur as the last + arguments and throw an error if an unexpected positional is encountered. +- `.prefix_command()`: Like `allow_extras`, but stop immediately on the first + unrecognized item. It is ideal for allowing your app or subcommand to be a + "prefix" to calling another app. +- `.footer(message)`: Set text to appear at the bottom of the help string. +- `.footer(std::string())`: Set a callback to generate a string that will appear + at the end of the help string. +- `.set_help_flag(name, message)`: Set the help flag name and message, returns a + pointer to the created option. +- `.set_version_flag(name, versionString or callback, help_message)`: Set the + version flag name and version string or callback and optional help message, + returns a pointer to the created option. +- `.set_help_all_flag(name, message)`: Set the help all flag name and message, + returns a pointer to the created option. Expands subcommands. +- `.failure_message(func)`: Set the failure message function. Two provided: + `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default). +- `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` + will be hide the subcommand. +- `[option_name]`: retrieve a const pointer to an option given by `option_name` + for Example `app["--flag1"]` will get a pointer to the option for the + "--flag1" value, `app["--flag1"]->as<bool>()` will get the results of the + command line for a flag. The operation will throw an exception if the option + name is not valid. + +> Note: if you have a fixed number of required positional options, that will +> match before subcommand names. `{}` is an empty filter function, and any +> positional argument will match before repeated subcommand names. #### Callbacks -A subcommand has three optional callbacks that are executed at different stages of processing. The `preparse_callback` is executed once after the first argument of a subcommand or application is processed and gives an argument for the number of remaining arguments to process. For the main app the first argument is considered the program name, for subcommands the first argument is the subcommand name. For Option groups and nameless subcommands the first argument is after the first argument or subcommand is processed from that group. -The second callback is executed after parsing. This is known as the `parse_complete_callback`. For subcommands this is executed immediately after parsing and can be executed multiple times if a subcommand is called multiple times. On the main app this callback is executed after all the `parse_complete_callback`s for the subcommands are executed but prior to any `final_callback` calls in the subcommand or option groups. If the main app or subcommand has a config file, no data from the config file will be reflected in `parse_complete_callback` on named subcommands. For `option_group`s the `parse_complete_callback` is executed prior to the `parse_complete_callback` on the main app but after the `config_file` is loaded (if specified). The `final_callback` is executed after all processing is complete. After the `parse_complete_callback` is executed on the main app, the used subcommand `final_callback` are executed followed by the "final callback" for option groups. The last thing to execute is the `final_callback` for the `main_app`. +A subcommand has three optional callbacks that are executed at different stages +of processing. The `preparse_callback` is executed once after the first argument +of a subcommand or application is processed and gives an argument for the number +of remaining arguments to process. For the main app the first argument is +considered the program name, for subcommands the first argument is the +subcommand name. For Option groups and nameless subcommands the first argument +is after the first argument or subcommand is processed from that group. The +second callback is executed after parsing. This is known as the +`parse_complete_callback`. For subcommands this is executed immediately after +parsing and can be executed multiple times if a subcommand is called multiple +times. On the main app this callback is executed after all the +`parse_complete_callback`s for the subcommands are executed but prior to any +`final_callback` calls in the subcommand or option groups. If the main app or +subcommand has a config file, no data from the config file will be reflected in +`parse_complete_callback` on named subcommands. For `option_group`s the +`parse_complete_callback` is executed prior to the `parse_complete_callback` on +the main app but after the `config_file` is loaded (if specified). The +`final_callback` is executed after all processing is complete. After the +`parse_complete_callback` is executed on the main app, the used subcommand +`final_callback` are executed followed by the "final callback" for option +groups. The last thing to execute is the `final_callback` for the `main_app`. For example say an application was set up like ```cpp @@ -660,23 +1127,31 @@ Then the command line is given as program --opt1 opt1_val sub1 --sub1opt --sub1optb val sub2 --sub2opt sub1 --sub1opt2 sub2 --sub2opt2 val ``` -* `pa` will be called prior to parsing any values with an argument of 13. -* `pc1` will be called immediately after processing the `sub1` command with a value of 10. -* `c1` will be called when the `sub2` command is encountered. -* `pc2` will be called with value of 6 after the `sub2` command is encountered. -* `c1` will be called again after the second `sub2` command is encountered. -* `ac1` will be called after processing of all arguments -* `c2` will be called once after processing all arguments. -* `ac2` will be called last after completing all lower level callbacks have been executed. +- `pa` will be called prior to parsing any values with an argument of 13. +- `pc1` will be called immediately after processing the `sub1` command with a + value of 10. +- `c1` will be called when the `sub2` command is encountered. +- `pc2` will be called with value of 6 after the `sub2` command is encountered. +- `c1` will be called again after the second `sub2` command is encountered. +- `ac1` will be called after processing of all arguments +- `c2` will be called once after processing all arguments. +- `ac2` will be called last after completing all lower level callbacks have been + executed. -A subcommand is considered terminated when one of the following conditions are met. +A subcommand is considered terminated when one of the following conditions are +met. 1. There are no more arguments to process -2. Another subcommand is encountered that would not fit in an optional slot of the subcommand -3. The `positional_mark` (`--`) is encountered and there are no available positional slots in the subcommand. +2. Another subcommand is encountered that would not fit in an optional slot of + the subcommand +3. The `positional_mark` (`--`) is encountered and there are no available + positional slots in the subcommand. 4. The `subcommand_terminator` mark (`++`) is encountered -Prior to executed a `parse_complete_callback` all contained options are processed before the callback is triggered. If a subcommand with a `parse_complete_callback` is called again, then the contained options are reset, and can be triggered again. +Prior to executed a `parse_complete_callback` all contained options are +processed before the callback is triggered. If a subcommand with a +`parse_complete_callback` is called again, then the contained options are reset, +and can be triggered again. #### Option groups @@ -686,7 +1161,18 @@ The subcommand method .add_option_group(name,description) ``` -Will create an option group, and return a pointer to it. The argument for `description` is optional and can be omitted. An option group allows creation of a collection of options, similar to the groups function on options, but with additional controls and requirements. They allow specific sets of options to be composed and controlled as a collective. For an example see [range example](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp). Option groups are a specialization of an App so all [functions](#subcommand-options) that work with an App or subcommand also work on option groups. Options can be created as part of an option group using the add functions just like a subcommand, or previously created options can be added through. The name given in an option group must not contain newlines or null characters.🆕 +Will create an option group, and return a pointer to it. The argument for +`description` is optional and can be omitted. An option group allows creation of +a collection of options, similar to the groups function on options, but with +additional controls and requirements. They allow specific sets of options to be +composed and controlled as a collective. For an example see +[range example](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp). +Option groups are a specialization of an App so all +[functions](#subcommand-options) that work with an App or subcommand also work +on option groups. Options can be created as part of an option group using the +add functions just like a subcommand, or previously created options can be added +through. The name given in an option group must not contain newlines or null +characters. ```cpp ogroup->add_option(option_pointer); @@ -694,49 +1180,75 @@ ogroup->add_options(option_pointer); ogroup->add_options(option1,option2,option3,...); ``` -The option pointers used in this function must be options defined in the parent application of the option group otherwise an error will be generated. Subcommands can also be added via +The option pointers used in this function must be options defined in the parent +application of the option group otherwise an error will be generated. +Subcommands can also be added via ```cpp ogroup->add_subcommand(subcom_pointer); ``` -This results in the subcommand being moved from its parent into the option group. - -Options in an option group are searched for a command line match after any options in the main app, so any positionals in the main app would be matched first. So care must be taken to make sure of the order when using positional arguments and option groups. -Option groups work well with `excludes` and `require_options` methods, as an application will treat an option group as a single option for the purpose of counting and requirements, and an option group will be considered used if any of the options or subcommands contained in it are used. Option groups allow specifying requirements such as requiring 1 of 3 options in one group and 1 of 3 options in a different group. Option groups can contain other groups as well. Disabling an option group will turn off all options within the group. - -The `CLI::TriggerOn` and `CLI::TriggerOff` methods are helper functions to allow the use of options/subcommands from one group to trigger another group on or off. +This results in the subcommand being moved from its parent into the option +group. + +Options in an option group are searched for a command line match after any +options in the main app, so any positionals in the main app would be matched +first. So care must be taken to make sure of the order when using positional +arguments and option groups. Option groups work well with `excludes` and +`require_options` methods, as an application will treat an option group as a +single option for the purpose of counting and requirements, and an option group +will be considered used if any of the options or subcommands contained in it are +used. Option groups allow specifying requirements such as requiring 1 of 3 +options in one group and 1 of 3 options in a different group. Option groups can +contain other groups as well. Disabling an option group will turn off all +options within the group. + +The `CLI::TriggerOn` and `CLI::TriggerOff` methods are helper functions to allow +the use of options/subcommands from one group to trigger another group on or +off. ```cpp CLI::TriggerOn(group1_pointer, triggered_group); CLI::TriggerOff(group2_pointer, disabled_group); ``` -These functions make use of `preparse_callback`, `enabled_by_default()` and `disabled_by_default`. The triggered group may be a vector of group pointers. These methods should only be used once per group and will override any previous use of the underlying functions. More complex arrangements can be accomplished using similar methodology with a custom `preparse_callback` function that does more. +These functions make use of `preparse_callback`, `enabled_by_default()` and +`disabled_by_default`. The triggered group may be a vector of group pointers. +These methods should only be used once per group and will override any previous +use of the underlying functions. More complex arrangements can be accomplished +using similar methodology with a custom `preparse_callback` function that does +more. -Additional helper functions `deprecate_option` and `retire_option` are available to deprecate or retire options +Additional helper functions `deprecate_option` and `retire_option` are available +to deprecate or retire options ```cpp CLI::deprecate_option(option *, replacement_name=""); CLI::deprecate_option(App,option_name,replacement_name=""); ``` -will specify that the option is deprecated which will display a message in the help and a warning on first usage. Deprecated options function normally but will add a message in the help and display a warning on first use. +will specify that the option is deprecated which will display a message in the +help and a warning on first usage. Deprecated options function normally but will +add a message in the help and display a warning on first use. ```cpp CLI::retire_option(App,option *); CLI::retire_option(App,option_name); ``` -will create an option that does nothing by default and will display a warning on first usage that the option is retired and has no effect. If the option exists it is replaces with a dummy option that takes the same arguments. +will create an option that does nothing by default and will display a warning on +first usage that the option is retired and has no effect. If the option exists +it is replaces with a dummy option that takes the same arguments. -If an empty string is passed the option group name the entire group will be hidden in the help results. For example. +If an empty string is passed the option group name the entire group will be +hidden in the help results. For example. ```cpp auto hidden_group=app.add_option_group(""); ``` -will create a group such that no options in that group are displayed in the help string. +will create a group such that no options in that group are displayed in the help +string. ### Configuration file @@ -747,7 +1259,16 @@ app.set_config(option_name="", required=false) ``` -If this is called with no arguments, it will remove the configuration file option (like `set_help_flag`). Setting a configuration option is special. If it is present, it will be read along with the normal command line arguments. The file will be read if it exists, and does not throw an error unless `required` is `true`. Configuration files are in [TOML][] format by default, though the default reader can also accept files in INI format as well. It should be noted that CLI11 does not contain a full TOML parser but can read strings from most TOML file and run them through the CLI11 parser. Other formats can be added by an adept user, some variations are available through customization points in the default formatter. An example of a TOML file: +If this is called with no arguments, it will remove the configuration file +option (like `set_help_flag`). Setting a configuration option is special. If it +is present, it will be read along with the normal command line arguments. The +file will be read if it exists, and does not throw an error unless `required` is +`true`. Configuration files are in [TOML][] format by default, though the +default reader can also accept files in INI format as well. It should be noted +that CLI11 does not contain a full TOML parser but can read strings from most +TOML file and run them through the CLI11 parser. Other formats can be added by +an adept user, some variations are available through customization points in the +default formatter. An example of a TOML file: ```toml # Comments are supported, using a # @@ -781,24 +1302,66 @@ in_subcommand = Wow sub.subcommand = true ``` -Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults"). You cannot set positional-only arguments. Subcommands can be triggered from configuration files if the `configurable` flag was set on the subcommand. Then the use of `[subcommand]` notation will trigger a subcommand and cause it to act as if it were on the command line. +Spaces before and after the name and argument are ignored. Multiple arguments +are separated by spaces. One set of quotes will be removed, preserving spaces +(the same way the command line works). Boolean options can be `true`, `on`, `1`, +`yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). +Sections (and `.` separated names) are treated as subcommands (note: this does +not necessarily mean that subcommand was passed, it just sets the "defaults"). +You cannot set positional-only arguments. Subcommands can be triggered from +configuration files if the `configurable` flag was set on the subcommand. Then +the use of `[subcommand]` notation will trigger a subcommand and cause it to act +as if it were on the command line. + +To print a configuration file from the passed arguments, use +`.config_to_str(default_also=false, write_description=false)`, where +`default_also` will also show any defaulted arguments, and `write_description` +will include the app and option descriptions. See +[Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for +some additional details and customization points. + +If it is desired that multiple configuration be allowed. Use + +```cpp +app.set_config("--config")->expected(1, X); +``` + +Where X is some positive number and will allow up to `X` configuration files to +be specified by separate `--config` arguments. Value strings with quote +characters in it will be printed with a single quote. All other arguments will +use double quote. Empty strings will use a double quoted argument. Numerical or +boolean values are not quoted. -To print a configuration file from the passed -arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include the app and option descriptions. See [Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for some additional details and customization points. +For options or flags which allow 0 arguments to be passed using an empty string +in the config file, `{}`, or `[]` will convert the result to the default value +specified via `default_str` or `default_val` on the option 🆕. If no user +specified default is given the result is an empty string or the converted value +of an empty string. -If it is desired that multiple configuration be allowed. Use +NOTE: Transforms and checks can be used with the option pointer returned from +set_config like any other option to validate the input if needed. It can also be +used with the built in transform `CLI::FileOnDefaultPath` to look in a default +path as well as the current one. For example ```cpp -app.set_config("--config")->expected(1, X); +app.set_config("--config")->transform(CLI::FileOnDefaultPath("/to/default/path/")); ``` -Where X is some positive number and will allow up to `X` configuration files to be specified by separate `--config` arguments. Value strings with quote characters in it will be printed with a single quote. All other arguments will use double quote. Empty strings will use a double quoted argument. Numerical or boolean values are not quoted. +See [Transforming Validators](#transforming-validators) for additional details +on this validator. Multiple transforms or validators can be used either by +multiple calls or using `|` operations with the transform. ### Inheriting defaults -Many of the defaults for subcommands and even options are inherited from their creators. The inherited default values for subcommands are `allow_extras`, `prefix_command`, `ignore_case`, `ignore_underscore`, `fallthrough`, `group`, `footer`,`immediate_callback` and maximum number of required subcommands. The help flag existence, name, and description are inherited, as well. +Many of the defaults for subcommands and even options are inherited from their +creators. The inherited default values for subcommands are `allow_extras`, +`prefix_command`, `ignore_case`, `ignore_underscore`, `fallthrough`, `group`, +`footer`,`immediate_callback` and maximum number of required subcommands. The +help flag existence, name, and description are inherited, as well. -Options have defaults for `group`, `required`, `multi_option_policy`, `ignore_case`, `ignore_underscore`, `delimiter`, and `disable_flag_override`. To set these defaults, you should set the `option_defaults()` object, for example: +Options have defaults for `group`, `required`, `multi_option_policy`, +`ignore_case`, `ignore_underscore`, `delimiter`, and `disable_flag_override`. To +set these defaults, you should set the `option_defaults()` object, for example: ```cpp app.option_defaults()->required(); @@ -809,32 +1372,74 @@ The default settings for options are inherited to subcommands, as well. ### Formatting -The job of formatting help printouts is delegated to a formatter callable object on Apps and Options. You are free to replace either formatter by calling `formatter(fmt)` on an `App`, where fmt is any copyable callable with the correct signature. -CLI11 comes with a default App formatter functional, `Formatter`. It is customizable; you can set `label(key, value)` to replace the default labels like `REQUIRED`, and `column_width(n)` to set the width of the columns before you add the functional to the app or option. You can also override almost any stage of the formatting process in a subclass of either formatter. If you want to make a new formatter from scratch, you can do -that too; you just need to implement the correct signature. The first argument is a const pointer to the in question. The formatter will get a `std::string` usage name as the second option, and a `AppFormatMode` mode for the final option. It should return a `std::string`. - -The `AppFormatMode` can be `Normal`, `All`, or `Sub`, and it indicates the situation the help was called in. `Sub` is optional, but the default formatter uses it to make sure expanded subcommands are called with -their own formatter since you can't access anything but the call operator once a formatter has been set. +The job of formatting help printouts is delegated to a formatter callable object +on Apps and Options. You are free to replace either formatter by calling +`formatter(fmt)` on an `App`, where fmt is any copyable callable with the +correct signature. CLI11 comes with a default App formatter functional, +`Formatter`. It is customizable; you can set `label(key, value)` to replace the +default labels like `REQUIRED`, and `column_width(n)` to set the width of the +columns before you add the functional to the app or option. You can also +override almost any stage of the formatting process in a subclass of either +formatter. If you want to make a new formatter from scratch, you can do that +too; you just need to implement the correct signature. The first argument is a +const pointer to the in question. The formatter will get a `std::string` usage +name as the second option, and a `AppFormatMode` mode for the final option. It +should return a `std::string`. + +The `AppFormatMode` can be `Normal`, `All`, or `Sub`, and it indicates the +situation the help was called in. `Sub` is optional, but the default formatter +uses it to make sure expanded subcommands are called with their own formatter +since you can't access anything but the call operator once a formatter has been +set. ### Subclassing -The App class was designed allow toolkits to subclass it, to provide preset default options (see above) and setup/teardown code. Subcommands remain an unsubclassed `App`, since those are not expected to need setup and teardown. The default `App` only adds a help flag, `-h,--help`, than can removed/replaced using `.set_help_flag(name, help_string)`. You can also set a help-all flag with `.set_help_all_flag(name, help_string)`; this will expand the subcommands (one level only). You can remove options if you have pointers to them using `.remove_option(opt)`. You can add a `pre_callback` override to customize the after parse -but before run behavior, while -still giving the user freedom to `callback` on the main app. - -The most important parse function is `parse(std::vector<std::string>)`, which takes a reversed list of arguments (so that `pop_back` processes the args in the correct order). `get_help_ptr` and `get_config_ptr` give you access to the help/config option pointers. The standard `parse` manually sets the name from the first argument, so it should not be in this vector. You can also use `parse(string, bool)` to split up and parse a single string; the optional boolean should be set to true if you are -including the program name in the string, and false otherwise. The program name can contain spaces if it is an existing file, otherwise can be enclosed in quotes(single quote, double quote or backtick). Embedded quote characters can be escaped with `\`. - -Also, in a related note, the `App` you get a pointer to is stored in the parent `App` in a `shared_ptr`s (similar to `Option`s) and are deleted when the main `App` goes out of scope unless the object has another owner. +The App class was designed allow toolkits to subclass it, to provide preset +default options (see above) and setup/teardown code. Subcommands remain an +unsubclassed `App`, since those are not expected to need setup and teardown. The +default `App` only adds a help flag, `-h,--help`, than can removed/replaced +using `.set_help_flag(name, help_string)`. You can also set a help-all flag with +`.set_help_all_flag(name, help_string)`; this will expand the subcommands (one +level only). You can remove options if you have pointers to them using +`.remove_option(opt)`. You can add a `pre_callback` override to customize the +after parse but before run behavior, while still giving the user freedom to +`callback` on the main app. + +The most important parse function is `parse(std::vector<std::string>)`, which +takes a reversed list of arguments (so that `pop_back` processes the args in the +correct order). `get_help_ptr` and `get_config_ptr` give you access to the +help/config option pointers. The standard `parse` manually sets the name from +the first argument, so it should not be in this vector. You can also use +`parse(string, bool)` to split up and parse a single string; the optional +boolean should be set to true if you are including the program name in the +string, and false otherwise. The program name can contain spaces if it is an +existing file, otherwise can be enclosed in quotes(single quote, double quote or +backtick). Embedded quote characters can be escaped with `\`. + +Also, in a related note, the `App` you get a pointer to is stored in the parent +`App` in a `shared_ptr`s (similar to `Option`s) and are deleted when the main +`App` goes out of scope unless the object has another owner. ### How it works -Every `add_` option you have seen so far depends on one method that takes a lambda function. Each of these methods is just making a different lambda function with capture to populate the option. The function has full access to the vector of strings, so it knows how many times an option was passed or how many arguments it received. The lambda returns `true` if it could validate the option strings, and -`false` if it failed. - -Other values can be added as long as they support `operator>>` (and defaults can be printed if they support `operator<<`). To add a new type, for example, provide a custom `operator>>` with an `istream` (inside the CLI namespace is fine if you don't want to interfere with an existing `operator>>`). - -If you wanted to extend this to support a completely new type, use a lambda or add a specialization of the `lexical_cast` function template in the namespace of the type you need to convert to. Some examples of some new parsers for `complex<double>` that support all of the features of a standard `add_options` call are in [one of the tests](./tests/NewParseTest.cpp). A simpler example is shown below: +Every `add_` option you have seen so far depends on one method that takes a +lambda function. Each of these methods is just making a different lambda +function with capture to populate the option. The function has full access to +the vector of strings, so it knows how many times an option was passed or how +many arguments it received. The lambda returns `true` if it could validate the +option strings, and `false` if it failed. + +Other values can be added as long as they support `operator>>` (and defaults can +be printed if they support `operator<<`). To add a new type, for example, +provide a custom `operator>>` with an `istream` (inside the CLI namespace is +fine if you don't want to interfere with an existing `operator>>`). + +If you wanted to extend this to support a completely new type, use a lambda or +add a specialization of the `lexical_cast` function template in the namespace of +the type you need to convert to. Some examples of some new parsers for +`complex<double>` that support all of the features of a standard `add_options` +call are in [one of the tests](./tests/NewParseTest.cpp). A simpler example is +shown below: #### Example @@ -847,7 +1452,10 @@ app.add_option("--fancy-count", [](std::vector<std::string> val){ ### Utilities -There are a few other utilities that are often useful in CLI programming. These are in separate headers, and do not appear in `CLI11.hpp`, but are completely independent and can be used as needed. The `Timer`/`AutoTimer` class allows you to easily time a block of code, with custom print output. +There are a few other utilities that are often useful in CLI programming. These +are in separate headers, and do not appear in `CLI11.hpp`, but are completely +independent and can be used as needed. The `Timer`/`AutoTimer` class allows you +to easily time a block of code, with custom print output. ```cpp { @@ -856,12 +1464,18 @@ some_long_running_process(); } ``` -This will create a timer with a title (default: `Timer`), and will customize the output using the predefined `Big` output (default: `Simple`). Because it is an `AutoTimer`, it will print out the time elapsed when the timer is destroyed at the end of the block. If you use `Timer` instead, you can use `to_string` or `std::cout << timer << std::endl;` to print the time. The print function can be any function that takes two strings, the title and the time, and returns a formatted -string for printing. +This will create a timer with a title (default: `Timer`), and will customize the +output using the predefined `Big` output (default: `Simple`). Because it is an +`AutoTimer`, it will print out the time elapsed when the timer is destroyed at +the end of the block. If you use `Timer` instead, you can use `to_string` or +`std::cout << timer << std::endl;` to print the time. The print function can be +any function that takes two strings, the title and the time, and returns a +formatted string for printing. ### Other libraries -If you use the excellent [Rang][] library to add color to your terminal in a safe, multi-platform way, you can combine it with CLI11 nicely: +If you use the excellent [Rang][] library to add color to your terminal in a +safe, multi-platform way, you can combine it with CLI11 nicely: ```cpp std::atexit([](){std::cout << rang::style::reset;}); @@ -873,9 +1487,11 @@ try { } ``` -This will print help in blue, errors in red, and will reset before returning the terminal to the user. +This will print help in blue, errors in red, and will reset before returning the +terminal to the user. -If you are on a Unix-like system, and you'd like to handle control-c and color, you can add: +If you are on a Unix-like system, and you'd like to handle control-c and color, +you can add: ```cpp #include <csignal> @@ -899,41 +1515,88 @@ And, in your main function: ## API -The API is [documented here][api-docs]. Also see the [CLI11 tutorial GitBook][gitbook]. +The API is [documented here][api-docs]. Also see the [CLI11 tutorial +GitBook][gitbook]. ## Examples -Several short examples of different features are included in the repository. A brief description of each is included here - -* [callback_passthrough](https://github.com/CLIUtils/CLI11/blob/main/examples/callback_passthrough.cpp): Example of directly passing remaining arguments through to a callback function which generates a CLI11 application based on existing arguments. -* [custom_parse](https://github.com/CLIUtils/CLI11/blob/main/examples/custom_parse.cpp): Based on [Issue #566](https://github.com/CLIUtils/CLI11/issues/566), example of custom parser -* [digit_args](https://github.com/CLIUtils/CLI11/blob/main/examples/digit_args.cpp): Based on [Issue #123](https://github.com/CLIUtils/CLI11/issues/123), uses digit flags to pass a value -* [enum](https://github.com/CLIUtils/CLI11/blob/main/examples/enum.cpp): Using enumerations in an option, and the use of [CheckedTransformer](#transforming-validators) -* [enum_ostream](https://github.com/CLIUtils/CLI11/blob/main/examples/enum_ostream.cpp): In addition to the contents of example enum.cpp, this example shows how a custom ostream operator overrides CLI11's enum streaming. -* [formatter](https://github.com/CLIUtils/CLI11/blob/main/examples/formatter.cpp): Illustrating usage of a custom formatter -* [groups](https://github.com/CLIUtils/CLI11/blob/main/examples/groups.cpp): Example using groups of options for help grouping and a the timer helper class -* [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/main/examples/inter_argument_order.cpp): An app to practice mixing unlimited arguments, but still recover the original order. -* [json](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp): Using JSON as a config file parser -* [modhelp](https://github.com/CLIUtils/CLI11/blob/main/examples/modhelp.cpp): How to modify the help flag to do something other than default -* [nested](https://github.com/CLIUtils/CLI11/blob/main/examples/nested.cpp): Nested subcommands -* [option_groups](https://github.com/CLIUtils/CLI11/blob/main/examples/option_groups.cpp): Illustrating the use of option groups and a required number of options. Based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) to set interacting groups of options -* [positional_arity](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_arity.cpp): Illustrating use of `preparse_callback` to handle situations where the number of arguments can determine which should get parsed, Based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166) -* [positional_validation](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_validation.cpp): Example of how positional arguments are validated using the `validate_positional` flag, also based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166) -* [prefix_command](https://github.com/CLIUtils/CLI11/blob/main/examples/prefix_command.cpp): Illustrating use of the `prefix_command` flag. -* [ranges](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp): App to demonstrate exclusionary option groups based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) -* [shapes](https://github.com/CLIUtils/CLI11/blob/main/examples/shapes.cpp): Illustrating how to set up repeated subcommands Based on [gitter discussion](https://gitter.im/CLI11gitter/Lobby?at=5c7af6b965ffa019ea788cd5) -* [simple](https://github.com/CLIUtils/CLI11/blob/main/examples/simple.cpp): A simple example of how to set up a CLI11 Application with different flags and options -* [subcom_help](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_help.cpp): Configuring help for subcommands -* [subcom_partitioned](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_partitioned.cpp): Example with a timer and subcommands generated separately and added to the main app later. -* [subcommands](https://github.com/CLIUtils/CLI11/blob/main/examples/subcommands.cpp): Short example of subcommands -* [validators](https://github.com/CLIUtils/CLI11/blob/main/examples/validators.cpp): Example illustrating use of validators +Several short examples of different features are included in the repository. A +brief description of each is included here + +- [callback_passthrough](https://github.com/CLIUtils/CLI11/blob/main/examples/callback_passthrough.cpp): + Example of directly passing remaining arguments through to a callback function + which generates a CLI11 application based on existing arguments. +- [custom_parse](https://github.com/CLIUtils/CLI11/blob/main/examples/custom_parse.cpp): + Based on [Issue #566](https://github.com/CLIUtils/CLI11/issues/566), example + of custom parser +- [digit_args](https://github.com/CLIUtils/CLI11/blob/main/examples/digit_args.cpp): + Based on [Issue #123](https://github.com/CLIUtils/CLI11/issues/123), uses + digit flags to pass a value +- [enum](https://github.com/CLIUtils/CLI11/blob/main/examples/enum.cpp): Using + enumerations in an option, and the use of + [CheckedTransformer](#transforming-validators) +- [enum_ostream](https://github.com/CLIUtils/CLI11/blob/main/examples/enum_ostream.cpp): + In addition to the contents of example enum.cpp, this example shows how a + custom ostream operator overrides CLI11's enum streaming. +- [formatter](https://github.com/CLIUtils/CLI11/blob/main/examples/formatter.cpp): + Illustrating usage of a custom formatter +- [groups](https://github.com/CLIUtils/CLI11/blob/main/examples/groups.cpp): + Example using groups of options for help grouping and a the timer helper class +- [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/main/examples/inter_argument_order.cpp): + An app to practice mixing unlimited arguments, but still recover the original + order. +- [json](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp): Using + JSON as a config file parser +- [modhelp](https://github.com/CLIUtils/CLI11/blob/main/examples/modhelp.cpp): + How to modify the help flag to do something other than default +- [nested](https://github.com/CLIUtils/CLI11/blob/main/examples/nested.cpp): + Nested subcommands +- [option_groups](https://github.com/CLIUtils/CLI11/blob/main/examples/option_groups.cpp): + Illustrating the use of option groups and a required number of options. Based + on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) to set interacting + groups of options +- [positional_arity](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_arity.cpp): + Illustrating use of `preparse_callback` to handle situations where the number + of arguments can determine which should get parsed, Based on + [Issue #166](https://github.com/CLIUtils/CLI11/issues/166) +- [positional_validation](https://github.com/CLIUtils/CLI11/blob/main/examples/positional_validation.cpp): + Example of how positional arguments are validated using the + `validate_positional` flag, also based on + [Issue #166](https://github.com/CLIUtils/CLI11/issues/166) +- [prefix_command](https://github.com/CLIUtils/CLI11/blob/main/examples/prefix_command.cpp): + Illustrating use of the `prefix_command` flag. +- [ranges](https://github.com/CLIUtils/CLI11/blob/main/examples/ranges.cpp): App + to demonstrate exclusionary option groups based on + [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) +- [shapes](https://github.com/CLIUtils/CLI11/blob/main/examples/shapes.cpp): + Illustrating how to set up repeated subcommands Based on + [gitter discussion](https://gitter.im/CLI11gitter/Lobby?at=5c7af6b965ffa019ea788cd5) +- [simple](https://github.com/CLIUtils/CLI11/blob/main/examples/simple.cpp): A + simple example of how to set up a CLI11 Application with different flags and + options +- [subcom_help](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_help.cpp): + Configuring help for subcommands +- [subcom_partitioned](https://github.com/CLIUtils/CLI11/blob/main/examples/subcom_partitioned.cpp): + Example with a timer and subcommands generated separately and added to the + main app later. +- [subcommands](https://github.com/CLIUtils/CLI11/blob/main/examples/subcommands.cpp): + Short example of subcommands +- [validators](https://github.com/CLIUtils/CLI11/blob/main/examples/validators.cpp): + Example illustrating use of validators ## Contribute -To contribute, open an [issue][github issues] or [pull request][github pull requests] on GitHub, or ask a question on [gitter][]. There is also a short note to contributors [here](./.github/CONTRIBUTING.md). -This readme roughly follows the [Standard Readme Style][] and includes a mention of almost every feature of the library. More complex features are documented in more detail in the [CLI11 tutorial GitBook][gitbook]. +To contribute, open an [issue][github issues] or [pull +request][github pull requests] on GitHub, or ask a question on [gitter][]. There +is also a short note to contributors [here](./.github/CONTRIBUTING.md). This +readme roughly follows the [Standard Readme Style][] and includes a mention of +almost every feature of the library. More complex features are documented in +more detail in the [CLI11 tutorial GitBook][gitbook]. -This project was created by [Henry Schreiner](https://github.com/henryiii) and major features were added by [Philip Top](https://github.com/phlptp). Special thanks to all the contributors ([emoji key](https://allcontributors.org/docs/en/emoji-key)): +This project was created by [Henry Schreiner](https://github.com/henryiii) and +major features were added by [Philip Top](https://github.com/phlptp). Special +thanks to all the contributors +([emoji key](https://allcontributors.org/docs/en/emoji-key)): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> @@ -1009,27 +1672,38 @@ This project was created by [Henry Schreiner](https://github.com/henryiii) and m <!-- markdownlint-enable --> <!-- prettier-ignore-end --> + <!-- ALL-CONTRIBUTORS-LIST:END --> -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! +This project follows the +[all-contributors](https://github.com/all-contributors/all-contributors) +specification. Contributions of any kind welcome! ## License -As of version 1.0, this library is available under a 3-Clause BSD license. See the [LICENSE](./LICENSE) file for details. +As of version 1.0, this library is available under a 3-Clause BSD license. See +the [LICENSE](./LICENSE) file for details. -CLI11 was developed at the [University of Cincinnati][] to support of the [GooFit][] library under [NSF Award 1414736][]. Version 0.9 was featured in a [DIANA/HEP][] meeting at CERN ([see the slides][diana slides]). Please give it a try! Feedback is always welcome. +CLI11 was developed at the [University of Cincinnati][] to support of the +[GooFit][] library under [NSF Award 1414736][]. Version 0.9 was featured in a +[DIANA/HEP][] meeting at CERN ([see the slides][diana slides]). Please give it a +try! Feedback is always welcome. [doi-badge]: https://zenodo.org/badge/80064252.svg [doi-link]: https://zenodo.org/badge/latestdoi/80064252 -[azure-badge]: https://dev.azure.com/CLIUtils/CLI11/_apis/build/status/CLIUtils.CLI11?branchName=main +[azure-badge]: + https://dev.azure.com/CLIUtils/CLI11/_apis/build/status/CLIUtils.CLI11?branchName=main [azure]: https://dev.azure.com/CLIUtils/CLI11 [actions-link]: https://github.com/CLIUtils/CLI11/actions -[actions-badge]: https://github.com/CLIUtils/CLI11/actions/workflows/tests.yml/badge.svg -[appveyor-badge]: https://ci.appveyor.com/api/projects/status/82niaxpaa28dwbms/branch/main?svg=true +[actions-badge]: + https://github.com/CLIUtils/CLI11/actions/workflows/tests.yml/badge.svg +[appveyor-badge]: + https://ci.appveyor.com/api/projects/status/82niaxpaa28dwbms/branch/main?svg=true [appveyor]: https://ci.appveyor.com/project/HenrySchreiner/cli11 [repology-badge]: https://repology.org/badge/latest-versions/cli11.svg [repology]: https://repology.org/project/cli11/versions -[codecov-badge]: https://codecov.io/gh/CLIUtils/CLI11/branch/main/graph/badge.svg?token=2O4wfs8NJO +[codecov-badge]: + https://codecov.io/gh/CLIUtils/CLI11/branch/main/graph/badge.svg?token=2O4wfs8NJO [codecov]: https://codecov.io/gh/CLIUtils/CLI11 [gitter-badge]: https://badges.gitter.im/CLI11gitter/Lobby.svg [gitter]: https://gitter.im/CLI11gitter/Lobby @@ -1046,7 +1720,8 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi [click]: http://click.pocoo.org [api-docs]: https://CLIUtils.github.io/CLI11/index.html [rang]: https://github.com/agauniyal/rang -[boost program options]: http://www.boost.org/doc/libs/1_63_0/doc/html/program_options.html +[boost program options]: + http://www.boost.org/doc/libs/1_63_0/doc/html/program_options.html [the lean mean c++ option parser]: http://optionparser.sourceforge.net [tclap]: http://tclap.sourceforge.net [cxxopts]: https://github.com/jarro2783/cxxopts @@ -1057,7 +1732,8 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi [nsf award 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736 [university of cincinnati]: http://www.uc.edu [gitbook]: https://cliutils.github.io/CLI11/book/ -[cli11 advanced topics/custom converters]: https://cliutils.gitlab.io/CLI11Tutorial/chapters/advanced-topics.html#custom-converters +[cli11 advanced topics/custom converters]: + https://cliutils.gitlab.io/CLI11Tutorial/chapters/advanced-topics.html#custom-converters [programoptions.hxx]: https://github.com/Fytch/ProgramOptions.hxx [argument aggregator]: https://github.com/vietjtnguyen/argagg [args]: https://github.com/Taywee/args @@ -1072,14 +1748,20 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi [wandbox-badge]: https://img.shields.io/badge/try_2.1-online-blue.svg [wandbox-link]: https://wandbox.org/permlink/CA5bymNHh0AczdeN [releases-badge]: https://img.shields.io/github/release/CLIUtils/CLI11.svg -[cli11-po-compare]: https://iscinumpy.gitlab.io/post/comparing-cli11-and-boostpo/ -[diana slides]: https://indico.cern.ch/event/619465/contributions/2507949/attachments/1448567/2232649/20170424-diana-2.pdf +[cli11-po-compare]: + https://iscinumpy.gitlab.io/post/comparing-cli11-and-boostpo/ +[diana slides]: + https://indico.cern.ch/event/619465/contributions/2507949/attachments/1448567/2232649/20170424-diana-2.pdf [awesome c++]: https://github.com/fffaraz/awesome-cpp/blob/master/README.md#cli [cli]: https://codesynthesis.com/projects/cli/ -[single file libs]: https://github.com/nothings/single_file_libs/blob/master/README.md -[codacy-badge]: https://app.codacy.com/project/badge/Grade/2796b969c1b54321a02ad08affec0800 -[codacy-link]: https://www.codacy.com/gh/CLIUtils/CLI11/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CLIUtils/CLI11&utm_campaign=Badge_Grade +[single file libs]: + https://github.com/nothings/single_file_libs/blob/master/README.md +[codacy-badge]: + https://app.codacy.com/project/badge/Grade/2796b969c1b54321a02ad08affec0800 +[codacy-link]: + https://www.codacy.com/gh/CLIUtils/CLI11/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CLIUtils/CLI11&utm_campaign=Badge_Grade [hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html [standard readme style]: https://github.com/RichardLitt/standard-readme [argparse]: https://github.com/p-ranav/argparse [toml]: https://toml.io +[lyra]: https://github.com/bfgroup/Lyra diff --git a/packages/CLI11/azure-pipelines.yml b/packages/CLI11/azure-pipelines.yml index 750ac31d9aa57f93fc36992c675ff4e0d9d99b3f..c519e153bada7ff93a1132256f285c5b75c3a053 100644 --- a/packages/CLI11/azure-pipelines.yml +++ b/packages/CLI11/azure-pipelines.yml @@ -4,128 +4,132 @@ # https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc trigger: -- main -- 'v*' + - main + - "v*" pr: -- main -- 'v*' + - main + - "v*" variables: cli11.single: ON cli11.std: 14 cli11.build_type: Debug cli11.options: -DCLI11_EXAMPLES_JSON=ON + cli11.precompile: OFF CMAKE_BUILD_PARALLEL_LEVEL: 4 jobs: + - job: CppLint + pool: + vmImage: "ubuntu-latest" + container: sharaku/cpplint:latest + steps: + - bash: cpplint --counting=detailed --recursive examples include/CLI tests + displayName: Checking against google style guide -- job: ClangTidy - variables: - CXX_FLAGS: "-Werror -Wcast-align -Wfloat-equal -Wimplicit-atomic-properties -Wmissing-declarations -Woverlength-strings -Wshadow -Wstrict-selector-match -Wundeclared-selector -Wunreachable-code -std=c++11" - cli11.options: -DCLI11_CLANG_TIDY=ON -DCLI11_CLANG_TIDY_OPTIONS="-fix" - cli11.std: 11 - cli11.single: OFF - CMAKE_BUILD_PARALLEL_LEVEL: 1 - pool: - vmImage: 'ubuntu-latest' - container: silkeh/clang:8 - steps: - - template: .ci/azure-cmake.yml - - template: .ci/azure-build.yml - - script: git diff --exit-code --color - displayName: Check tidy + # TODO: Fix macOS error and windows warning in c++17 mode + - job: Native + strategy: + matrix: + Linux14: + vmImage: "ubuntu-latest" + Linux14PC: + vmImage: "ubuntu-latest" + cli11.precompile: ON + macOS17: + vmImage: "macOS-latest" + cli11.std: 17 + macOS11: + vmImage: "macOS-latest" + cli11.std: 11 + macOS11PC: + vmImage: "macOS-latest" + cli11.std: 11 + cli11.precompile: ON + Windows17: + vmImage: "windows-2019" + cli11.std: 17 + Windows17PC: + vmImage: "windows-2019" + cli11.std: 17 + cli11.precompile: ON + Windows11: + vmImage: "windows-2019" + cli11.std: 11 + WindowsLatest: + vmImage: "windows-2019" + cli11.std: 20 + cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc" + Linux17nortti: + vmImage: "ubuntu-latest" + cli11.std: 17 + cli11.options: -DCMAKE_CXX_FLAGS="-fno-rtti" + pool: + vmImage: $(vmImage) + steps: + - template: .ci/azure-build.yml + - template: .ci/azure-test.yml -- job: CppLint - pool: - vmImage: 'ubuntu-latest' - container: sharaku/cpplint:latest - steps: - - bash: cpplint --counting=detailed --recursive examples include/CLI tests - displayName: Checking against google style guide + - job: Meson + pool: + vmImage: "ubuntu-latest" + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.7" + - script: python3 -m pip install meson ninja + displayName: install meson + - script: mkdir tests/mesonTest/subprojects + displayName: generate test directories + - script: ln -s "$(pwd)" tests/mesonTest/subprojects/CLI11 + displayName: generate CLI11 symlink + - script: meson build + displayName: Run meson to generate build + workingDirectory: tests/mesonTest + - script: ninja -C tests/mesonTest/build + displayName: Build with Ninja + - script: ./tests/mesonTest/build/main --help + displayName: Run help -# TODO: Fix macOS error and windows warning in c++17 mode -- job: Native - strategy: - matrix: - Linux14: - vmImage: 'ubuntu-latest' - macOS17: - vmImage: 'macOS-latest' - cli11.std: 17 - macOS11: - vmImage: 'macOS-latest' - cli11.std: 11 - Windows17: - vmImage: 'vs2017-win2016' - cli11.std: 17 - Windows11: - vmImage: 'vs2017-win2016' - cli11.std: 11 - Windowslatest: - vmImage: 'windows-2019' - cli11.std: 20 - cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc" - Linux17nortti: - vmImage: 'ubuntu-latest' - cli11.std: 17 - cli11.options: -DCMAKE_CXX_FLAGS="-fno-rtti" - pool: - vmImage: $(vmImage) - steps: - - template: .ci/azure-build.yml - - template: .ci/azure-test.yml - -- job: Meson - pool: - vmImage: 'ubuntu-latest' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.6' - - script: python3 -m pip install meson ninja - - script: meson build - displayName: Run meson to generate build - workingDirectory: tests/mesonTest - - script: ninja -C tests/mesonTest/build - displayName: Build with Ninja - - script: ./tests/mesonTest/build/main --help - displayName: Run help - -- job: Docker - variables: - cli11.single: OFF - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - gcc9: - containerImage: gcc:9 - cli11.std: 17 - gcc8: - containerImage: gcc:8 - cli11.std: 17 - gcc4.8: - containerImage: gcc:4.8 - cli11.std: 11 - cli11.options: - clang3.4: - containerImage: silkeh/clang:3.4 - cli11.std: 11 - clang8: - containerImage: silkeh/clang:8 - cli11.std: 14 - cli11.options: -DCLI11_FORCE_LIBCXX=ON - clang8_17: - containerImage: silkeh/clang:8 - cli11.std: 17 - cli11.options: -DCLI11_FORCE_LIBCXX=ON - clang10_20: - containerImage: silkeh/clang:10 - cli11.std: 20 - cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20 - container: $[ variables['containerImage'] ] - steps: - - template: .ci/azure-cmake.yml - - template: .ci/azure-build.yml - - template: .ci/azure-test.yml + - job: Docker + variables: + cli11.single: OFF + pool: + vmImage: "ubuntu-latest" + strategy: + matrix: + gcc9: + containerImage: gcc:9 + cli11.std: 17 + cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5" + gcc11: + containerImage: gcc:11 + cli11.std: 20 + gcc8: + containerImage: gcc:8 + cli11.std: 17 + gcc4.8: + containerImage: helics/buildenv:gcc4-8-builder + cli11.std: 11 + cli11.options: + clang3.4: + containerImage: silkeh/clang:3.4 + cli11.std: 11 + clang8: + containerImage: silkeh/clang:8 + cli11.std: 14 + cli11.options: -DCLI11_FORCE_LIBCXX=ON + clang8_17: + containerImage: silkeh/clang:8 + cli11.std: 17 + cli11.options: -DCLI11_FORCE_LIBCXX=ON + clang10_20: + containerImage: silkeh/clang:10 + cli11.std: 20 + cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20 + container: $[ variables['containerImage'] ] + steps: + - template: .ci/azure-cmake.yml + - template: .ci/azure-build.yml + - template: .ci/azure-test.yml diff --git a/packages/CLI11/book/README.md b/packages/CLI11/book/README.md index 917e753fe0876806d6d13ad6636e3ce18faaf885..002b8dab09cb131c07f15de26c035209f49d9628 100644 --- a/packages/CLI11/book/README.md +++ b/packages/CLI11/book/README.md @@ -1,12 +1,25 @@ # CLI11: An introduction -This gitbook is designed to provide an introduction to using the CLI11 library to write your own command line programs. The library is designed to be clean, intuitive, but powerful. There are no requirements beyond C++11 support (and even `<regex>` support not required). It works on Mac, Linux, and Windows, and has 100% test coverage on all three systems. You can simply drop in a single header file (`CLI11.hpp` available in [releases][]) to use CLI11 in your own application. Other ways to integrate it into a build system are listed in the [README][]. - -The library was inspired the Python libraries [Plumbum][] and [Click][], and incorporates many of their user friendly features. The library is extensively documented, with a [friendly introduction][README], this tutorial book, and more technical [API docs][]. - -> Feel free to contribute to [this documentation here][CLI11Tutorial] if something can be improved! - -The syntax is simple and scales from a basic application to a massive physics analysis with multiple models and many parameters and switches. For example, this is a simple program that has an optional parameter that defaults to 0: +This gitbook is designed to provide an introduction to using the CLI11 library +to write your own command line programs. The library is designed to be clean, +intuitive, but powerful. There are no requirements beyond C++11 support (and +even `<regex>` support not required). It works on Mac, Linux, and Windows, and +has 100% test coverage on all three systems. You can simply drop in a single +header file (`CLI11.hpp` available in [releases][]) to use CLI11 in your own +application. Other ways to integrate it into a build system are listed in the +[README][]. + +The library was inspired the Python libraries [Plumbum][] and [Click][], and +incorporates many of their user friendly features. The library is extensively +documented, with a [friendly introduction][readme], this tutorial book, and more +technical [API docs][]. + +> Feel free to contribute to [this documentation here][cli11tutorial] if +> something can be improved! + +The syntax is simple and scales from a basic application to a massive physics +analysis with multiple models and many parameters and switches. For example, +this is a simple program that has an optional parameter that defaults to 0: ```term gitbook $ ./a.out @@ -24,13 +37,16 @@ Options: -p INT Parameter ``` -Like any good command line application, help is provided. This program can be implemented in 10 lines: +Like any good command line application, help is provided. This program can be +implemented in 10 lines: [include](code/intro.cpp) [Source code](https://github.com/CLIUtils/CLI11/blob/main/book/code/intro.cpp) -Unlike some other libraries, this is enough to exit correctly and cleanly if help is requested or if incorrect arguments are passed. You can try this example out for yourself. To compile with GCC: +Unlike some other libraries, this is enough to exit correctly and cleanly if +help is requested or if incorrect arguments are passed. You can try this example +out for yourself. To compile with GCC: ```term gitbook:examples $ c++ -std=c++11 intro.cpp @@ -45,13 +61,26 @@ app.add_option("-f,--file", file, "Require an existing file") ->check(CLI::ExistingFile); ``` -You can use any valid type; the above example could have used a `boost::file_system` file instead of a `std::string`. The value is a real value and does not require any special lookups to access. You do not have to risk typos by repeating the values after parsing like some libraries require. The library also handles positional arguments, flags, fixed or unlimited repeating options, interdependent options, flags, custom validators, help groups, and more. - -You can use subcommands, as well. Subcommands support callback lambda functions when parsed, or they can be checked later. You can infinitely nest subcommands, and each is a full `App` instance, supporting everything listed above. - -Reading/producing `.ini` files for configuration is also supported, as is using environment variables as input. The base `App` can be subclassed and customized for use in a toolkit (like [GooFit][]). All the standard shell idioms, like `--`, work as well. - -CLI11 was developed at the [University of Cincinnati][] in support of the [GooFit][] library under [NSF Award 1414736][NSF 1414736]. It was featured in a [DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome. +You can use any valid type; the above example could have used a +`boost::file_system` file instead of a `std::string`. The value is a real value +and does not require any special lookups to access. You do not have to risk +typos by repeating the values after parsing like some libraries require. The +library also handles positional arguments, flags, fixed or unlimited repeating +options, interdependent options, flags, custom validators, help groups, and +more. + +You can use subcommands, as well. Subcommands support callback lambda functions +when parsed, or they can be checked later. You can infinitely nest subcommands, +and each is a full `App` instance, supporting everything listed above. + +Reading/producing `.ini` files for configuration is also supported, as is using +environment variables as input. The base `App` can be subclassed and customized +for use in a toolkit (like [GooFit][]). All the standard shell idioms, like +`--`, work as well. + +CLI11 was developed at the [University of Cincinnati][] in support of the +[GooFit][] library under [NSF Award 1414736][nsf 1414736]. It was featured in a +[DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome. [goofit]: https://github.com/GooFit/GooFit [diana/hep]: https://diana-hep.org diff --git a/packages/CLI11/book/SUMMARY.md b/packages/CLI11/book/SUMMARY.md index 38261d52e2c23e55c595824029042fb392271a47..40f8479c60a355248dcc4a9b4656328fe40ceabb 100644 --- a/packages/CLI11/book/SUMMARY.md +++ b/packages/CLI11/book/SUMMARY.md @@ -1,15 +1,15 @@ # Summary -* [Introduction](/README.md) -* [Installation](/chapters/installation.md) -* [Basics](/chapters/basics.md) -* [Flags](/chapters/flags.md) -* [Options](/chapters/options.md) -* [Validators](/chapters/validators.md) -* [Subcommands and the App](/chapters/subcommands.md) -* [An advanced example](/chapters/an-advanced-example.md) -* [Configuration files](/chapters/config.md) -* [Formatting help output](/chapters/formatting.md) -* [Toolkits](/chapters/toolkits.md) -* [Advanced topics](/chapters/advanced-topics.md) -* [Internals](/chapters/internals.md) +- [Introduction](/README.md) +- [Installation](/chapters/installation.md) +- [Basics](/chapters/basics.md) +- [Flags](/chapters/flags.md) +- [Options](/chapters/options.md) +- [Validators](/chapters/validators.md) +- [Subcommands and the App](/chapters/subcommands.md) +- [An advanced example](/chapters/an-advanced-example.md) +- [Configuration files](/chapters/config.md) +- [Formatting help output](/chapters/formatting.md) +- [Toolkits](/chapters/toolkits.md) +- [Advanced topics](/chapters/advanced-topics.md) +- [Internals](/chapters/internals.md) diff --git a/packages/CLI11/book/book.json b/packages/CLI11/book/book.json index f8745d66717013f0367200464fed43db8e7fd169..a0a5d2d6664aa56e9b8acbad9a8360b24aeb6e99 100644 --- a/packages/CLI11/book/book.json +++ b/packages/CLI11/book/book.json @@ -1,16 +1,12 @@ { -"title": "CLI11 Tutorial", -"description": "A set of examples and detailed information about CLI11", -"author": "Henry Schreiner", -"plugins": [ - "include-codeblock", - "term", - "hints" - ], -"pluginsConfig": { - "include-codeblock": { - "unindent": true, - "fixlang": true - } + "title": "CLI11 Tutorial", + "description": "A set of examples and detailed information about CLI11", + "author": "Henry Schreiner", + "plugins": ["include-codeblock", "term", "hints"], + "pluginsConfig": { + "include-codeblock": { + "unindent": true, + "fixlang": true } + } } diff --git a/packages/CLI11/book/chapters/advanced-topics.md b/packages/CLI11/book/chapters/advanced-topics.md index fee282165ada96485d6b594f51f5494597c0dc1e..b450eb7fe2581705bd41b651e4836b61f4ecb98b 100644 --- a/packages/CLI11/book/chapters/advanced-topics.md +++ b/packages/CLI11/book/chapters/advanced-topics.md @@ -9,12 +9,15 @@ std::string opt; app.add_option("--my_option", opt)->envname("MY_OPTION"); ``` -If not given on the command line, the environment variable will be checked and read from if it exists. All the standard tools, like default and required, work as expected. -If passed on the command line, this will ignore the environment variable. +If not given on the command line, the environment variable will be checked and +read from if it exists. All the standard tools, like default and required, work +as expected. If passed on the command line, this will ignore the environment +variable. ## Needs/excludes -You can set a network of requirements. For example, if flag a needs flag b but cannot be given with flag c, that would be: +You can set a network of requirements. For example, if flag a needs flag b but +cannot be given with flag c, that would be: ```cpp auto a = app.add_flag("-a"); @@ -25,11 +28,14 @@ a->needs(b); a->excludes(c); ``` -CLI11 will make sure your network of requirements makes sense, and will throw an error immediately if it does not. +CLI11 will make sure your network of requirements makes sense, and will throw an +error immediately if it does not. ## Custom option callbacks -You can make a completely generic option with a custom callback. For example, if you wanted to add a complex number (already exists, so please don't actually do this): +You can make a completely generic option with a custom callback. For example, if +you wanted to add a complex number (already exists, so please don't actually do +this): ```cpp CLI::Option * @@ -62,7 +68,13 @@ add_option(app, "-c,--complex", comp); ## Custom converters -You can add your own converters to allow CLI11 to accept more option types in the standard calls. These can only be used for "single" size options (so complex, vector, etc. are a separate topic). If you set up a custom `istringstream& operator <<` overload before include CLI11, you can support different conversions. If you place this in the CLI namespace, you can even keep this from affecting the rest of your code. Here's how you could add `boost::optional` for a compiler that does not have `__has_include`: +You can add your own converters to allow CLI11 to accept more option types in +the standard calls. These can only be used for "single" size options (so +complex, vector, etc. are a separate topic). If you set up a custom +`istringstream& operator <<` overload before include CLI11, you can support +different conversions. If you place this in the CLI namespace, you can even keep +this from affecting the rest of your code. Here's how you could add +`boost::optional` for a compiler that does not have `__has_include`: ```cpp // CLI11 already does this if __has_include is defined @@ -87,7 +99,10 @@ template <typename T> std::istringstream &operator>>(std::istringstream &in, boo #include <CLI11.hpp> ``` -This is an example of how to use the system only; if you are just looking for a way to activate `boost::optional` support on older compilers, you should define `CLI11_BOOST_OPTIONAL` before including a CLI11 file, you'll get the `boost::optional` support. +This is an example of how to use the system only; if you are just looking for a +way to activate `boost::optional` support on older compilers, you should define +`CLI11_BOOST_OPTIONAL` before including a CLI11 file, you'll get the +`boost::optional` support. ## Custom converters and type names: std::chrono example diff --git a/packages/CLI11/book/chapters/an-advanced-example.md b/packages/CLI11/book/chapters/an-advanced-example.md index 84e838ebf32aa0b909dee1fe75e2316b60d305ad..0b1a0698ba5f94207d2f5d9143e7fc3e4203d370 100644 --- a/packages/CLI11/book/chapters/an-advanced-example.md +++ b/packages/CLI11/book/chapters/an-advanced-example.md @@ -1,6 +1,8 @@ # Making a git clone -Let's try our hand at a little `git` clone, called `geet`. It will just print it's intent, rather than running actual code, since it's just a demonstration. Let's start by adding an app and requiring 1 subcommand to run: +Let's try our hand at a little `git` clone, called `geet`. It will just print +it's intent, rather than running actual code, since it's just a demonstration. +Let's start by adding an app and requiring 1 subcommand to run: [include:"Intro"](../code/geet.cpp) @@ -12,7 +14,8 @@ Now, let's add `commit`: [include:"Commit"](../code/geet.cpp) -All that's need now is the parse call. We'll print a little message after the code runs, and then return: +All that's need now is the parse call. We'll print a little message after the +code runs, and then return: [include:"Parse"](../code/geet.cpp) @@ -28,4 +31,9 @@ You'll see it behaves pretty much like `git`. ## Multi-file App parse code -This example could be made much nicer if it was split into files, one per subcommand. If you simply use shared pointers instead of raw values in the lambda capture, you can tie the lifetime to the lambda function lifetime. CLI11 has a multifile example in its example folder. +This example could be made much nicer if it was split into files, one per +subcommand. If you simply use shared pointers instead of raw values in the +lambda capture, you can tie the lifetime to the lambda function lifetime. CLI11 +has a +[multifile example](https://github.com/CLIUtils/CLI11/tree/main/examples/subcom_in_files) +in its example folder. diff --git a/packages/CLI11/book/chapters/basics.md b/packages/CLI11/book/chapters/basics.md index 0c55ec4f404a88e65d0f467e20f0f13ead31f025..29daf73b8c78230400b805f4602da21bfac735bb 100644 --- a/packages/CLI11/book/chapters/basics.md +++ b/packages/CLI11/book/chapters/basics.md @@ -4,17 +4,30 @@ The simplest CLI11 program looks like this: [include](../code/simplest.cpp) -The first line includes the library; this explicitly uses the single file edition (see [Selecting an edition](/chapters/installation)). - -After entering the main function, you'll see that a `CLI::App` object is created. This is the basis for all interactions with the library. You could optionally provide a description for your app here. - -A normal CLI11 application would define some flags and options next. This is a simplest possible example, so we'll go on. - -The macro `CLI11_PARSE` just runs five simple lines. This internally runs `app.parse(argc, argv)`, which takes the command line info from C++ and parses it. If there is an error, it throws a `ParseError`; if you catch it, you can use `app.exit` with the error as an argument to print a nice message and produce the correct return code for your application. - -If you just use `app.parse` directly, your application will still work, but the stack will not be correctly unwound since you have an uncaught exception, and the command line output will be cluttered, especially for help. - -For this (and most of the examples in this book) we will assume that we have the `CLI11.hpp` file in the current directory and that we are creating an output executable `a.out` on a macOS or Linux system. The commands to compile and test this example would be: +The first line includes the library; this explicitly uses the single file +edition (see [Selecting an edition](/chapters/installation)). + +After entering the main function, you'll see that a `CLI::App` object is +created. This is the basis for all interactions with the library. You could +optionally provide a description for your app here. + +A normal CLI11 application would define some flags and options next. This is a +simplest possible example, so we'll go on. + +The macro `CLI11_PARSE` just runs five simple lines. This internally runs +`app.parse(argc, argv)`, which takes the command line info from C++ and parses +it. If there is an error, it throws a `ParseError`; if you catch it, you can use +`app.exit` with the error as an argument to print a nice message and produce the +correct return code for your application. + +If you just use `app.parse` directly, your application will still work, but the +stack will not be correctly unwound since you have an uncaught exception, and +the command line output will be cluttered, especially for help. + +For this (and most of the examples in this book) we will assume that we have the +`CLI11.hpp` file in the current directory and that we are creating an output +executable `a.out` on a macOS or Linux system. The commands to compile and test +this example would be: ```term gitbook:examples $ g++ -std=c++11 simplest.cpp diff --git a/packages/CLI11/book/chapters/config.md b/packages/CLI11/book/chapters/config.md index 79295bdbfc283e8d7eaa3ff42bdd332dec5d9b57..d062c659583a3eee22c53f15e6d6421e6be3442e 100644 --- a/packages/CLI11/book/chapters/config.md +++ b/packages/CLI11/book/chapters/config.md @@ -2,36 +2,77 @@ ## Reading a configure file -You can tell your app to allow configure files with `set_config("--config")`. There are arguments: the first is the option name. If empty, it will clear the config flag. The second item is the default file name. If that is specified, the config will try to read that file. The third item is the help string, with a reasonable default, and the final argument is a boolean (default: false) that indicates that the configuration file is required and an error will be thrown if the file is not found and this is set to true. +You can tell your app to allow configure files with `set_config("--config")`. +There are arguments: the first is the option name. If empty, it will clear the +config flag. The second item is the default file name. If that is specified, the +config will try to read that file. The third item is the help string, with a +reasonable default, and the final argument is a boolean (default: false) that +indicates that the configuration file is required and an error will be thrown if +the file is not found and this is set to true. + +### Adding a default path + +if it is desired that config files be searched for a in a default path the +`CLI::FileOnDefaultPath` transform can be used. + +```cpp +app.set_config("--config")->transform(CLI::FileOnDefaultPath("/default_path/")); +``` + +This will allow specified files to either exist as given or on a specified +default path. + +```cpp +app.set_config("--config") + ->transform(CLI::FileOnDefaultPath("/default_path/")) + ->transform(CLI::FileOnDefaultPath("/default_path2/",false)); +``` + +Multiple default paths can be specified through this mechanism. The last +transform given is executed first so the error return must be disabled so it can +be chained to the first. The same effect can be achieved though the or(`|`) +operation with validators + +```cpp +app.set_config("--config") + ->transform(CLI::FileOnDefaultPath("/default_path2/") | CLI::FileOnDefaultPath("/default_path/")); +``` ### Extra fields -Sometimes configuration files are used for multiple purposes so CLI11 allows options on how to deal with extra fields +Sometimes configuration files are used for multiple purposes so CLI11 allows +options on how to deal with extra fields ```cpp app.allow_config_extras(true); ``` -will allow capture the extras in the extras field of the app. (NOTE: This also sets the `allow_extras` in the app to true) +will allow capture the extras in the extras field of the app. (NOTE: This also +sets the `allow_extras` in the app to true) ```cpp app.allow_config_extras(false); ``` -will generate an error if there are any extra fields -for slightly finer control there is a scoped enumeration of the modes or +will generate an error if there are any extra fields for slightly finer control +there is a scoped enumeration of the modes or ```cpp app.allow_config_extras(CLI::config_extras_mode::ignore); ``` -will completely ignore extra parameters in the config file. This mode is the default. +will completely ignore extra parameters in the config file. This mode is the +default. ```cpp app.allow_config_extras(CLI::config_extras_mode::capture); ``` -will store the unrecognized options in the app extras fields. This option is the closest equivalent to `app.allow_config_extras(true);` with the exception that it does not also set the `allow_extras` flag so using this option without also setting `allow_extras(true)` will generate an error which may or may not be the desired behavior. +will store the unrecognized options in the app extras fields. This option is the +closest equivalent to `app.allow_config_extras(true);` with the exception that +it does not also set the `allow_extras` flag so using this option without also +setting `allow_extras(true)` will generate an error which may or may not be the +desired behavior. ```cpp app.allow_config_extras(CLI::config_extras_mode::error); @@ -43,17 +84,20 @@ is equivalent to `app.allow_config_extras(false);` app.allow_config_extras(CLI::config_extras_mode::ignore_all); ``` -will completely ignore any mismatches, extras, or other issues with the config file +will completely ignore any mismatches, extras, or other issues with the config +file ### Getting the used configuration file name If it is needed to get the configuration file name used this can be obtained via -`app.get_config_ptr()->as<std::string>()` or -`app["--config"]->as<std::string>()` assuming `--config` was the configuration option name. +`app.get_config_ptr()->as<std::string>()` or +`app["--config"]->as<std::string>()` assuming `--config` was the configuration +option name. ## Configure file format -Here is an example configuration file, in [TOML](https://github.com/toml-lang/toml) format: +Here is an example configuration file, in +[TOML](https://github.com/toml-lang/toml) format: ```ini # Comments are supported, using a # @@ -70,7 +114,15 @@ in_subcommand = Wow subcommand = true # could also be give as sub.subcommand=true ``` -Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `y`, `t`, `+`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `n`, `f`, `-`, `disable`, (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults". If a subcommand is set to `configurable` then passing the subcommand using `[sub]` in a configuration file will trigger the subcommand.) +Spaces before and after the name and argument are ignored. Multiple arguments +are separated by spaces. One set of quotes will be removed, preserving spaces +(the same way the command line works). Boolean options can be `true`, `on`, `1`, +`y`, `t`, `+`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `n`, `f`, `-`, +`disable`, (case insensitive). Sections (and `.` separated names) are treated as +subcommands (note: this does not necessarily mean that subcommand was passed, it +just sets the "defaults". If a subcommand is set to `configurable` then passing +the subcommand using `[sub]` in a configuration file will trigger the +subcommand.) CLI11 also supports configuration file in INI format. @@ -88,21 +140,27 @@ in_subcommand = Wow sub.subcommand = true ``` -The main differences are in vector notation and comment character. Note: CLI11 is not a full TOML parser as it just reads values as strings. It is possible (but not recommended) to mix notation. +The main differences are in vector notation and comment character. Note: CLI11 +is not a full TOML parser as it just reads values as strings. It is possible +(but not recommended) to mix notation. ## Multiple configuration files -If it is desired that multiple configuration be allowed. Use +If it is desired that multiple configuration be allowed. Use ```cpp app.set_config("--config")->expected(1, X); ``` -Where X is some positive integer and will allow up to `X` configuration files to be specified by separate `--config` arguments. +Where X is some positive integer and will allow up to `X` configuration files to +be specified by separate `--config` arguments. ## Writing out a configure file -To print a configuration file from the passed arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include option descriptions and the App description +To print a configuration file from the passed arguments, use +`.config_to_str(default_also=false, write_description=false)`, where +`default_also` will also show any defaulted arguments, and `write_description` +will include option descriptions and the App description ```cpp CLI::App app; @@ -113,7 +171,8 @@ To print a configuration file from the passed arguments, use `.config_to_str(def std::cout<<app.config_to_str(true,true); ``` -if a prefix is needed to print before the options, for example to print a config for just a subcommand, the config formatter can be obtained directly. +if a prefix is needed to print before the options, for example to print a config +for just a subcommand, the config formatter can be obtained directly. ```cpp auto fmtr=app.get_config_formatter(); @@ -124,7 +183,11 @@ if a prefix is needed to print before the options, for example to print a config ### Customization of configure file output -The default config parser/generator has some customization points that allow variations on the TOML format. The default formatter has a base configuration that matches the TOML format. It defines 5 characters that define how different aspects of the configuration are handled. You must use `get_config_formatter_base()` to have access to these fields +The default config parser/generator has some customization points that allow +variations on the TOML format. The default formatter has a base configuration +that matches the TOML format. It defines 5 characters that define how different +aspects of the configuration are handled. You must use +`get_config_formatter_base()` to have access to these fields ```cpp /// the character used for comments @@ -153,41 +216,62 @@ std::string configSection; These can be modified via setter functions -* `ConfigBase *comment(char cchar)`: Specify the character to start a comment block -* `ConfigBase *arrayBounds(char aStart, char aEnd)`: Specify the start and end characters for an array -* `ConfigBase *arrayDelimiter(char aSep)`: Specify the delimiter character for an array -* `ConfigBase *valueSeparator(char vSep)`: Specify the delimiter between a name and value -* `ConfigBase *quoteCharacter(char qString, char qChar)` :specify the characters to use around strings and single characters -* `ConfigBase *maxLayers(uint8_t layers)` : specify the maximum number of parent layers to process. This is useful to limit processing for larger config files -* `ConfigBase *parentSeparator(char sep)` : specify the character to separate parent layers from options -* `ConfigBase *section(const std::string §ionName)` : specify the section name to use to get the option values, only this section will be processed -* `ConfigBase *index(uint16_t sectionIndex)` : specify an index section to use for processing if multiple TOML sections of the same name are present `[[section]]` - -For example, to specify reading a configure file that used `:` to separate name and values: +- `ConfigBase *comment(char cchar)`: Specify the character to start a comment + block +- `ConfigBase *arrayBounds(char aStart, char aEnd)`: Specify the start and end + characters for an array +- `ConfigBase *arrayDelimiter(char aSep)`: Specify the delimiter character for + an array +- `ConfigBase *valueSeparator(char vSep)`: Specify the delimiter between a name + and value +- `ConfigBase *quoteCharacter(char qString, char qChar)` :specify the characters + to use around strings and single characters +- `ConfigBase *maxLayers(uint8_t layers)` : specify the maximum number of parent + layers to process. This is useful to limit processing for larger config files +- `ConfigBase *parentSeparator(char sep)` : specify the character to separate + parent layers from options +- `ConfigBase *section(const std::string §ionName)` : specify the section + name to use to get the option values, only this section will be processed +- `ConfigBase *index(uint16_t sectionIndex)` : specify an index section to use + for processing if multiple TOML sections of the same name are present + `[[section]]` + +For example, to specify reading a configure file that used `:` to separate name +and values: ```cpp auto config_base=app.get_config_formatter_base(); config_base->valueSeparator(':'); ``` -The default configuration file will read INI files, but will write out files in the TOML format. To specify outputting INI formatted files use +The default configuration file will read INI files, but will write out files in +the TOML format. To specify outputting INI formatted files use ```cpp app.config_formatter(std::make_shared<CLI::ConfigINI>()); ``` -which makes use of a predefined modification of the ConfigBase class which TOML also uses. If a custom formatter is used that is not inheriting from the from ConfigBase class `get_config_formatter_base() will return a nullptr if RTTI is on (usually the default), or garbage if RTTI is off, so some care must be exercised in its use with custom configurations. +which makes use of a predefined modification of the ConfigBase class which TOML +also uses. If a custom formatter is used that is not inheriting from the from +ConfigBase class `get_config_formatter_base() will return a nullptr if RTTI is +on (usually the default), or garbage if RTTI is off, so some care must be +exercised in its use with custom configurations. ## Custom formats -You can invent a custom format and set that instead of the default INI formatter. You need to inherit from `CLI::Config` and implement the following two functions: +You can invent a custom format and set that instead of the default INI +formatter. You need to inherit from `CLI::Config` and implement the following +two functions: ```cpp std::string to_config(const CLI::App *app, bool default_also, bool, std::string) const; std::vector<CLI::ConfigItem> from_config(std::istream &input) const; ``` -The `CLI::ConfigItem`s that you return are simple structures with a name, a vector of parents, and a vector of results. A optionally customizable `to_flag` method on the formatter lets you change what happens when a ConfigItem turns into a flag. +The `CLI::ConfigItem`s that you return are simple structures with a name, a +vector of parents, and a vector of results. A optionally customizable `to_flag` +method on the formatter lets you change what happens when a ConfigItem turns +into a flag. Finally, set your new class as new config formatter: @@ -195,7 +279,9 @@ Finally, set your new class as new config formatter: app.config_formatter(std::make_shared<NewConfig>()); ``` -See [`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp) for a complete JSON config example. +See +[`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/main/examples/json.cpp) +for a complete JSON config example. ### Trivial JSON configuration example @@ -213,21 +299,40 @@ The parser can handle these structures with only a minor tweak app.get_config_formatter_base()->valueSeparator(':'); ``` -The open and close brackets must be on a separate line and the comma gets interpreted as an array separator but since no values are after the comma they get ignored as well. This will not support multiple layers or sections or any other moderately complex JSON, but can work if the input file is simple. +The open and close brackets must be on a separate line and the comma gets +interpreted as an array separator but since no values are after the comma they +get ignored as well. This will not support multiple layers or sections or any +other moderately complex JSON, but can work if the input file is simple. ## Triggering Subcommands -Configuration files can be used to trigger subcommands if a subcommand is set to configure. By default configuration file just set the default values of a subcommand. But if the `configure()` option is set on a subcommand then the if the subcommand is utilized via a `[subname]` block in the configuration file it will act as if it were called from the command line. Subsubcommands can be triggered via `[subname.subsubname]`. Using the `[[subname]]` will be as if the subcommand were triggered multiple times from the command line. This functionality can allow the configuration file to act as a scripting file. +Configuration files can be used to trigger subcommands if a subcommand is set to +configure. By default configuration file just set the default values of a +subcommand. But if the `configure()` option is set on a subcommand then the if +the subcommand is utilized via a `[subname]` block in the configuration file it +will act as if it were called from the command line. Subsubcommands can be +triggered via `[subname.subsubname]`. Using the `[[subname]]` will be as if the +subcommand were triggered multiple times from the command line. This +functionality can allow the configuration file to act as a scripting file. -For custom configuration files this behavior can be triggered by specifying the parent subcommands in the structure and `++` as the name to open a new subcommand scope and `--` to close it. These names trigger the different callbacks of configurable subcommands. +For custom configuration files this behavior can be triggered by specifying the +parent subcommands in the structure and `++` as the name to open a new +subcommand scope and `--` to close it. These names trigger the different +callbacks of configurable subcommands. ## Stream parsing -In addition to the regular parse functions a `parse_from_stream(std::istream &input)` is available to directly parse a stream operator. For example to process some arguments in an already open file stream. The stream is fed directly in the config parser so bypasses the normal command line parsing. +In addition to the regular parse functions a +`parse_from_stream(std::istream &input)` is available to directly parse a stream +operator. For example to process some arguments in an already open file stream. +The stream is fed directly in the config parser so bypasses the normal command +line parsing. ## Implementation Notes -The config file input works with any form of the option given: Long, short, positional, or the environment variable name. When generating a config file it will create an option name in following priority. +The config file input works with any form of the option given: Long, short, +positional, or the environment variable name. When generating a config file it +will create an option name in following priority. 1. First long name 2. Positional name diff --git a/packages/CLI11/book/chapters/flags.md b/packages/CLI11/book/chapters/flags.md index 4e269acdf73dd1a87cce0f6e1a7c4bd8347aeefd..16134b26a450b2df13a798bdecd2e8fdabcd5976 100644 --- a/packages/CLI11/book/chapters/flags.md +++ b/packages/CLI11/book/chapters/flags.md @@ -1,6 +1,8 @@ # Adding Flags -The most basic addition to a command line program is a flag. This is simply something that does not take any arguments. Adding a flag in CLI11 is done in one of three ways. +The most basic addition to a command line program is a flag. This is simply +something that does not take any arguments. Adding a flag in CLI11 is done in +one of three ways. ## Boolean flags @@ -11,58 +13,93 @@ bool my_flag{false}; app.add_flag("-f", my_flag, "Optional description"); ``` -This will bind the flag `-f` to the boolean `my_flag`. After the parsing step, `my_flag` will be `false` if the flag was not found on the command line, or `true` if it was. By default, it will be allowed any number of times, but if you explicitly\[^1\] request `->take_last(false)`, it will only be allowed once; passing something like `./my_app -f -f` or `./my_app -ff` will throw a `ParseError` with a nice help description. A flag name may start with any character except ('-', ' ', '\n', and '!'). For long flags, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed. +This will bind the flag `-f` to the boolean `my_flag`. After the parsing step, +`my_flag` will be `false` if the flag was not found on the command line, or +`true` if it was. By default, it will be allowed any number of times, but if you +explicitly\[^1\] request `->take_last(false)`, it will only be allowed once; +passing something like `./my_app -f -f` or `./my_app -ff` will throw a +`ParseError` with a nice help description. A flag name may start with any +character except ('-', ' ', '\n', and '!'). For long flags, after the first +character all characters are allowed except ('=',':','{',' ', '\n'). Names are +given as a comma separated string, with the dash or dashes. An flag can have as +many names as you want, and afterward, using `count`, you can use any of the +names, with dashes as needed. ## Integer flags -If you want to allow multiple flags, simply use any integer-like instead of a bool: +If you want to allow multiple flags and count their value, simply use any +integral variables instead of a bool: ```cpp int my_flag{0}; app.add_flag("-f", my_flag, "Optional description"); ``` -After the parsing step, `my_flag` will contain the number of times this flag was found on the command line, including 0 if not found. +After the parsing step, `my_flag` will contain the number of times this flag was +found on the command line, including 0 if not found. + +This behavior can also be controlled manually via +`->multi_option_policy(CLI::MultiOptionPolicy::Sum)` as of version 2.2. ## Arbitrary type flags -CLI11 allows the type of the variable to assign to in the `add_flag` function to be any supported type. This is particularly useful in combination with specifying default values for flags. The allowed types include bool, int, float, vector, enum, or string-like. +CLI11 allows the type of the variable to assign to in the `add_flag` function to +be any supported type. This is particularly useful in combination with +specifying default values for flags. The allowed types include bool, int, float, +vector, enum, or string-like. ### Default Flag Values -Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example: +Flag options specified through the `add_flag*` functions allow a syntax for the +option names to default particular options to a false value or any other value +if some flags are passed. For example: ```cpp app.add_flag("--flag,!--no-flag",result,"help for flag"); ``` -specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is -passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type. An -alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous -example. This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the -default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum -all the given arguments and return the result. This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited). -The default value can be any value. For example if you wished to define a numerical flag: +specifies that if `--flag` is passed on the command line result will be true or +contain a value of 1. If `--no-flag` is passed `result` will contain false or -1 +if `result` is a signed integer type, or 0 if it is an unsigned type. An +alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; +this is equivalent to the previous example. This also works for short form +options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but +an integer value the default behavior is to take the last value given, while if +`variable_to_bind_to` is an integer type the behavior will be to sum all the +given arguments and return the result. This can be modified if needed by +changing the `multi_option_policy` on each flag (this is not inherited). The +default value can be any value. For example if you wished to define a numerical +flag: ```cpp app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag") ``` -using any of those flags on the command line will result in the specified number in the output. Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type. +using any of those flags on the command line will result in the specified number +in the output. Similar things can be done for string values, and enumerations, +as long as the default value can be converted to the given type. ## Pure flags -Every command that starts with `add_`, such as the flag commands, return a pointer to the internally stored `CLI::Option` that describes your addition. If you prefer, you can capture this pointer and use it, and that allows you to skip adding a variable to bind to entirely: +Every command that starts with `add_`, such as the flag commands, return a +pointer to the internally stored `CLI::Option` that describes your addition. If +you prefer, you can capture this pointer and use it, and that allows you to skip +adding a variable to bind to entirely: ```cpp CLI::Option* my_flag = app.add_flag("-f", "Optional description"); ``` -After parsing, you can use `my_flag->count()` to count the number of times this was found. You can also directly use the value (`*my_flag`) as a bool. `CLI::Option` will be discussed in more detail later. +After parsing, you can use `my_flag->count()` to count the number of times this +was found. You can also directly use the value (`*my_flag`) as a bool. +`CLI::Option` will be discussed in more detail later. ## Callback flags -If you want to define a callback that runs when you make a flag, you can use `add_flag_function` (C++11 or newer) or `add_flag` (C++14 or newer only) to add a callback function. The function should have the signature `void(std::size_t)`. This could be useful for a version printout, etc. +If you want to define a callback that runs when you make a flag, you can use +`add_flag_function` (C++11 or newer) or `add_flag` (C++14 or newer only) to add +a callback function. The function should have the signature `void(std::size_t)`. +This could be useful for a version printout, etc. ```cpp auto callback = [](int count){std::cout << "This was called " << count << " times";}; @@ -71,9 +108,15 @@ app.add_flag_function("-c", callback, "Optional description"); ## Aliases -The name string, the first item of every `add_` method, can contain as many short and long names as you want, separated by commas. For example, `"-a,--alpha,-b,--beta"` would allow any of those to be recognized on the command line. If you use the same name twice, or if you use the same name in multiple flags, CLI11 will immediately throw a `CLI::ConstructionError` describing your problem (it will not wait until the parsing step). +The name string, the first item of every `add_` method, can contain as many +short and long names as you want, separated by commas. For example, +`"-a,--alpha,-b,--beta"` would allow any of those to be recognized on the +command line. If you use the same name twice, or if you use the same name in +multiple flags, CLI11 will immediately throw a `CLI::ConstructionError` +describing your problem (it will not wait until the parsing step). -If you want to make an option case insensitive, you can use the `->ignore_case()` method on the `CLI::Option` to do that. For example, +If you want to make an option case insensitive, you can use the +`->ignore_case()` method on the `CLI::Option` to do that. For example, ```cpp bool flag{false}; @@ -120,4 +163,5 @@ Flag int: 3 Flag plain: 1 ``` -\[^1\]: It will not inherit this from the parent defaults, since this is often useful even if you don't want all options to allow multiple passed options. +\[^1\]: It will not inherit this from the parent defaults, since this is often +useful even if you don't want all options to allow multiple passed options. diff --git a/packages/CLI11/book/chapters/formatting.md b/packages/CLI11/book/chapters/formatting.md index f9cd36fa49d875ec3c0741e03e2b6014f5723667..66f0765bb4130fbd2186177e85a079eaf58cf07a 100644 --- a/packages/CLI11/book/chapters/formatting.md +++ b/packages/CLI11/book/chapters/formatting.md @@ -1,21 +1,24 @@ # Formatting help output -{% hint style='info' %} -New in CLI11 1.6 -{% endhint %} +{% hint style='info' %} New in CLI11 1.6 {% endhint %} ## Customizing an existing formatter -In CLI11, you can control the output of the help printout in full or in part. The default formatter was written in such a way as to be customizable. You can use `app.get_formatter()` to get the current formatter. The formatter you set will be inherited by subcommands that are created after you set the formatter. +In CLI11, you can control the output of the help printout in full or in part. +The default formatter was written in such a way as to be customizable. You can +use `app.get_formatter()` to get the current formatter. The formatter you set +will be inherited by subcommands that are created after you set the formatter. There are several configuration options that you can set: -| Set method | Description | Availability | -|------------|-------------|--------------| -| `column_width(width)` | The width of the columns | Both | -| `label(key, value)` | Set a label to a different value | Both | +| Set method | Description | Availability | +| --------------------- | -------------------------------- | ------------ | +| `column_width(width)` | The width of the columns | Both | +| `label(key, value)` | Set a label to a different value | Both | -Labels will map the built in names and type names from key to value if present. For example, if you wanted to change the width of the columns to 40 and the `REQUIRED` label from `(REQUIRED)` to `(MUST HAVE)`: +Labels will map the built in names and type names from key to value if present. +For example, if you wanted to change the width of the columns to 40 and the +`REQUIRED` label from `(REQUIRED)` to `(MUST HAVE)`: ```cpp app.get_formatter()->column_width(40); @@ -24,7 +27,11 @@ app.get_formatter()->label("REQUIRED", "(MUST HAVE)"); ## Subclassing -You can further configure pieces of the code while still keeping most of the formatting intact by subclassing either formatter and replacing any of the methods with your own. The formatters use virtual functions most places, so you are free to add or change anything about them. For example, if you wanted to remove the info that shows up between the option name and the description: +You can further configure pieces of the code while still keeping most of the +formatting intact by subclassing either formatter and replacing any of the +methods with your own. The formatters use virtual functions most places, so you +are free to add or change anything about them. For example, if you wanted to +remove the info that shows up between the option name and the description: ```cpp class MyFormatter : public CLI::Formatter { @@ -34,11 +41,14 @@ class MyFormatter : public CLI::Formatter { app.formatter(std::make_shared<MyFormatter>()); ``` -Look at the class definitions in `FormatterFwd.hpp` or the method definitions in `Formatter.hpp` to see what methods you have access to and how they are put together. +Look at the class definitions in `FormatterFwd.hpp` or the method definitions in +`Formatter.hpp` to see what methods you have access to and how they are put +together. ## Anatomy of a help message -This is a normal printout, with `<>` indicating the methods used to produce each line. +This is a normal printout, with `<>` indicating the methods used to produce each +line. ```text <make_description(app)> @@ -55,9 +65,11 @@ This is a normal printout, with `<>` indicating the methods used to produce each <make_footer(app)> ``` -`make_usage` calls `make_option_usage(opt)` on all the positionals to build that part of the line. `make_subcommand` passes the subcommand as the app pointer. +`make_usage` calls `make_option_usage(opt)` on all the positionals to build that +part of the line. `make_subcommand` passes the subcommand as the app pointer. -The `make_groups` print the group name then call `make_option(o)` on the options listed in that group. The normal printout for an option looks like this: +The `make_groups` print the group name then call `make_option(o)` on the options +listed in that group. The normal printout for an option looks like this: ```text make_option_opts(o) @@ -69,5 +81,6 @@ make_option_name(o,p) make_option_desc(o) Notes: -* `*1`: This signature depends on whether the call is from a positional or optional. -* `o` is opt pointer, `p` is true if positional. +- `*1`: This signature depends on whether the call is from a positional or + optional. +- `o` is opt pointer, `p` is true if positional. diff --git a/packages/CLI11/book/chapters/installation.md b/packages/CLI11/book/chapters/installation.md index c7bcc18f3a90594705be88b246fe2f532aa6ce49..c8af7dfa2fcb46ff66c174ba1f7ceb80b0bdf491 100644 --- a/packages/CLI11/book/chapters/installation.md +++ b/packages/CLI11/book/chapters/installation.md @@ -6,7 +6,10 @@ #include <CLI11.hpp> ``` -This example uses the single file edition of CLI11. You can download `CLI11.hpp` from the latest release and put it into the same folder as your source code, then compile this with C++ enabled. For a larger project, you can just put this in an include folder and you are set. +This example uses the single file edition of CLI11. You can download `CLI11.hpp` +from the latest release and put it into the same folder as your source code, +then compile this with C++ enabled. For a larger project, you can just put this +in an include folder and you are set. ## Full edition @@ -14,27 +17,42 @@ This example uses the single file edition of CLI11. You can download `CLI11.hpp` #include <CLI/CLI.hpp> ``` -If you want to use CLI11 in its full form, you can also use the original multiple file edition. This has an extra utility (`Timer`), and is does not require that you use a release. The only change to your code would be the include shown above. +If you want to use CLI11 in its full form, you can also use the original +multiple file edition. This has an extra utility (`Timer`), and is does not +require that you use a release. The only change to your code would be the +include shown above. ### CMake support for the full edition -If you use CMake 3.4+ for your project (highly recommended), CLI11 comes with a powerful CMakeLists.txt file that was designed to also be used with `add_subproject`. You can add the repository to your code (preferably as a git submodule), then add the following line to your project (assuming your folder is called CLI11): +If you use CMake 3.4+ for your project (highly recommended), CLI11 comes with a +powerful CMakeLists.txt file that was designed to also be used with +`add_subproject`. You can add the repository to your code (preferably as a git +submodule), then add the following line to your project (assuming your folder is +called CLI11): ```cmake add_subdirectory(CLI11) ``` -Then, you will have a target `CLI11::CLI11` that you can link to with `target_link_libraries`. It will provide the include paths you need for the library. This is the way [GooFit](https://github.com/GooFit/GooFit) uses CLI11, for example. +Then, you will have a target `CLI11::CLI11` that you can link to with +`target_link_libraries`. It will provide the include paths you need for the +library. This is the way [GooFit](https://github.com/GooFit/GooFit) uses CLI11, +for example. -You can also configure and optionally install CLI11, and CMake will create the necessary `lib/cmake/CLI11/CLI11Config.cmake` files, so `find_package(CLI11 CONFIG REQUIRED)` also works. +You can also configure and optionally install CLI11, and CMake will create the +necessary `lib/cmake/CLI11/CLI11Config.cmake` files, so +`find_package(CLI11 CONFIG REQUIRED)` also works. If you use conan.io, CLI11 supports that too. ### Running tests on the full edition -CLI11 has examples and tests that can be accessed using a CMake build on any platform. Simply build and run ctest to run the 200+ tests to ensure CLI11 works on your system. +CLI11 has examples and tests that can be accessed using a CMake build on any +platform. Simply build and run ctest to run the 200+ tests to ensure CLI11 works +on your system. -As an example of the build system, the following code will download and test CLI11 in a simple Alpine Linux docker container [^1]: +As an example of the build system, the following code will download and test +CLI11 in a simple Alpine Linux docker container [^1]: ```term gitbook:~ $ docker run -it alpine @@ -78,15 +96,19 @@ Test project /CLI11/build Total Test time (real) = 0.34 sec ``` -For the curious, the CMake options and defaults are listed below. Most options default to off if CLI11 is used as a subdirectory in another project. +For the curious, the CMake options and defaults are listed below. Most options +default to off if CLI11 is used as a subdirectory in another project. -| Option | Description | -|--------|-------------| -| `CLI11_SINGLE_FILE=ON` | Build the `CLI11.hpp` file from the sources. Requires Python (version 3 or 2.7). | -| `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well | -| `CLI11_EXAMPLES=ON` | Build the example programs. | -| `CLI11_TESTING=ON` | Build the tests. | -| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. | +| Option | Description | +| ----------------------------- | ----------------------------------------------------------------------------------------------- | +| `CLI11_SINGLE_FILE=ON` | Build the `CLI11.hpp` file from the sources. Requires Python (version 3 or 2.7). | +| `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well | +| `CLI11_EXAMPLES=ON` | Build the example programs. | +| `CLI11_TESTING=ON` | Build the tests. | +| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. | | `CLI11_CLANG_TIDY_OPTIONS=""` | Options to pass to `clang-tidy`, such as `-fix` (single threaded build only if applying fixes!) | -[^1]: Docker is being used to create a pristine disposable environment; there is nothing special about this container. Alpine is being used because it is small, modern, and fast. Commands are similar on any other platform. +[^1]: + Docker is being used to create a pristine disposable environment; there is + nothing special about this container. Alpine is being used because it is + small, modern, and fast. Commands are similar on any other platform. diff --git a/packages/CLI11/book/chapters/internals.md b/packages/CLI11/book/chapters/internals.md index 1551c79c659bb91610448b762c13d42ea1f08831..f8479c545fe4489741041f8127d3fab8ee602165 100644 --- a/packages/CLI11/book/chapters/internals.md +++ b/packages/CLI11/book/chapters/internals.md @@ -2,7 +2,8 @@ ## Callbacks -The library was designed to bind to existing variables without requiring typed classes or inheritance. This is accomplished through lambda functions. +The library was designed to bind to existing variables without requiring typed +classes or inheritance. This is accomplished through lambda functions. This looks like: @@ -14,30 +15,40 @@ Option* add_option(string name, T item) { } ``` -Obviously, you can't access `T` after the `add_` method is over, so it stores the string representation of the default value if it receives the special `true` value as the final argument (not shown above). +Obviously, you can't access `T` after the `add_` method is over, so it stores +the string representation of the default value if it receives the special `true` +value as the final argument (not shown above). ## Parsing Parsing follows the following procedure: -1. `_validate`: Make sure the defined options are self consistent. +1. `_validate`: Make sure the defined options and subcommands are self + consistent. 2. `_parse`: Main parsing routine. See below. 3. `_run_callback`: Run an App callback if present. The parsing phase is the most interesting: -1. `_parse_single`: Run on each entry on the command line and fill the options/subcommands. +1. `_parse_single`: Run on each entry on the command line and fill the + options/subcommands. 2. `_process`: Run the procedure listed below. -3. `_process_extra`: This throws an error if needed on extra arguments that didn't fit in the parse. +3. `_process_extra`: This throws an error if needed on extra arguments that + didn't fit in the parse. -The `_process` procedure runs the following steps; each step is recursive and completes all subcommands before moving to the next step (new in 1.7). This ensures that interactions between options and subcommand options is consistent. +The `_process` procedure runs the following steps; each step is recursive and +completes all subcommands before moving to the next step (new in 1.7). This +ensures that interactions between options and subcommand options is consistent. 1. `_process_ini`: This reads an INI file and fills/changes options as needed. 2. `_process_env`: Look for environment variables. -3. `_process_callbacks`: Run the callback functions - this fills out the variables. +3. `_process_callbacks`: Run the callback functions - this fills out the + variables. 4. `_process_help_flags`: Run help flags if present (and quit). -5. `_process_requirements`: Make sure needs/excludes, required number of options present. +5. `_process_requirements`: Make sure needs/excludes, required number of options + present. ## Exceptions -The library immediately returns a C++ exception when it detects a problem, such as an incorrect construction or a malformed command line. +The library immediately returns a C++ exception when it detects a problem, such +as an incorrect construction or a malformed command line. diff --git a/packages/CLI11/book/chapters/options.md b/packages/CLI11/book/chapters/options.md index 8b1daa0fffe546677b3b8f40b280e7961c95dc69..39447113b4a7fde4660139f6b11b673e8e75351f 100644 --- a/packages/CLI11/book/chapters/options.md +++ b/packages/CLI11/book/chapters/options.md @@ -2,64 +2,97 @@ ## Simple options -The most versatile addition to a command line program is a option. This is like a flag, but it takes an argument. CLI11 handles all the details for many types of options for you, based on their type. To add an option: +The most versatile addition to a command line program is an option. This is like +a flag, but it takes an argument. CLI11 handles all the details for many types +of options for you, based on their type. To add an option: ```cpp int int_option{0}; app.add_option("-i", int_option, "Optional description"); ``` -This will bind the option `-i` to the integer `int_option`. On the command line, a single value that can be converted to an integer will be expected. Non-integer results will fail. If that option is not given, CLI11 will not touch the initial value. This allows you to set up defaults by simply setting your value beforehand. If you want CLI11 to display your default value, you can add `->capture_default_str()` after the option. +This will bind the option `-i` to the integer `int_option`. On the command line, +a single value that can be converted to an integer will be expected. Non-integer +results will fail. If that option is not given, CLI11 will not touch the initial +value. This allows you to set up defaults by simply setting your value +beforehand. If you want CLI11 to display your default value, you can add +`->capture_default_str()` after the option. ```cpp int int_option{0}; app.add_option("-i", int_option, "Optional description")->capture_default_str(); ``` -You can use any C++ int-like type, not just `int`. CLI11 understands the following categories of types: - -| Type | CLI11 | -|-------------|-------| -| number like | Integers, floats, bools, or any type that can be constructed from an integer or floating point number. Accepts common numerical strings like `0xFF` as well as octal, and decimal | -| string-like | std\::string, or anything that can be constructed from or assigned a std\::string | -| char | For a single char, single string values are accepted, otherwise longer strings are treated as integral values and a conversion is attempted | -| complex-number | std::complex or any type which has a real(), and imag() operations available, will allow 1 or 2 string definitions like "1+2j" or two arguments "1","2" | -| enumeration | any enum or enum class type is supported through conversion from the underlying type(typically int, though it can be specified otherwise) | -| container-like | a container(like vector) of any available types including other containers | -| wrapper | any other object with a `value_type` static definition where the type specified by `value_type` is one of the type in this list, including `std::atomic<>` | -| tuple | a tuple, pair, or array, or other type with a tuple size and tuple_type operations defined and the members being a type contained in this list | -| function | A function that takes an array of strings and returns a string that describes the conversion failure or empty for success. May be the empty function. (`{}`) | -| streamable | any other type with a `<<` operator will also work | - -By default, CLI11 will assume that an option is optional, and one value is expected if you do not use a vector. You can change this on a specific option using option modifiers. An option name may start with any character except ('-', ' ', '\n', and '!'). For long options, after the first character all characters are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated string, with the dash or dashes. An option can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form. +You can use any C++ int-like type, not just `int`. CLI11 understands the +following categories of types: + +| Type | CLI11 | +| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| number like | Integers, floats, bools, or any type that can be constructed from an integer or floating point number. Accepts common numerical strings like `0xFF` as well as octal, and decimal | +| string-like | std::string, or anything that can be constructed from or assigned a std::string | +| char | For a single char, single string values are accepted, otherwise longer strings are treated as integral values and a conversion is attempted | +| complex-number | std::complex or any type which has a real(), and imag() operations available, will allow 1 or 2 string definitions like "1+2j" or two arguments "1","2" | +| enumeration | any enum or enum class type is supported through conversion from the underlying type(typically int, though it can be specified otherwise) | +| container-like | a container(like vector) of any available types including other containers | +| wrapper | any other object with a `value_type` static definition where the type specified by `value_type` is one of the type in this list, including `std::atomic<>` | +| tuple | a tuple, pair, or array, or other type with a tuple size and tuple_type operations defined and the members being a type contained in this list | +| function | A function that takes an array of strings and returns a string that describes the conversion failure or empty for success. May be the empty function. (`{}`) | +| streamable | any other type with a `<<` operator will also work | + +By default, CLI11 will assume that an option is optional, and one value is +expected if you do not use a vector. You can change this on a specific option +using option modifiers. An option name may start with any character except ('-', +' ', '\n', and '!'). For long options, after the first character all characters +are allowed except ('=',':','{',' ', '\n'). Names are given as a comma separated +string, with the dash or dashes. An option can have as many names as you want, +and afterward, using `count`, you can use any of the names, with dashes as +needed, to count the options. One of the names is allowed to be given without +proceeding dash(es); if present the option is a positional option, and that name +will be used on the help line for its positional form. ## Positional options and aliases -When you give an option on the command line without a name, that is a positional option. Positional options are accepted in the same order they are defined. So, for example: +When you give an option on the command line without a name, that is a positional +option. Positional options are accepted in the same order they are defined. So, +for example: ```term gitbook:examples $ ./a.out one --two three four ``` -The string `one` would have to be the first positional option. If `--two` is a flag, then the remaining two strings are positional. If `--two` is a one-argument option, then `four` is the second positional. If `--two` accepts two or more arguments, then there are no more positionals. +The string `one` would have to be the first positional option. If `--two` is a +flag, then the remaining two strings are positional. If `--two` is a +one-argument option, then `four` is the second positional. If `--two` accepts +two or more arguments, then there are no more positionals. -To make a positional option, you simply give CLI11 one name that does not start with a dash. You can have as many (non-overlapping) names as you want for an option, but only one positional name. So the following name string is valid: +To make a positional option, you simply give CLI11 one name that does not start +with a dash. You can have as many (non-overlapping) names as you want for an +option, but only one positional name. So the following name string is valid: ```cpp "-a,-b,--alpha,--beta,mypos" ``` -This would make two short option aliases, two long option alias, and the option would be also be accepted as a positional. +This would make two short option aliases, two long option alias, and the option +would be also be accepted as a positional. ## Containers of options -If you use a vector or other container instead of a plain option, you can accept more than one value on the command line. By default, a container accepts as many options as possible, until the next value that could be a valid option name. You can specify a set number using an option modifier `->expected(N)`. (The default unlimited behavior on vectors is restored with `N=-1`) CLI11 does not differentiate between these two methods for unlimited acceptance options. +If you use a vector or other container instead of a plain option, you can accept +more than one value on the command line. By default, a container accepts as many +options as possible, until the next value that could be a valid option name. You +can specify a set number using an option modifier `->expected(N)`. (The default +unlimited behavior on vectors is restored with `N=-1`) CLI11 does not +differentiate between these two methods for unlimited acceptance options. -| Separate names | Combined names | -|-------------------|-----------------| -| `--vec 1 --vec 2` | `--vec 1 2` | +| Separate names | Combined names | +| ----------------- | -------------- | +| `--vec 1 --vec 2` | `--vec 1 2` | -It is also possible to specify a minimum and maximum number through `->expected(Min,Max)`. It is also possible to specify a min and max type size for the elements of the container. It most cases these values will be automatically determined but a user can manually restrict them. +It is also possible to specify a minimum and maximum number through +`->expected(Min,Max)`. It is also possible to specify a min and max type size +for the elements of the container. It most cases these values will be +automatically determined but a user can manually restrict them. An example of setting up a vector option: @@ -68,9 +101,48 @@ std::vector<int> int_vec; app.add_option("--vec", int_vec, "My vector option"); ``` -Vectors will be replaced by the parsed content if the option is given on the command line. +Vectors will be replaced by the parsed content if the option is given on the +command line. + +A definition of a container for purposes of CLI11 is a type with a `end()`, +`insert(...)`, `clear()` and `value_type` definitions. This includes `vector`, +`set`, `deque`, `list`, `forward_iist`, `map`, `unordered_map` and a few others +from the standard library, and many other containers from the boost library. + +### Empty containers + +By default a container will never return an empty container. If it is desired to +allow an empty container to be returned, then the option must be modified with a +0 as the minimum expected value + +```cpp +std::vector<int> int_vec; +app.add_option("--vec", int_vec, "Empty vector allowed")->expected(0,-1); +``` + +An empty vector can than be specified on the command line as `--vec {}` + +To allow an empty vector from config file, the default must be set in addition +to the above modification. + +```cpp +std::vector<int> int_vec; +app.add_option("--vec", int_vec, "Empty vector allowed")->expected(0,-1)->default_str("{}"); +``` + +Then in the file + +```toml +vec={} +``` + +or + +```toml +vec=[] +``` -A definition of a container for purposes of CLI11 is a type with a `end()`, `insert(...)`, `clear()` and `value_type` definitions. This includes `vector`, `set`, `deque`, `list`, `forward_iist`, `map`, `unordered_map` and a few others from the standard library, and many other containers from the boost library. +will generate an empty vector in `int_vec`. ### Containers of containers @@ -81,13 +153,20 @@ std::vector<std::vector<int>> int_vec; app.add_option("--vec", int_vec, "My vector of vectors option"); ``` -CLI11 inserts a separator sequence at the start of each argument call to separate the vectors. So unless the separators are injected as part of the command line each call of the option on the command line will result in a separate element of the outer vector. This can be manually controlled via `inject_separator(true|false)` but in nearly all cases this should be left to the defaults. To insert of a separator from the command line add a `%%` where the separation should occur. +CLI11 inserts a separator sequence at the start of each argument call to +separate the vectors. So unless the separators are injected as part of the +command line each call of the option on the command line will result in a +separate element of the outer vector. This can be manually controlled via +`inject_separator(true|false)` but in nearly all cases this should be left to +the defaults. To insert of a separator from the command line add a `%%` where +the separation should occur. ```bash cmd --vec_of_vec 1 2 3 4 %% 1 2 ``` -would then result in a container of size 2 with the first element containing 4 values and the second 2. +would then result in a container of size 2 with the first element containing 4 +values and the second 2. This separator is also the only way to get values into something like @@ -98,7 +177,8 @@ app.add_option("--vec", two_vecs, "pair of vectors"); without calling the argument twice. -Further levels of nesting containers should compile but intermediate layers will only have a single element in the container, so is probably not that useful. +Further levels of nesting containers should compile but intermediate layers will +only have a single element in the container, so is probably not that useful. ### Nested types @@ -109,60 +189,71 @@ std::map<int, std::pair<int,std::string>> map; app.add_option("--dict", map, "map of pairs"); ``` -will require 3 arguments for each invocation, and multiple sets of 3 arguments can be entered for a single invocation on the command line. +will require 3 arguments for each invocation, and multiple sets of 3 arguments +can be entered for a single invocation on the command line. ```cpp std::map<int, std::pair<int,std::vector<std::string>>> map; app.add_option("--dict", map, "map of pairs"); ``` -will result in a requirement for 2 integers on each invocation and absorb an unlimited number of strings including 0. +will result in a requirement for 2 integers on each invocation and absorb an +unlimited number of strings including 0. ## Option modifiers -When you call `add_option`, you get a pointer to the added option. You can use that to add option modifiers. A full listing of the option modifiers: - -| Modifier | Description | -|----------|-------------| -| `->required()` | The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works. | -| `->expected(N)` | Take `N` values instead of as many as possible, mainly for vector args. | -| `->expected(Nmin,Nmax)` | Take between `Nmin` and `Nmax` values. | -| `->type_size(N)` | specify that each block of values would consist of N elements | -| `->type_size(Nmin,Nmax)` | specify that each block of values would consist of between Nmin and Nmax elements | -| `->needs(opt)` | This option requires another option to also be present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_needs(opt)` | -| `->excludes(opt)` | This option cannot be given with `opt` present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_excludes(opt)` | -| `->envname(name)` | Gets the value from the environment if present and not passed on the command line. | -| `->group(name)` | The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `"Hidden"` will not show up in the help print. | -| `->description(string)` | Set/change the description | -| `->ignore_case()` | Ignore the case on the command line (also works on subcommands, does not affect arguments). | -| `->ignore_underscore()` | Ignore any underscores on the command line (also works on subcommands, does not affect arguments). | -| `->allow_extra_args()` | Allow extra argument values to be included when an option is passed. Enabled by default for vector options. | -| `->disable_flag_override()` | specify that flag options cannot be overridden on the command line use `=<newval>` | -| `->delimiter('<CH>')` | specify a character that can be used to separate elements in a command line argument, default is <none>, common values are ',', and ';' | -| `->multi_option_policy( CLI::MultiOptionPolicy::Throw)` | Sets the policy for handling multiple arguments if the option was received on the command line several times. `Throw`ing an error is the default, but `TakeLast`, `TakeFirst`, `TakeAll`, and `Join` are also available. See the next four lines for shortcuts to set this more easily. | -| `->take_last()` | Only use the last option if passed several times. This is always true by default for bool options, regardless of the app default, but can be set to false explicitly with `->multi_option_policy()`. | -| `->take_first()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeFirst)` | -| `->take_all()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeAll)` | -| `->join()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses newlines or the specified delimiter to join all arguments into a single string output. | -| `->join(delim)` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses `delim` to join all arguments into a single string output. this also sets the delimiter | -| `->check(Validator)` | perform a check on the returned results to verify they meet some criteria. See [Validators](./validators.md) for more info | -| `->transform(Validator)` | Run a transforming validator on each value passed. See [Validators](./validators.md) for more info | -| `->each(void(std::string))` | Run a function on each parsed value, *in order*. | -| `->default_str(string)` | set a default string for use in the help and as a default value if no arguments are passed and a value is requested | -| `->default_function(std::string())` | Advanced: Change the function that `capture_default_str()` uses. | -| `->default_val(value)` | Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). | -| `->capture_default_str()` | Store the current value attached and display it in the help string. | -| `->always_capture_default()` | Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. | -| `->run_callback_for_default()` | Force the option callback to be executed or the variable set when the `default_val` is used. | -| `->force_callback()` | Force the option callback to be executed regardless of whether the option was used or not. Will use the default_str if available, if no default is given the callback will be executed with an empty string as an argument, which will translate to a default initialized value, which can be compiler dependent | -|`->trigger_on_parse()` | Have the option callback be triggered when the value is parsed vs. at the end of all parsing, the option callback can potentially be executed multiple times. Generally only useful if you have a user defined callback or validation check. Or potentially if a vector input is given multiple times as it will clear the results when a repeat option is given via command line. It will trigger the callbacks once per option call on the command line| -| `->option_text(string)` | Sets the text between the option name and description. | - -The `->check(...)` and `->transform(...)` modifiers can also take a callback function of the form `bool function(std::string)` that runs on every value that the option receives, and returns a value that tells CLI11 whether the check passed or failed. +When you call `add_option`, you get a pointer to the added option. You can use +that to add option modifiers. A full listing of the option modifiers: + +| Modifier | Description | +| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `->required()` | The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works. | +| `->expected(N)` | Take `N` values instead of as many as possible, mainly for vector args. | +| `->expected(Nmin,Nmax)` | Take between `Nmin` and `Nmax` values. | +| `->type_size(N)` | specify that each block of values would consist of N elements | +| `->type_size(Nmin,Nmax)` | specify that each block of values would consist of between Nmin and Nmax elements | +| `->needs(opt)` | This option requires another option to also be present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_needs(opt)` | +| `->excludes(opt)` | This option cannot be given with `opt` present, opt is an `Option` pointer or a string with the name of the option. Can be removed with `->remove_excludes(opt)` | +| `->envname(name)` | Gets the value from the environment if present and not passed on the command line. | +| `->group(name)` | The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `"Hidden"` will not show up in the help print. | +| `->description(string)` | Set/change the description | +| `->ignore_case()` | Ignore the case on the command line (also works on subcommands, does not affect arguments). | +| `->ignore_underscore()` | Ignore any underscores on the command line (also works on subcommands, does not affect arguments). | +| `->allow_extra_args()` | Allow extra argument values to be included when an option is passed. Enabled by default for vector options. | +| `->disable_flag_override()` | specify that flag options cannot be overridden on the command line use `=<newval>` | +| `->delimiter('<CH>')` | specify a character that can be used to separate elements in a command line argument, default is <none>, common values are ',', and ';' | +| `->multi_option_policy( CLI::MultiOptionPolicy::Throw)` | Sets the policy for handling multiple arguments if the option was received on the command line several times. `Throw`ing an error is the default, but `TakeLast`, `TakeFirst`, `TakeAll`, `Join`, and `Sum` are also available. See the next four lines for shortcuts to set this more easily. | +| `->take_last()` | Only use the last option if passed several times. This is always true by default for bool options, regardless of the app default, but can be set to false explicitly with `->multi_option_policy()`. | +| `->take_first()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeFirst)` | +| `->take_all()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::TakeAll)` | +| `->join()` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses newlines or the specified delimiter to join all arguments into a single string output. | +| `->join(delim)` | sets `->multi_option_policy(CLI::MultiOptionPolicy::Join)`, which uses `delim` to join all arguments into a single string output. this also sets the delimiter | +| `->check(Validator)` | perform a check on the returned results to verify they meet some criteria. See [Validators](./validators.md) for more info | +| `->transform(Validator)` | Run a transforming validator on each value passed. See [Validators](./validators.md) for more info | +| `->each(void(std::string))` | Run a function on each parsed value, _in order_. | +| `->default_str(string)` | set a default string for use in the help and as a default value if no arguments are passed and a value is requested | +| `->default_function(std::string())` | Advanced: Change the function that `capture_default_str()` uses. | +| `->default_val(value)` | Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). | +| `->capture_default_str()` | Store the current value attached and display it in the help string. | +| `->always_capture_default()` | Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. | +| `->run_callback_for_default()` | Force the option callback to be executed or the variable set when the `default_val` is used. | +| `->force_callback()` | Force the option callback to be executed regardless of whether the option was used or not. Will use the default_str if available, if no default is given the callback will be executed with an empty string as an argument, which will translate to a default initialized value, which can be compiler dependent | +| `->trigger_on_parse()` | Have the option callback be triggered when the value is parsed vs. at the end of all parsing, the option callback can potentially be executed multiple times. Generally only useful if you have a user defined callback or validation check. Or potentially if a vector input is given multiple times as it will clear the results when a repeat option is given via command line. It will trigger the callbacks once per option call on the command line | +| `->option_text(string)` | Sets the text between the option name and description. | + +The `->check(...)` and `->transform(...)` modifiers can also take a callback +function of the form `bool function(std::string)` that runs on every value that +the option receives, and returns a value that tells CLI11 whether the check +passed or failed. ## Using the `CLI::Option` pointer -Each of the option creation mechanisms returns a pointer to the internally stored option. If you save that pointer, you can continue to access the option, and change setting on it later. The Option object can also be converted to a bool to see if it was passed, or `->count()` can be used to see how many times the option was passed. Since flags are also options, the same methods work on them. +Each of the option creation mechanisms returns a pointer to the internally +stored option. If you save that pointer, you can continue to access the option, +and change setting on it later. The Option object can also be converted to a +bool to see if it was passed, or `->count()` can be used to see how many times +the option was passed. Since flags are also options, the same methods work on +them. ```cpp CLI::Option* opt = app.add_flag("--opt"); @@ -175,17 +266,33 @@ if(* opt) ## Inheritance of defaults -One of CLI11's systems to allow customizability without high levels of verbosity is the inheritance system. You can set default values on the parent `App`, and all options and subcommands created from it remember the default values at the point of creation. The default value for Options, specifically, are accessible through the `option_defaults()` method. There are a number of settings that can be set and inherited: - -* `group`: The group name starts as "Options" -* `required`: If the option must be given. Defaults to `false`. Is ignored for flags. -* `multi_option_policy`: What to do if several copies of an option are passed and one value is expected. Defaults to `CLI::MultiOptionPolicy::Throw`. This is also used for bool flags, but they always are created with the value `CLI::MultiOptionPolicy::TakeLast` regardless of the default, so that multiple bool flags does not cause an error. But you can override that flag by flag. -* `ignore_case`: Allow any mixture of cases for the option or flag name -* `ignore_underscore`: Allow any number of underscores in the option or flag name -* `configurable`: Specify whether an option can be configured through a config file -* `disable_flag_override`: do not allow flag values to be overridden on the command line -* `always_capture_default`: specify that the default values should be automatically captured. -* `delimiter`: A delimiter to use for capturing multiple values in a single command line string (e.g. --flag="flag,-flag2,flag3") +One of CLI11's systems to allow customizability without high levels of verbosity +is the inheritance system. You can set default values on the parent `App`, and +all options and subcommands created from it remember the default values at the +point of creation. The default value for Options, specifically, are accessible +through the `option_defaults()` method. There are a number of settings that can +be set and inherited: + +- `group`: The group name starts as "Options" +- `required`: If the option must be given. Defaults to `false`. Is ignored for + flags. +- `multi_option_policy`: What to do if several copies of an option are passed + and one value is expected. Defaults to `CLI::MultiOptionPolicy::Throw`. This + is also used for bool flags, but they always are created with the value + `CLI::MultiOptionPolicy::TakeLast` or `CLI::MultiOptionPolicy::Sum` regardless + of the default, so that multiple bool flags does not cause an error. But you + can override that setting by calling the `multi_option_policy` directly. +- `ignore_case`: Allow any mixture of cases for the option or flag name +- `ignore_underscore`: Allow any number of underscores in the option or flag + name +- `configurable`: Specify whether an option can be configured through a config + file +- `disable_flag_override`: do not allow flag values to be overridden on the + command line +- `always_capture_default`: specify that the default values should be + automatically captured. +- `delimiter`: A delimiter to use for capturing multiple values in a single + command line string (e.g. --flag="flag,-flag2,flag3") An example of usage: @@ -196,24 +303,38 @@ app.add_flag("--CaSeLeSs"); app.get_group() // is "Required" ``` -Groups are mostly for visual organization, but an empty string for a group name will hide the option. +Groups are mostly for visual organization, but an empty string for a group name +will hide the option. ### Windows style options -You can also set the app setting `app->allow_windows_style_options()` to allow windows style options to also be recognized on the command line: +You can also set the app setting `app->allow_windows_style_options()` to allow +windows style options to also be recognized on the command line: -* `/a` (flag) -* `/f filename` (option) -* `/long` (long flag) -* `/file filename` (space) -* `/file:filename` (colon) -* `/long_flag:false` (long flag with : to override the default value) +- `/a` (flag) +- `/f filename` (option) +- `/long` (long flag) +- `/file filename` (space) +- `/file:filename` (colon) +- `/long_flag:false` (long flag with : to override the default value) -Windows style options do not allow combining short options or values not separated from the short option like with `-` options. You still specify option names in the same manner as on Linux with single and double dashes when you use the `add_*` functions, and the Linux style on the command line will still work. If a long and a short option share the same name, the option will match on the first one defined. +Windows style options do not allow combining short options or values not +separated from the short option like with `-` options. You still specify option +names in the same manner as on Linux with single and double dashes when you use +the `add_*` functions, and the Linux style on the command line will still work. +If a long and a short option share the same name, the option will match on the +first one defined. ## Parse configuration -How an option and its arguments are parsed depends on a set of controls that are part of the option structure. In most circumstances these controls are set automatically based on the type or function used to create the option and the type the arguments are parsed into. The variables define the size of the underlying type (essentially how many strings make up the type), the expected size (how many groups are expected) and a flag indicating if multiple groups are allowed with a single option. And these interact with the `multi_option_policy` when it comes time to parse. +How an option and its arguments are parsed depends on a set of controls that are +part of the option structure. In most circumstances these controls are set +automatically based on the type or function used to create the option and the +type the arguments are parsed into. The variables define the size of the +underlying type (essentially how many strings make up the type), the expected +size (how many groups are expected) and a flag indicating if multiple groups are +allowed with a single option. And these interact with the `multi_option_policy` +when it comes time to parse. ### Examples @@ -224,7 +345,12 @@ std::string val; app.add_option("--opt",val,"description"); ``` -creates an option that assigns a value to a `std::string` When this option is constructed it sets a type_size min and max of 1. Meaning that the assignment uses a single string. The Expected size is also set to 1 by default, and `allow_extra_args` is set to false. meaning that each time this option is called 1 argument is expected. This would also be the case if val were a `double`, `int` or any other single argument types. +creates an option that assigns a value to a `std::string` When this option is +constructed it sets a type_size min and max of 1. Meaning that the assignment +uses a single string. The Expected size is also set to 1 by default, and +`allow_extra_args` is set to false. meaning that each time this option is called +1 argument is expected. This would also be the case if val were a `double`, +`int` or any other single argument types. now for example @@ -233,35 +359,49 @@ std::pair<int, std::string> val; app.add_option("--opt",val,"description"); ``` -In this case the typesize is automatically detected to be 2 instead of 1, so the parsing would expect 2 arguments associated with the option. +In this case the typesize is automatically detected to be 2 instead of 1, so the +parsing would expect 2 arguments associated with the option. ```cpp std::vector<int> val; app.add_option("--opt",val,"description"); ``` -detects a type size of 1, since the underlying element type is a single string, so the minimum number of strings is 1. But since it is a vector the expected number can be very big. The default for a vector is (1<<30), and the allow_extra_args is set to true. This means that at least 1 argument is expected to follow the option, but arbitrary numbers of arguments may follow. These are checked if they have the form of an option but if not they are added to the argument. +detects a type size of 1, since the underlying element type is a single string, +so the minimum number of strings is 1. But since it is a vector the expected +number can be very big. The default for a vector is (1<<30), and the +allow_extra_args is set to true. This means that at least 1 argument is expected +to follow the option, but arbitrary numbers of arguments may follow. These are +checked if they have the form of an option but if not they are added to the +argument. ```cpp std::vector<std::tuple<int, double, std::string>> val; app.add_option("--opt",val,"description"); ``` -gets into the complicated cases where the type size is now 3. and the expected max is set to a large number and `allow_extra_args` is set to true. In this case at least 3 arguments are required to follow the option, and subsequent groups must come in groups of three, otherwise an error will result. +gets into the complicated cases where the type size is now 3. and the expected +max is set to a large number and `allow_extra_args` is set to true. In this case +at least 3 arguments are required to follow the option, and subsequent groups +must come in groups of three, otherwise an error will result. ```cpp bool val{false}; app.add_flag("--opt",val,"description"); ``` -Using the add_flag methods for creating options creates an option with an expected size of 0, implying no arguments can be passed. +Using the add_flag methods for creating options creates an option with an +expected size of 0, implying no arguments can be passed. ```cpp std::complex<double> val; app.add_option("--opt",val,"description"); ``` -triggers the complex number type which has a min of 1 and max of 2, so 1 or 2 strings can be passed. Complex number conversion supports arguments of the form "1+2j" or "1","2", or "1" "2i". The imaginary number symbols `i` and `j` are interchangeable in this context. +triggers the complex number type which has a min of 1 and max of 2, so 1 or 2 +strings can be passed. Complex number conversion supports arguments of the form +"1+2j" or "1","2", or "1" "2i". The imaginary number symbols `i` and `j` are +interchangeable in this context. ```cpp std::vector<std::vector<int>> val; @@ -272,7 +412,9 @@ has a type size of 1 to (1<<30). ### Customization -The `type_size(N)`, `type_size(Nmin, Nmax)`, `expected(N)`, `expected(Nmin,Nmax)`, and `allow_extra_args()` can be used to customize an option. For example +The `type_size(N)`, `type_size(Nmin, Nmax)`, `expected(N)`, +`expected(Nmin,Nmax)`, and `allow_extra_args()` can be used to customize an +option. For example ```cpp std::string val; @@ -280,12 +422,38 @@ auto opt=app.add_flag("--opt{vvv}",val,"description"); opt->expected(0,1); ``` -will create a hybrid option, that can exist on its own in which case the value "vvv" is used or if a value is given that value will be used. +will create a hybrid option, that can exist on its own in which case the value +"vvv" is used or if a value is given that value will be used. + +There are some additional options that can be specified to modify an option for +specific cases: + +- `->run_callback_for_default()` will specify that the callback should be + executed when a default_val is set. This is set automatically when appropriate + though it can be turned on or off and any user specified callback for an + option will be executed when the default value for an option is set. -There are some additional options that can be specified to modify an option for specific cases: +- `->force_callback()` will for the callback/value assignment to run at the + conclusion of parsing regardless of whether the option was supplied or not. + This can be used to force the default or execute some code. -* `->run_callback_for_default()` will specify that the callback should be executed when a default_val is set. This is set automatically when appropriate though it can be turned on or off and any user specified callback for an option will be executed when the default value for an option is set. +- `->trigger_on_parse()` will trigger the callback or value assignment each time + the argument is passed. The value is reset if the option is supplied multiple + times. ## Unusual circumstances -There are a few cases where some things break down in the type system managing options and definitions. Using the `add_option` method defines a lambda function to extract a default value if required. In most cases this is either straightforward or a failure is detected automatically and handled. But in a few cases a streaming template is available that several layers down may not actually be defined. This results in CLI11 not being able to detect this circumstance automatically and will result in compile error. One specific known case is `boost::optional` if the boost optional_io header is included. This header defines a template for all boost optional values even if they do not actually have a streaming operator. For example `boost::optional<std::vector>` does not have a streaming operator but one is detected since it is part of a template. For these cases a secondary method `app->add_option_no_stream(...)` is provided that bypasses this operation completely and should compile in these cases. +There are a few cases where some things break down in the type system managing +options and definitions. Using the `add_option` method defines a lambda function +to extract a default value if required. In most cases this is either +straightforward or a failure is detected automatically and handled. But in a few +cases a streaming template is available that several layers down may not +actually be defined. This results in CLI11 not being able to detect this +circumstance automatically and will result in compile error. One specific known +case is `boost::optional` if the boost optional_io header is included. This +header defines a template for all boost optional values even if they do not +actually have a streaming operator. For example `boost::optional<std::vector>` +does not have a streaming operator but one is detected since it is part of a +template. For these cases a secondary method `app->add_option_no_stream(...)` is +provided that bypasses this operation completely and should compile in these +cases. diff --git a/packages/CLI11/book/chapters/subcommands.md b/packages/CLI11/book/chapters/subcommands.md index 585f91c72cf26cbe0d5b101f562b507d6029f8c4..a2124e8c06a77238f5b42c0cad2bde9016ccb708 100644 --- a/packages/CLI11/book/chapters/subcommands.md +++ b/packages/CLI11/book/chapters/subcommands.md @@ -1,21 +1,26 @@ # Subcommands and the App -Subcommands are keyword that invoke a new set of options and features. For example, the `git` -command has a long series of subcommands, like `add` and `commit`. Each can have its own options -and implementations. This chapter will focus on implementations that are contained in the same -C++ application, though the system git uses to extend the main command by calling other commands -in separate executables is supported too; that's called "Prefix commands" and is included at the -end of this chapter. +Subcommands are keyword that invoke a new set of options and features. For +example, the `git` command has a long series of subcommands, like `add` and +`commit`. Each can have its own options and implementations. This chapter will +focus on implementations that are contained in the same C++ application, though +the system git uses to extend the main command by calling other commands in +separate executables is supported too; that's called "Prefix commands" and is +included at the end of this chapter. ## The parent App -We'll start by discussing the parent `App`. You've already used it quite a bit, to create -options and set option defaults. There are several other things you can do with an `App`, however. +We'll start by discussing the parent `App`. You've already used it quite a bit, +to create options and set option defaults. There are several other things you +can do with an `App`, however. -You are given a lot of control the help output. You can set a footer with `app.footer("My Footer")`. -You can replace the default help print when a `ParseError` is thrown with `app.set_failure_message(CLI::FailureMessage::help)`. -The default is `CLI:::FailureMessage::simple`, and you can easily define a new one. Just make a (lambda) function that takes an App pointer -and a reference to an error code (even if you don't use them), and returns a string. +You are given a lot of control the help output. You can set a footer with +`app.footer("My Footer")`. You can replace the default help print when a +`ParseError` is thrown with +`app.set_failure_message(CLI::FailureMessage::help)`. The default is +`CLI:::FailureMessage::simple`, and you can easily define a new one. Just make a +(lambda) function that takes an App pointer and a reference to an error code +(even if you don't use them), and returns a string. ## Adding a subcommand @@ -25,12 +30,14 @@ Subcommands can be added just like an option: CLI::App* sub = app.add_subcommand("sub", "This is a subcommand"); ``` -The subcommand should have a name as the first argument, and a little description for the -second argument. A pointer to the internally stored subcommand is provided; you usually will -be capturing that pointer and using it later (though you can use callbacks if you prefer). As -always, feel free to use `auto sub = ...` instead of naming the type. +The subcommand should have a name as the first argument, and a little +description for the second argument. A pointer to the internally stored +subcommand is provided; you usually will be capturing that pointer and using it +later (though you can use callbacks if you prefer). As always, feel free to use +`auto sub = ...` instead of naming the type. -You can check to see if the subcommand was received on the command line several ways: +You can check to see if the subcommand was received on the command line several +ways: ```cpp if(*sub) ... @@ -39,52 +46,68 @@ if(app.got_subcommand(sub)) ... if(app.got_subcommand("sub")) ... ``` -You can also get a list of subcommands with `get_subcommands()`, and they will be in parsing order. +You can also get a list of subcommands with `get_subcommands()`, and they will +be in parsing order. There are a lot of options that you can set on a subcommand; in fact, -subcommands have exactly the same options as your main app, since they are actually -the same class of object (as you may have guessed from the type above). This has the -pleasant side affect of making subcommands infinitely nestable. +subcommands have exactly the same options as your main app, since they are +actually the same class of object (as you may have guessed from the type above). +This has the pleasant side affect of making subcommands infinitely nestable. ## Required subcommands -Each App has controls to set the number of subcommands you expect. This is controlled by: +Each App has controls to set the number of subcommands you expect. This is +controlled by: ```cpp app.require_subcommand(/* min */ 0, /* max */ 1); ``` -If you set the max to 0, CLI11 will allow an unlimited number of subcommands. After the (non-unlimited) maximum -is reached, CLI11 will stop trying to match subcommands. So the if you pass "`one two`" to a command, and both `one` -and `two` are subcommands, it will depend on the maximum number as to whether the "`two`" is a subcommand or an argument to the -"`one`" subcommand. +If you set the max to 0, CLI11 will allow an unlimited number of subcommands. +After the (non-unlimited) maximum is reached, CLI11 will stop trying to match +subcommands. So the if you pass "`one two`" to a command, and both `one` and +`two` are subcommands, it will depend on the maximum number as to whether the +"`two`" is a subcommand or an argument to the "`one`" subcommand. -As a shortcut, you can also call the `require_subcommand` method with one argument; that will be the fixed number of subcommands if positive, it -will be the maximum number if negative. Calling it without an argument will set the required subcommands to 1 or more. +As a shortcut, you can also call the `require_subcommand` method with one +argument; that will be the fixed number of subcommands if positive, it will be +the maximum number if negative. Calling it without an argument will set the +required subcommands to 1 or more. -The maximum number of subcommands is inherited by subcommands. This allows you to set the maximum to 1 once at the beginning on the parent app if you only want single subcommands throughout your app. You should keep this in mind, if you are dealing with lots of nested subcommands. +The maximum number of subcommands is inherited by subcommands. This allows you +to set the maximum to 1 once at the beginning on the parent app if you only want +single subcommands throughout your app. You should keep this in mind, if you are +dealing with lots of nested subcommands. ## Using callbacks -You've already seen how to check to see what subcommands were given. It's often much easier, however, to just define the code you want to run when you are making your parser, and not run a bunch of code after `CLI11_PARSE` to analyse the state (Procedural! Yuck!). You can do that with lambda functions. A `std::function<void()>` callback `.callback()` is provided, and CLI11 ensures that all options are prepared and usable by reference capture before entering the callback. An -example is shown below in the `geet` program. +You've already seen how to check to see what subcommands were given. It's often +much easier, however, to just define the code you want to run when you are +making your parser, and not run a bunch of code after `CLI11_PARSE` to analyse +the state (Procedural! Yuck!). You can do that with lambda functions. A +`std::function<void()>` callback `.callback()` is provided, and CLI11 ensures +that all options are prepared and usable by reference capture before entering +the callback. An example is shown below in the `geet` program. ## Inheritance of defaults -The following values are inherited when you add a new subcommand. This happens at the point the subcommand is created: - -* The name and description for the help flag -* The footer -* The failure message printer function -* Option defaults -* Allow extras -* Prefix command -* Ignore case -* Ignore underscore -* Allow Windows style options -* Fallthrough -* Group name -* Max required subcommands +The following values are inherited when you add a new subcommand. This happens +at the point the subcommand is created: + +- The name and description for the help flag +- The footer +- The failure message printer function +- Option defaults +- Allow extras +- Prefix command +- Ignore case +- Ignore underscore +- Allow Windows style options +- Fallthrough +- Group name +- Max required subcommands +- validate positional arguments +- validate optional arguments ## Special modes @@ -92,28 +115,39 @@ There are several special modes for Apps and Subcommands. ### Allow extras -Normally CLI11 throws an error if you don't match all items given on the command line. However, you can enable `allow_extras()` -to instead store the extra values in `.remaining()`. You can get all remaining options including those in contained subcommands recursively in the original order with `.remaining(true)`. -`.remaining_size()` is also provided; this counts the size but ignores the `--` special separator if present. +Normally CLI11 throws an error if you don't match all items given on the command +line. However, you can enable `allow_extras()` to instead store the extra values +in `.remaining()`. You can get all remaining options including those in +contained subcommands recursively in the original order with `.remaining(true)`. +`.remaining_size()` is also provided; this counts the size but ignores the `--` +special separator if present. ### Fallthrough -Fallthrough allows an option that does not match in a subcommand to "fall through" to the parent command; if that parent -allows that option, it matches there instead. This was added to allow CLI11 to represent models: +Fallthrough allows an option that does not match in a subcommand to "fall +through" to the parent command; if that parent allows that option, it matches +there instead. This was added to allow CLI11 to represent models: ```term gitbook:code $ ./my_program my_model_1 --model_flag --shared_flag ``` -Here, `--shared_flag` was set on the main app, and on the command line it "falls through" `my_model_1` to match on the main app. +Here, `--shared_flag` was set on the main app, and on the command line it "falls +through" `my_model_1` to match on the main app. ### Prefix command -This is a special mode that allows "prefix" commands, where the parsing completely stops when it gets to an unknown option. Further unknown options are ignored, even if they could match. Git is the traditional example for prefix commands; if you run git with an unknown subcommand, like "`git thing`", it then calls another command called "`git-thing`" with the remaining options intact. +This is a special mode that allows "prefix" commands, where the parsing +completely stops when it gets to an unknown option. Further unknown options are +ignored, even if they could match. Git is the traditional example for prefix +commands; if you run git with an unknown subcommand, like "`git thing`", it then +calls another command called "`git-thing`" with the remaining options intact. ### Silent subcommands -Subcommands can be modified by using the `silent` option. This will prevent the subcommand from showing up in the get_subcommands list. This can be used to make subcommands into modifiers. For example, a help subcommand might look like +Subcommands can be modified by using the `silent` option. This will prevent the +subcommand from showing up in the get_subcommands list. This can be used to make +subcommands into modifiers. For example, a help subcommand might look like ```c++ auto sub1 = app.add_subcommand("help")->silent(); @@ -126,3 +160,35 @@ This would allow calling help such as: ./app help ./app help sub1 ``` + +### Positional Validation + +Some arguments supplied on the command line may be legitamately applied to more +than 1 positional argument. In this context enabling `positional_validation` on +the application or subcommand will check any validators before applying the +command line argument to the positional option. It is not an error to fail +validation in this context, positional arguments not matching any validators +will go into the `extra_args` field which may generate an error depending on +settings. + +### Optional Argument Validation + +Similar to positional validation, there are occasional contexts in which case it +might be ambiguous whether an argument should be applied to an option or a +positional option. + +```c++ + std::vector<std::string> vec; + std::vector<int> ivec; + app.add_option("pos", vec); + app.add_option("--args", ivec)->check(CLI::Number); + app.validate_optional_arguments(); +``` + +In this case a sequence of integers is expected for the argument and remaining +strings go to the positional string vector. Without the +`validate_optional_arguments()` active it would be impossible get any later +arguments into the positional if the `--args` option is used. The validator in +this context is used to make sure the optional arguments match with what the +argument is expecting and if not the `-args` option is closed, and remaining +arguments fall into the positional. diff --git a/packages/CLI11/book/chapters/toolkits.md b/packages/CLI11/book/chapters/toolkits.md index 4c276387a5469fab86e957720fc7294cc2db4e4c..a636e7b15b8f1e53782ce478345989fc5cdb57ec 100644 --- a/packages/CLI11/book/chapters/toolkits.md +++ b/packages/CLI11/book/chapters/toolkits.md @@ -1,12 +1,18 @@ # Using CLI11 in a Toolkit -CLI11 was designed to be integrate into a toolkit, providing a native experience for users. This was used in GooFit to provide `GooFit::Application`, an class designed to make ROOT users feel at home. +CLI11 was designed to be integrate into a toolkit, providing a native experience +for users. This was used in GooFit to provide `GooFit::Application`, an class +designed to make ROOT users feel at home. ## Custom namespace -If you want to provide CLI11 in a custom namespace, you'll want to at least put `using CLI::App` in your namespace. You can also include Option, some errors, and validators. You can also put `using namespace CLI` inside your namespace to import everything. +If you want to provide CLI11 in a custom namespace, you'll want to at least put +`using CLI::App` in your namespace. You can also include Option, some errors, +and validators. You can also put `using namespace CLI` inside your namespace to +import everything. -You may also want to make your own copy of the `CLI11_PARSE` macro. Something like: +You may also want to make your own copy of the `CLI11_PARSE` macro. Something +like: ```cpp #define MYPACKAGE_PARSE(app, argv, argc) \ @@ -19,10 +25,16 @@ You may also want to make your own copy of the `CLI11_PARSE` macro. Something li ## Subclassing App -If you subclass `App`, you'll just need to do a few things. You'll need a constructor; calling the base `App` constructor is a good idea, but not necessary (it just sets a description and adds a help flag. +If you subclass `App`, you'll just need to do a few things. You'll need a +constructor; calling the base `App` constructor is a good idea, but not +necessary (it just sets a description and adds a help flag. -You can call anything you would like to configure in the constructor, like `option_defaults()->take_last()` or `fallthrough()`, and it will be set on all user instances. You can add flags and options, as well. +You can call anything you would like to configure in the constructor, like +`option_defaults()->take_last()` or `fallthrough()`, and it will be set on all +user instances. You can add flags and options, as well. ## Virtual functions provided -You are given a few virtual functions that you can change (only on the main App). `pre_callback` runs right before the callbacks run, letting you print out custom messages at the top of your app. +You are given a few virtual functions that you can change (only on the main +App). `pre_callback` runs right before the callbacks run, letting you print out +custom messages at the top of your app. diff --git a/packages/CLI11/book/chapters/validators.md b/packages/CLI11/book/chapters/validators.md index 06e42c80a0f82a25f94a9329be65550fca92233d..fffa38c7b6af497d74d452bb3abcadd364ebbdaf 100644 --- a/packages/CLI11/book/chapters/validators.md +++ b/packages/CLI11/book/chapters/validators.md @@ -2,23 +2,27 @@ There are two forms of validators: -* `transform` validators: mutating -* `check` validators: non-mutating (recommended unless the parsed string must be mutated) +- `transform` validators: mutating +- `check` validators: non-mutating (recommended unless the parsed string must be + mutated) -A transform validator comes in one form, a function with the signature `std::string(std::string)`. -The function will take a string and return the modified version of the string. If there is an error, -the function should throw a `CLI::ValidationError` with the appropriate reason as a message. +A transform validator comes in one form, a function with the signature +`std::string(std::string)`. The function will take a string and return the +modified version of the string. If there is an error, the function should throw +a `CLI::ValidationError` with the appropriate reason as a message. -However, `check` validators come in two forms; either a simple function with the const version of the -above signature, `std::string(const std::string &)`, or a subclass of `struct CLI::Validator`. This -structure has two members that a user should set; one (`func_`) is the function to add to the Option -(exactly matching the above function signature, since it will become that function), and the other is -`name_`, and is the type name to set on the Option (unless empty, in which case the typename will be -left unchanged). +However, `check` validators come in two forms; either a simple function with the +const version of the above signature, `std::string(const std::string &)`, or a +subclass of `struct CLI::Validator`. This structure has two members that a user +should set; one (`func_`) is the function to add to the Option (exactly matching +the above function signature, since it will become that function), and the other +is `name_`, and is the type name to set on the Option (unless empty, in which +case the typename will be left unchanged). -Validators can be combined with `&` and `|`, and they have an `operator()` so that you can call them -as if they were a function. In CLI11, const static versions of the validators are provided so that -the user does not have to call a constructor also. +Validators can be combined with `&` and `|`, and they have an `operator()` so +that you can call them as if they were a function. In CLI11, const static +versions of the validators are provided so that the user does not have to call a +constructor also. An example of a custom validator: @@ -37,25 +41,26 @@ struct LowerCaseValidator : public Validator { const static LowerCaseValidator Lowercase; ``` -If you were not interested in the extra features of Validator, you could simply pass the lambda function above to the `->check()` method of `Option`. +If you were not interested in the extra features of Validator, you could simply +pass the lambda function above to the `->check()` method of `Option`. The built-in validators for CLI11 are: -| Validator | Description | -|---------------------|-------------| -| `ExistingFile` | Check for existing file (returns error message if check fails) | +| Validator | Description | +| ------------------- | ---------------------------------------------------------------------- | +| `ExistingFile` | Check for existing file (returns error message if check fails) | | `ExistingDirectory` | Check for an existing directory (returns error message if check fails) | -| `ExistingPath` | Check for an existing path | -| `NonexistentPath` | Check for an non-existing path | -| `Range(min=0, max)` | Produce a range (factory). Min and max are inclusive. | +| `ExistingPath` | Check for an existing path | +| `NonexistentPath` | Check for an non-existing path | +| `Range(min=0, max)` | Produce a range (factory). Min and max are inclusive. | And, the protected members that you can set when you make your own are: -| Type | Member | Description | -|------|--------|-------------| -| `std::function<std::string(std::string &)>` | `func_` | Core validation function - modifies input and returns "" if successful | -| `std::function<std::string()>` | `desc_function` | Optional description function (uses `description_` instead if not set) | -| `std::string` | `name_` | The name for search purposes | -| `int` (`-1`) | `application_index_` | The element this validator applies to (-1 for all) | -| `bool` (`true`) | `active_` | This can be disabled | -| `bool` (`false`) | `non_modifying_` | Specify that this is a Validator instead of a Transformer | +| Type | Member | Description | +| ------------------------------------------- | -------------------- | ---------------------------------------------------------------------- | +| `std::function<std::string(std::string &)>` | `func_` | Core validation function - modifies input and returns "" if successful | +| `std::function<std::string()>` | `desc_function` | Optional description function (uses `description_` instead if not set) | +| `std::string` | `name_` | The name for search purposes | +| `int` (`-1`) | `application_index_` | The element this validator applies to (-1 for all) | +| `bool` (`true`) | `active_` | This can be disabled | +| `bool` (`false`) | `non_modifying_` | Specify that this is a Validator instead of a Transformer | diff --git a/packages/CLI11/cmake/CLI11Warnings.cmake b/packages/CLI11/cmake/CLI11Warnings.cmake new file mode 100644 index 0000000000000000000000000000000000000000..8b4b499d1251c5e0914a4e3f1dcc4febb80bb956 --- /dev/null +++ b/packages/CLI11/cmake/CLI11Warnings.cmake @@ -0,0 +1,37 @@ +# Special target that adds warnings. Is not exported. +add_library(CLI11_warnings INTERFACE) + +set(unix-warnings -Wall -Wextra -pedantic -Wshadow -Wsign-conversion -Wswitch-enum) + +# Clang warnings +# -Wfloat-equal could be added with Catch::literals and _a usage +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + list( + APPEND + unix-warnings + -Wcast-align + -Wimplicit-atomic-properties + -Wmissing-declarations + -Woverlength-strings + -Wshadow + -Wstrict-selector-match + -Wundeclared-selector) + # -Wunreachable-code Doesn't work on Clang 3.4 +endif() + +# Buggy in GCC 4.8 +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + list(APPEND unix-warnings -Weffc++) +endif() + +target_compile_options( + CLI11_warnings + INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++> + $<$<CXX_COMPILER_ID:MSVC>:/W4 + $<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:/WX>> + $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${unix-warnings} + $<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:-Werror>>) + +if(NOT CMAKE_VERSION VERSION_LESS 3.13) + target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>) +endif() diff --git a/packages/CLI11/conanfile.py b/packages/CLI11/conanfile.py index 377cd014c7feb521b8398cedceccde2445594a5f..9dc6ce3ade6d55676541b7e789c6a0dd3608f892 100644 --- a/packages/CLI11/conanfile.py +++ b/packages/CLI11/conanfile.py @@ -27,6 +27,7 @@ class CLI11Conan(ConanFile): "LICENSE", "README.md", "include/*", + "src/*", "extern/*", "cmake/*", "CMakeLists.txt", diff --git a/packages/CLI11/docs/mainpage.md b/packages/CLI11/docs/mainpage.md index b1f2b396709b9cddda94231d2e0cbc3e59c3f8be..e0cf03800595eebe2c563b38fc69da17d864ad19 100644 --- a/packages/CLI11/docs/mainpage.md +++ b/packages/CLI11/docs/mainpage.md @@ -1,22 +1,24 @@ # Introduction {#mainpage} -This is the Doxygen API documentation for CLI11 parser. There is a friendly introduction to CLI11 on the [GitHub page](https://github.com/CLIUtils/CLI11), and [a tutorial series](https://cliutils.github.io/CLI11/book/). +This is the Doxygen API documentation for CLI11 parser. There is a friendly +introduction to CLI11 on the [GitHub page](https://github.com/CLIUtils/CLI11), +and [a tutorial series](https://cliutils.github.io/CLI11/book/). The main classes are: -| Name | Where used | -|---------------|-------------------------------------| -|CLI::Option | Options, stored in the app | -|CLI::App | The main application or subcommands | -|CLI::Validator | A check that can affect the type name | -|CLI::Formatter | A subclassable formatter for help printing | -|CLI::ExitCode | A scoped enum with exit codes | -|CLI::Timer | A timer class, only in CLI/Timer.hpp (not in `CLI11.hpp`) | -|CLI::AutoTimer | A timer that prints on deletion | +| Name | Where used | +| -------------- | --------------------------------------------------------- | +| CLI::Option | Options, stored in the app | +| CLI::App | The main application or subcommands | +| CLI::Validator | A check that can affect the type name | +| CLI::Formatter | A subclassable formatter for help printing | +| CLI::ExitCode | A scoped enum with exit codes | +| CLI::Timer | A timer class, only in CLI/Timer.hpp (not in `CLI11.hpp`) | +| CLI::AutoTimer | A timer that prints on deletion | Groups of related topics: | Name | Description | -|----------------------|------------------------------------------------| +| -------------------- | ---------------------------------------------- | | @ref error_group | Errors that can be thrown | | @ref validator_group | Common validators used in CLI::Option::check() | diff --git a/packages/CLI11/examples/CMakeLists.txt b/packages/CLI11/examples/CMakeLists.txt index d0d45c6282ed21995bbcfa0a70bef4d190c1ef53..131a9fd02514e1aa835b1d613698f0550f7a8799 100644 --- a/packages/CLI11/examples/CMakeLists.txt +++ b/packages/CLI11/examples/CMakeLists.txt @@ -1,5 +1,5 @@ function(add_cli_exe T) - add_executable(${T} ${ARGN} ${CLI11_headers}) + add_executable(${T} ${ARGN}) target_link_libraries(${T} PUBLIC CLI11) set_property(TARGET ${T} PROPERTY FOLDER "Examples") if(CLI11_FORCE_LIBCXX) @@ -8,9 +8,6 @@ function(add_cli_exe T) APPEND_STRING PROPERTY LINK_FLAGS -stdlib=libc++) endif() - if(CLI11_CLANG_TIDY) - set_property(TARGET ${T} PROPERTY CXX_CLANG_TIDY "${DO_CLANG_TIDY}") - endif() endfunction() if(CLI11_BUILD_EXAMPLES_JSON) @@ -247,3 +244,8 @@ set_property(TEST retired_deprecated PROPERTY PASS_REGULAR_EXPRESSION "deprecate add_cli_exe(custom_parse custom_parse.cpp) add_test(NAME cp_test COMMAND custom_parse --dv 1.7) set_property(TEST cp_test PROPERTY PASS_REGULAR_EXPRESSION "called correct") + +#------------------------------------------------ +# This executable is for manual testing and is expected to change regularly + +add_cli_exe(tester testEXE.cpp) diff --git a/packages/CLI11/examples/callback_passthrough.cpp b/packages/CLI11/examples/callback_passthrough.cpp index 48a248756f49558e726d656a0451f1005a985253..833ef6fcf1e7593b34d5d6add8de93468b4c7909 100644 --- a/packages/CLI11/examples/callback_passthrough.cpp +++ b/packages/CLI11/examples/callback_passthrough.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/config_app.cpp b/packages/CLI11/examples/config_app.cpp index aec9fefdfaf80875dc71fc62a2701ca62ff384b4..986e80d9e2f468ea2f4857ad4a433c484b57be27 100644 --- a/packages/CLI11/examples/config_app.cpp +++ b/packages/CLI11/examples/config_app.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/custom_parse.cpp b/packages/CLI11/examples/custom_parse.cpp index 44fc77afd1cf91379a1f73f0868a9f23eaa17260..793ddfab2b665308821309bf4c3fa56392a8e877 100644 --- a/packages/CLI11/examples/custom_parse.cpp +++ b/packages/CLI11/examples/custom_parse.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -22,7 +22,7 @@ template <class T = int> struct Values { using DoubleValues = Values<double>; // the lexical cast operator should be in the same namespace as the type for ADL to work properly -bool lexical_cast(const std::string &input, Values<double> &v) { +bool lexical_cast(const std::string &input, Values<double> & /*v*/) { std::cout << "called correct lexical_cast function ! val: " << input << std::endl; return true; } diff --git a/packages/CLI11/examples/digit_args.cpp b/packages/CLI11/examples/digit_args.cpp index af0891a4f81ff41f0c73db3159edda088f41106d..023be6c63884e6617ab8664a33a1d1889424b503 100644 --- a/packages/CLI11/examples/digit_args.cpp +++ b/packages/CLI11/examples/digit_args.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/enum.cpp b/packages/CLI11/examples/enum.cpp index 09b7f043b6f53edf65fb2e590b7bf79b4bb7b2c8..90684333fbb106c84282fbab423d89e5eb394a1a 100644 --- a/packages/CLI11/examples/enum.cpp +++ b/packages/CLI11/examples/enum.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/enum_ostream.cpp b/packages/CLI11/examples/enum_ostream.cpp index 4e3e6b297f5a4b624af1d6ccfb5d2bbac22fd530..4ccc6a00c42d1c57f1a99641e12d2f9ce75d5b5b 100644 --- a/packages/CLI11/examples/enum_ostream.cpp +++ b/packages/CLI11/examples/enum_ostream.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/formatter.cpp b/packages/CLI11/examples/formatter.cpp index 3b2e3dce5447694d285d2d99441c363d03912e0b..09d6dce10753479111a6ca97a82eda3a166445fb 100644 --- a/packages/CLI11/examples/formatter.cpp +++ b/packages/CLI11/examples/formatter.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -24,9 +24,9 @@ int main(int argc, char **argv) { app.add_flag("--flag", "This is a flag"); - auto sub1 = app.add_subcommand("one", "Description One"); + auto *sub1 = app.add_subcommand("one", "Description One"); sub1->add_flag("--oneflag", "Some flag"); - auto sub2 = app.add_subcommand("two", "Description Two"); + auto *sub2 = app.add_subcommand("two", "Description Two"); sub2->add_flag("--twoflag", "Some other flag"); CLI11_PARSE(app, argc, argv); diff --git a/packages/CLI11/examples/groups.cpp b/packages/CLI11/examples/groups.cpp index c766d6b23bef6806eadc94e4623aa2202c3e0090..2ebc1e88a5b7cd890a3041b3b107dbabb558c7fb 100644 --- a/packages/CLI11/examples/groups.cpp +++ b/packages/CLI11/examples/groups.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -10,7 +10,7 @@ #include <string> int main(int argc, char **argv) { - CLI::AutoTimer("This is a timer"); + CLI::AutoTimer give_me_a_name("This is a timer"); CLI::App app("K3Pi goofit fitter"); diff --git a/packages/CLI11/examples/inter_argument_order.cpp b/packages/CLI11/examples/inter_argument_order.cpp index ebee3977ac1d26a896805ef24620dcf458e82bba..8fe063e396be399bd7ec38b6b933bb3f5d37758c 100644 --- a/packages/CLI11/examples/inter_argument_order.cpp +++ b/packages/CLI11/examples/inter_argument_order.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -14,10 +14,10 @@ int main(int argc, char **argv) { CLI::App app{"An app to practice mixing unlimited arguments, but still recover the original order."}; std::vector<int> foos; - auto foo = app.add_option("--foo,-f", foos, "Some unlimited argument"); + auto *foo = app.add_option("--foo,-f", foos, "Some unlimited argument"); std::vector<int> bars; - auto bar = app.add_option("--bar", bars, "Some unlimited argument"); + auto *bar = app.add_option("--bar", bars, "Some unlimited argument"); app.add_flag("--z,--x", "Random other flags"); @@ -33,7 +33,7 @@ int main(int argc, char **argv) { std::reverse(std::begin(bars), std::end(bars)); std::vector<std::pair<std::string, int>> keyval; - for(auto option : app.parse_order()) { + for(auto *option : app.parse_order()) { if(option == foo) { keyval.emplace_back("foo", foos.back()); foos.pop_back(); diff --git a/packages/CLI11/examples/modhelp.cpp b/packages/CLI11/examples/modhelp.cpp index 9c674300f8b7e55f050f85fb74bd0d4fbb7c009a..ac2ba1759d2952a96f5d4173aaaf8a66dff45d35 100644 --- a/packages/CLI11/examples/modhelp.cpp +++ b/packages/CLI11/examples/modhelp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -16,7 +16,7 @@ Note that this will not shortcut `->required` and other similar options.)raw"}; test.set_help_flag(); // Add custom flag that activates help - auto help = test.add_flag("-h,--help", "Request help"); + auto *help = test.add_flag("-h,--help", "Request help"); std::string some_option; test.add_option("-a", some_option, "Some description"); diff --git a/packages/CLI11/examples/nested.cpp b/packages/CLI11/examples/nested.cpp index dc8323fe00b7e9c30ea777349abb93e969c19696..07aa75fb85f5959619d7caa0a3660722be9c52ed 100644 --- a/packages/CLI11/examples/nested.cpp +++ b/packages/CLI11/examples/nested.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/option_groups.cpp b/packages/CLI11/examples/option_groups.cpp index acc65740d62cb66f879c9859ee936fb89b602c14..9799bdc6e4ac6f07ecbcf85526acfc1b4bcc3aaa 100644 --- a/packages/CLI11/examples/option_groups.cpp +++ b/packages/CLI11/examples/option_groups.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,8 +13,8 @@ int main(int argc, char **argv) { CLI::App app("data output specification"); app.set_help_all_flag("--help-all", "Expand all help"); - auto format = app.add_option_group("output_format", "formatting type for output"); - auto target = app.add_option_group("output target", "target location for the output"); + auto *format = app.add_option_group("output_format", "formatting type for output"); + auto *target = app.add_option_group("output target", "target location for the output"); bool csv{false}; bool human{false}; bool binary{false}; @@ -33,10 +33,10 @@ int main(int argc, char **argv) { CLI11_PARSE(app, argc, argv); std::string format_type = (csv) ? std::string("CSV") : ((human) ? "human readable" : "binary"); - std::cout << "Selected " << format_type << "format" << std::endl; - if(fileLoc.empty()) { + std::cout << "Selected " << format_type << " format" << std::endl; + if(!fileLoc.empty()) { std::cout << " sent to file " << fileLoc << std::endl; - } else if(networkAddress.empty()) { + } else if(!networkAddress.empty()) { std::cout << " sent over network to " << networkAddress << std::endl; } else { std::cout << " sent to std::cout" << std::endl; diff --git a/packages/CLI11/examples/positional_arity.cpp b/packages/CLI11/examples/positional_arity.cpp index e9238fc74011a999cfbc072585ac2c0d24fe3150..e8c45c4d61016596bfbdcd98d45a588d31a53e8d 100644 --- a/packages/CLI11/examples/positional_arity.cpp +++ b/packages/CLI11/examples/positional_arity.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -12,8 +12,8 @@ int main(int argc, char **argv) { CLI::App app("test for positional arity"); - auto numbers = app.add_option_group("numbers", "specify key numbers"); - auto files = app.add_option_group("files", "specify files"); + auto *numbers = app.add_option_group("numbers", "specify key numbers"); + auto *files = app.add_option_group("files", "specify files"); int num1{-1}, num2{-1}; numbers->add_option("num1", num1, "first number"); numbers->add_option("num2", num2, "second number"); diff --git a/packages/CLI11/examples/positional_validation.cpp b/packages/CLI11/examples/positional_validation.cpp index afc03fa8042fedf49983f49b952c9490ad3941ae..ce676d9d185b812545f990a975f26ca4c03c8463 100644 --- a/packages/CLI11/examples/positional_validation.cpp +++ b/packages/CLI11/examples/positional_validation.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/prefix_command.cpp b/packages/CLI11/examples/prefix_command.cpp index 2af1a87b3a1457b6a93b8494415662eadd79732b..61639411fd0ca18065d4331147e35639934109e4 100644 --- a/packages/CLI11/examples/prefix_command.cpp +++ b/packages/CLI11/examples/prefix_command.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -27,7 +27,7 @@ int main(int argc, char **argv) { std::cout << std::endl << "Remaining commands: "; - for(auto com : more_comms) + for(const auto &com : more_comms) std::cout << com << " "; std::cout << std::endl; diff --git a/packages/CLI11/examples/ranges.cpp b/packages/CLI11/examples/ranges.cpp index 6b4c1e3bc35e9471379ce8d6a4a6f71c2e563669..42b1659c3bf88897a5a732cf0e7c68c4631357fe 100644 --- a/packages/CLI11/examples/ranges.cpp +++ b/packages/CLI11/examples/ranges.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -15,7 +15,7 @@ int main(int argc, char **argv) { std::vector<int> range; app.add_option("--range,-R", range, "A range")->expected(-2); - auto ogroup = app.add_option_group("min_max_step", "set the min max and step"); + auto *ogroup = app.add_option_group("min_max_step", "set the min max and step"); int min{0}, max{0}, step{1}; ogroup->add_option("--min,-m", min, "The minimum")->required(); ogroup->add_option("--max,-M", max, "The maximum")->required(); diff --git a/packages/CLI11/examples/retired.cpp b/packages/CLI11/examples/retired.cpp index 3a18db4aed5aca16c32d6d85f2254700710ea161..0a3a5fbeee541fca69701dae47be5af1074e160c 100644 --- a/packages/CLI11/examples/retired.cpp +++ b/packages/CLI11/examples/retired.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -14,10 +14,10 @@ int main(int argc, char **argv) { CLI::App app("example for retired/deprecated options"); std::vector<int> x; - auto opt1 = app.add_option("--retired_option2", x); + auto *opt1 = app.add_option("--retired_option2", x); std::pair<int, int> y; - auto opt2 = app.add_option("--deprecate", y); + auto *opt2 = app.add_option("--deprecate", y); app.add_option("--not_deprecated", x); diff --git a/packages/CLI11/examples/shapes.cpp b/packages/CLI11/examples/shapes.cpp index b318df0e152b23815027c4e904e92b8b6468e9b5..d9f47cab101261afee5c23118a539c70a3e0a10a 100644 --- a/packages/CLI11/examples/shapes.cpp +++ b/packages/CLI11/examples/shapes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,7 +13,7 @@ int main(int argc, char **argv) { CLI::App app("load shapes"); app.set_help_all_flag("--help-all"); - auto circle = app.add_subcommand("circle", "draw a circle")->immediate_callback(); + auto *circle = app.add_subcommand("circle", "draw a circle")->immediate_callback(); double radius{0.0}; int circle_counter{0}; circle->callback([&radius, &circle_counter] { @@ -23,7 +23,7 @@ int main(int argc, char **argv) { circle->add_option("radius", radius, "the radius of the circle")->required(); - auto rect = app.add_subcommand("rectangle", "draw a rectangle")->immediate_callback(); + auto *rect = app.add_subcommand("rectangle", "draw a rectangle")->immediate_callback(); double edge1{0.0}; double edge2{0.0}; int rect_counter{0}; @@ -39,7 +39,7 @@ int main(int argc, char **argv) { rect->add_option("edge1", edge1, "the first edge length of the rectangle")->required(); rect->add_option("edge2", edge2, "the second edge length of the rectangle"); - auto tri = app.add_subcommand("triangle", "draw a rectangle")->immediate_callback(); + auto *tri = app.add_subcommand("triangle", "draw a rectangle")->immediate_callback(); std::vector<double> sides; int tri_counter = 0; tri->callback([&sides, &tri_counter] { diff --git a/packages/CLI11/examples/simple.cpp b/packages/CLI11/examples/simple.cpp index 0f904420f267b37dbbee4fbee517c94eedce3d59..5f94bc835186f619362b5d304fd4c27a9fcdb8cc 100644 --- a/packages/CLI11/examples/simple.cpp +++ b/packages/CLI11/examples/simple.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_help.cpp b/packages/CLI11/examples/subcom_help.cpp index 89af131dabc4776fdafa302c266fb703f74a028d..952060de9a4b345d4c5343956acc41da5b88d22f 100644 --- a/packages/CLI11/examples/subcom_help.cpp +++ b/packages/CLI11/examples/subcom_help.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp b/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp index 6b229839bcf38e0fea489e07aa21f52234459240..9ad65e01e2021212d8de3e68be82fe6d954ea8f8 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -15,7 +15,7 @@ void setup_subcommand_a(CLI::App &app) { // Create the option and subcommand objects. auto opt = std::make_shared<SubcommandAOptions>(); - auto sub = app.add_subcommand("subcommand_a", "performs subcommand a"); + auto *sub = app.add_subcommand("subcommand_a", "performs subcommand a"); // Add options to sub, binding them to opt. sub->add_option("-f,--file", opt->file, "File name")->required(); diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp b/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp index 116160c53059d53d393a4b0ef696521614224732..cfa4883ea0f1770c1be703c76d163217e9faf65e 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp b/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp index 62b63806edb990c58d408ed718d2df550b005729..1ff5fdad9af3e98601ad182d5541895a9d79be4f 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_partitioned.cpp b/packages/CLI11/examples/subcom_partitioned.cpp index df48e2d7918266100733563d0c6be28d3bd40710..493ac0e383be0a2775ec1d9131562635926cb039 100644 --- a/packages/CLI11/examples/subcom_partitioned.cpp +++ b/packages/CLI11/examples/subcom_partitioned.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -11,7 +11,7 @@ #include <string> int main(int argc, char **argv) { - CLI::AutoTimer("This is a timer"); + CLI::AutoTimer give_me_a_name("This is a timer"); CLI::App app("K3Pi goofit fitter"); diff --git a/packages/CLI11/examples/subcommands.cpp b/packages/CLI11/examples/subcommands.cpp index 68f163a75b3dd0e8ba0aeea8a09b9e4432952985..44d4df925e7256012365a47ecea4fc3948babf2d 100644 --- a/packages/CLI11/examples/subcommands.cpp +++ b/packages/CLI11/examples/subcommands.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -28,7 +28,7 @@ int main(int argc, char **argv) { std::cout << "Working on --count from stop: " << s->count() << ", direct count: " << stop->count("--count") << std::endl; std::cout << "Count of --random flag: " << app.count("--random") << std::endl; - for(auto subcom : app.get_subcommands()) + for(auto *subcom : app.get_subcommands()) std::cout << "Subcommand: " << subcom->get_name() << std::endl; return 0; diff --git a/packages/CLI11/examples/testEXE.cpp b/packages/CLI11/examples/testEXE.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b63fa9499ac49d9e841036247b6842e854b5b773 --- /dev/null +++ b/packages/CLI11/examples/testEXE.cpp @@ -0,0 +1,26 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +// Code modified from https://github.com/CLIUtils/CLI11/issues/559 + +#include <CLI/CLI.hpp> +#include <iostream> +#include <string> + +int main(int argc, const char *argv[]) { + + int logLevel{0}; + CLI::App app{"Test App"}; + + app.add_option("-v", logLevel, "level"); + + auto *subcom = app.add_subcommand("sub", "")->fallthrough(); + subcom->preparse_callback([&app](size_t) { app.get_subcommand("sub")->add_option_group("group"); }); + + CLI11_PARSE(app, argc, argv); + + std::cout << "level: " << logLevel << std::endl; +} diff --git a/packages/CLI11/examples/validators.cpp b/packages/CLI11/examples/validators.cpp index 6ca8d3896a9dd3f8b5e511aa2be3078c893d1d30..050be00fb8b5b7e64d82be0d8888c5762255904c 100644 --- a/packages/CLI11/examples/validators.cpp +++ b/packages/CLI11/examples/validators.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/App.hpp b/packages/CLI11/include/CLI/App.hpp index 803f0f7f62e384c63745d5904fb1501565e979b8..d29aa6a89ca7c9c9af9ce6c29eefd1c8e037df8d 100644 --- a/packages/CLI11/include/CLI/App.hpp +++ b/packages/CLI11/include/CLI/App.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -61,6 +61,22 @@ class App; using App_p = std::shared_ptr<App>; +namespace detail { +/// helper functions for adding in appropriate flag modifiers for add_flag + +template <typename T, enable_if_t<!std::is_integral<T>::value || (sizeof(T) <= 1U), detail::enabler> = detail::dummy> +Option *default_flag_modifiers(Option *opt) { + return opt->always_capture_default(); +} + +/// summing modifiers +template <typename T, enable_if_t<std::is_integral<T>::value && (sizeof(T) > 1U), detail::enabler> = detail::dummy> +Option *default_flag_modifiers(Option *opt) { + return opt->multi_option_policy(MultiOptionPolicy::Sum)->default_str("0")->force_callback(); +} + +} // namespace detail + class Option_group; /// Creates a command line program, with very few defaults. /** To use, create a new `Program()` instance with `argc`, `argv`, and a help description. The templated @@ -222,6 +238,9 @@ class App { /// If set to true positional options are validated before assigning INHERITABLE bool validate_positionals_{false}; + /// If set to true optional vector arguments are validated before assigning INHERITABLE + bool validate_optional_arguments_{false}; + /// indicator that the subcommand is silent and won't show up in subcommands list /// This is potentially useful as a modifier subcommand bool silent_{false}; @@ -263,38 +282,7 @@ class App { ///@} /// Special private constructor for subcommand - App(std::string app_description, std::string app_name, App *parent) - : name_(std::move(app_name)), description_(std::move(app_description)), parent_(parent) { - // Inherit if not from a nullptr - if(parent_ != nullptr) { - if(parent_->help_ptr_ != nullptr) - set_help_flag(parent_->help_ptr_->get_name(false, true), parent_->help_ptr_->get_description()); - if(parent_->help_all_ptr_ != nullptr) - set_help_all_flag(parent_->help_all_ptr_->get_name(false, true), - parent_->help_all_ptr_->get_description()); - - /// OptionDefaults - option_defaults_ = parent_->option_defaults_; - - // INHERITABLE - failure_message_ = parent_->failure_message_; - allow_extras_ = parent_->allow_extras_; - allow_config_extras_ = parent_->allow_config_extras_; - prefix_command_ = parent_->prefix_command_; - immediate_callback_ = parent_->immediate_callback_; - ignore_case_ = parent_->ignore_case_; - ignore_underscore_ = parent_->ignore_underscore_; - fallthrough_ = parent_->fallthrough_; - validate_positionals_ = parent_->validate_positionals_; - configurable_ = parent_->configurable_; - allow_windows_style_options_ = parent_->allow_windows_style_options_; - group_ = parent_->group_; - footer_ = parent_->footer_; - formatter_ = parent_->formatter_; - config_formatter_ = parent_->config_formatter_; - require_subcommand_max_ = parent_->require_subcommand_max_; - } - } + App(std::string app_description, std::string app_name, App *parent); public: /// @name Basic @@ -349,41 +337,10 @@ class App { } /// Set a name for the app (empty will use parser to set the name) - App *name(std::string app_name = "") { - - if(parent_ != nullptr) { - auto oname = name_; - name_ = app_name; - auto &res = _compare_subcommand_names(*this, *_get_fallthrough_parent()); - if(!res.empty()) { - name_ = oname; - throw(OptionAlreadyAdded(app_name + " conflicts with existing subcommand names")); - } - } else { - name_ = app_name; - } - has_automatic_name_ = false; - return this; - } + App *name(std::string app_name = ""); /// Set an alias for the app - App *alias(std::string app_name) { - if(app_name.empty() || !detail::valid_alias_name_string(app_name)) { - throw IncorrectConstruction("Aliases may not be empty or contain newlines or null characters"); - } - if(parent_ != nullptr) { - aliases_.push_back(app_name); - auto &res = _compare_subcommand_names(*this, *_get_fallthrough_parent()); - if(!res.empty()) { - aliases_.pop_back(); - throw(OptionAlreadyAdded("alias already matches an existing subcommand: " + app_name)); - } - } else { - aliases_.push_back(app_name); - } - - return this; - } + App *alias(std::string app_name); /// Remove the error when extras are left over on the command line. App *allow_extras(bool allow = true) { @@ -432,17 +389,7 @@ class App { } /// Set the subcommand callback to be executed immediately on subcommand completion - App *immediate_callback(bool immediate = true) { - immediate_callback_ = immediate; - if(immediate_callback_) { - if(final_callback_ && !(parse_complete_callback_)) { - std::swap(final_callback_, parse_complete_callback_); - } - } else if(!(final_callback_) && parse_complete_callback_) { - std::swap(final_callback_, parse_complete_callback_); - } - return this; - } + App *immediate_callback(bool immediate = true); /// Set the subcommand to validate positional arguments before assigning App *validate_positionals(bool validate = true) { @@ -450,6 +397,12 @@ class App { return this; } + /// Set the subcommand to validate optional vector arguments before assigning + App *validate_optional_arguments(bool validate = true) { + validate_optional_arguments_ = validate; + return this; + } + /// ignore extras in config files App *allow_config_extras(bool allow = true) { if(allow) { @@ -474,19 +427,7 @@ class App { } /// Ignore case. Subcommands inherit value. - App *ignore_case(bool value = true) { - if(value && !ignore_case_) { - ignore_case_ = true; - auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; - auto &match = _compare_subcommand_names(*this, *p); - if(!match.empty()) { - ignore_case_ = false; // we are throwing so need to be exception invariant - throw OptionAlreadyAdded("ignore case would cause subcommand name conflicts: " + match); - } - } - ignore_case_ = value; - return this; - } + App *ignore_case(bool value = true); /// Allow windows style options, such as `/opt`. First matching short or long name used. Subcommands inherit /// value. @@ -508,19 +449,7 @@ class App { } /// Ignore underscore. Subcommands inherit value. - App *ignore_underscore(bool value = true) { - if(value && !ignore_underscore_) { - ignore_underscore_ = true; - auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; - auto &match = _compare_subcommand_names(*this, *p); - if(!match.empty()) { - ignore_underscore_ = false; - throw OptionAlreadyAdded("ignore underscore would cause subcommand name conflicts: " + match); - } - } - ignore_underscore_ = value; - return this; - } + App *ignore_underscore(bool value = true); /// Set the help formatter App *formatter(std::shared_ptr<FormatterBase> fmt) { @@ -541,7 +470,7 @@ class App { } /// Check to see if this subcommand was parsed, true only if received on command line. - bool parsed() const { return parsed_ > 0; } + CLI11_NODISCARD bool parsed() const { return parsed_ > 0; } /// Get the OptionDefault object, to set option defaults OptionDefaults *option_defaults() { return &option_defaults_; } @@ -568,42 +497,7 @@ class App { callback_t option_callback, std::string option_description = "", bool defaulted = false, - std::function<std::string()> func = {}) { - Option myopt{option_name, option_description, option_callback, this}; - - if(std::find_if(std::begin(options_), std::end(options_), [&myopt](const Option_p &v) { - return *v == myopt; - }) == std::end(options_)) { - options_.emplace_back(); - Option_p &option = options_.back(); - option.reset(new Option(option_name, option_description, option_callback, this)); - - // Set the default string capture function - option->default_function(func); - - // For compatibility with CLI11 1.7 and before, capture the default string here - if(defaulted) - option->capture_default_str(); - - // Transfer defaults to the new option - option_defaults_.copy_to(option.get()); - - // Don't bother to capture if we already did - if(!defaulted && option->get_always_capture_default()) - option->capture_default_str(); - - return option.get(); - } - // we know something matches now find what it is so we can produce more error information - for(auto &opt : options_) { - auto &matchname = opt->matching_name(myopt); - if(!matchname.empty()) { - throw(OptionAlreadyAdded("added option matched existing option name: " + matchname)); - } - } - // this line should not be reached the above loop should trigger the throw - throw(OptionAlreadyAdded("added option matched existing option name")); // LCOV_EXCL_LINE - } + std::function<std::string()> func = {}); /// Add option for assigning to a variable template <typename AssignTo, @@ -685,103 +579,24 @@ class App { } /// Set a help flag, replace the existing one if present - Option *set_help_flag(std::string flag_name = "", const std::string &help_description = "") { - // take flag_description by const reference otherwise add_flag tries to assign to help_description - if(help_ptr_ != nullptr) { - remove_option(help_ptr_); - help_ptr_ = nullptr; - } - - // Empty name will simply remove the help flag - if(!flag_name.empty()) { - help_ptr_ = add_flag(flag_name, help_description); - help_ptr_->configurable(false); - } - - return help_ptr_; - } + Option *set_help_flag(std::string flag_name = "", const std::string &help_description = ""); /// Set a help all flag, replaced the existing one if present - Option *set_help_all_flag(std::string help_name = "", const std::string &help_description = "") { - // take flag_description by const reference otherwise add_flag tries to assign to flag_description - if(help_all_ptr_ != nullptr) { - remove_option(help_all_ptr_); - help_all_ptr_ = nullptr; - } - - // Empty name will simply remove the help all flag - if(!help_name.empty()) { - help_all_ptr_ = add_flag(help_name, help_description); - help_all_ptr_->configurable(false); - } - - return help_all_ptr_; - } + Option *set_help_all_flag(std::string help_name = "", const std::string &help_description = ""); /// Set a version flag and version display string, replace the existing one if present Option *set_version_flag(std::string flag_name = "", const std::string &versionString = "", - const std::string &version_help = "Display program version information and exit") { - // take flag_description by const reference otherwise add_flag tries to assign to version_description - if(version_ptr_ != nullptr) { - remove_option(version_ptr_); - version_ptr_ = nullptr; - } - - // Empty name will simply remove the version flag - if(!flag_name.empty()) { - version_ptr_ = add_flag_callback( - flag_name, [versionString]() { throw(CLI::CallForVersion(versionString, 0)); }, version_help); - version_ptr_->configurable(false); - } + const std::string &version_help = "Display program version information and exit"); - return version_ptr_; - } /// Generate the version string through a callback function Option *set_version_flag(std::string flag_name, std::function<std::string()> vfunc, - const std::string &version_help = "Display program version information and exit") { - if(version_ptr_ != nullptr) { - remove_option(version_ptr_); - version_ptr_ = nullptr; - } - - // Empty name will simply remove the version flag - if(!flag_name.empty()) { - version_ptr_ = add_flag_callback( - flag_name, [vfunc]() { throw(CLI::CallForVersion(vfunc(), 0)); }, version_help); - version_ptr_->configurable(false); - } - - return version_ptr_; - } + const std::string &version_help = "Display program version information and exit"); private: /// Internal function for adding a flag - Option *_add_flag_internal(std::string flag_name, CLI::callback_t fun, std::string flag_description) { - Option *opt; - if(detail::has_default_flag_values(flag_name)) { - // check for default values and if it has them - auto flag_defaults = detail::get_default_flag_values(flag_name); - detail::remove_default_flag_values(flag_name); - opt = add_option(std::move(flag_name), std::move(fun), std::move(flag_description), false); - for(const auto &fname : flag_defaults) - opt->fnames_.push_back(fname.first); - opt->default_flag_values_ = std::move(flag_defaults); - } else { - opt = add_option(std::move(flag_name), std::move(fun), std::move(flag_description), false); - } - // flags cannot have positional values - if(opt->get_positional()) { - auto pos_name = opt->get_name(true); - remove_option(opt); - throw IncorrectConstruction::PositionalFlag(pos_name); - } - opt->multi_option_policy(MultiOptionPolicy::TakeLast); - opt->expected(0); - opt->required(false); - return opt; - } + Option *_add_flag_internal(std::string flag_name, CLI::callback_t fun, std::string flag_description); public: /// Add a flag with no description or variable assignment @@ -797,42 +612,21 @@ class App { return _add_flag_internal(flag_name, CLI::callback_t(), flag_description); } - /// Add option for flag with integer result - defaults to allowing multiple passings, but can be forced to one - /// if `multi_option_policy(CLI::MultiOptionPolicy::Throw)` is used. - template <typename T, - enable_if_t<std::is_constructible<T, std::int64_t>::value && !is_bool<T>::value, detail::enabler> = - detail::dummy> - Option *add_flag(std::string flag_name, - T &flag_count, ///< A variable holding the count - std::string flag_description = "") { - flag_count = 0; - CLI::callback_t fun = [&flag_count](const CLI::results_t &res) { - try { - detail::sum_flag_vector(res, flag_count); - } catch(const std::invalid_argument &) { - return false; - } - return true; - }; - return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)) - ->multi_option_policy(MultiOptionPolicy::TakeAll); - } - /// Other type version accepts all other types that are not vectors such as bool, enum, string or other classes /// that can be converted from a string template <typename T, enable_if_t<!detail::is_mutable_container<T>::value && !std::is_const<T>::value && - (!std::is_constructible<T, std::int64_t>::value || is_bool<T>::value) && !std::is_constructible<std::function<void(int)>, T>::value, detail::enabler> = detail::dummy> Option *add_flag(std::string flag_name, - T &flag_result, ///< A variable holding true if passed + T &flag_result, ///< A variable holding the flag result std::string flag_description = "") { CLI::callback_t fun = [&flag_result](const CLI::results_t &res) { return CLI::detail::lexical_cast(res[0], flag_result); }; - return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description))->run_callback_for_default(); + auto *opt = _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)); + return detail::default_flag_modifiers<T>(opt); } /// Vector version to capture multiple flags. @@ -858,33 +652,12 @@ class App { /// Add option for callback that is triggered with a true flag and takes no arguments Option *add_flag_callback(std::string flag_name, std::function<void(void)> function, ///< A function to call, void(void) - std::string flag_description = "") { - - CLI::callback_t fun = [function](const CLI::results_t &res) { - bool trigger{false}; - auto result = CLI::detail::lexical_cast(res[0], trigger); - if(result && trigger) { - function(); - } - return result; - }; - return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)); - } + std::string flag_description = ""); /// Add option for callback with an integer value Option *add_flag_function(std::string flag_name, std::function<void(std::int64_t)> function, ///< A function to call, void(int) - std::string flag_description = "") { - - CLI::callback_t fun = [function](const CLI::results_t &res) { - std::int64_t flag_count = 0; - detail::sum_flag_vector(res, flag_count); - function(flag_count); - return true; - }; - return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)) - ->multi_option_policy(MultiOptionPolicy::TakeAll); - } + std::string flag_description = ""); #ifdef CLI11_CPP14 /// Add option for callback (C++14 or better only) @@ -899,50 +672,10 @@ class App { Option *set_config(std::string option_name = "", std::string default_filename = "", const std::string &help_message = "Read an ini file", - bool config_required = false) { - - // Remove existing config if present - if(config_ptr_ != nullptr) { - remove_option(config_ptr_); - config_ptr_ = nullptr; // need to remove the config_ptr completely - } - - // Only add config if option passed - if(!option_name.empty()) { - config_ptr_ = add_option(option_name, help_message); - if(config_required) { - config_ptr_->required(); - } - if(!default_filename.empty()) { - config_ptr_->default_str(std::move(default_filename)); - } - config_ptr_->configurable(false); - } - - return config_ptr_; - } + bool config_required = false); /// Removes an option from the App. Takes an option pointer. Returns true if found and removed. - bool remove_option(Option *opt) { - // Make sure no links exist - for(Option_p &op : options_) { - op->remove_needs(opt); - op->remove_excludes(opt); - } - - if(help_ptr_ == opt) - help_ptr_ = nullptr; - if(help_all_ptr_ == opt) - help_all_ptr_ = nullptr; - - auto iterator = - std::find_if(std::begin(options_), std::end(options_), [opt](const Option_p &v) { return v.get() == opt; }); - if(iterator != std::end(options_)) { - options_.erase(iterator); - return true; - } - return false; - } + bool remove_option(Option *opt); /// creates an option group as part of the given app template <typename T = Option_group> @@ -951,7 +684,7 @@ class App { throw IncorrectConstruction("option group names may not contain newlines or null characters"); } auto option_group = std::make_shared<T>(std::move(group_description), group_name, this); - auto ptr = option_group.get(); + auto *ptr = option_group.get(); // move to App_p for overload resolution on older gcc versions App_p app_ptr = std::dynamic_pointer_cast<App>(option_group); add_subcommand(std::move(app_ptr)); @@ -963,140 +696,44 @@ class App { ///@{ /// Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag - App *add_subcommand(std::string subcommand_name = "", std::string subcommand_description = "") { - if(!subcommand_name.empty() && !detail::valid_name_string(subcommand_name)) { - if(!detail::valid_first_char(subcommand_name[0])) { - throw IncorrectConstruction( - "Subcommand name starts with invalid character, '!' and '-' are not allowed"); - } - for(auto c : subcommand_name) { - if(!detail::valid_later_char(c)) { - throw IncorrectConstruction(std::string("Subcommand name contains invalid character ('") + c + - "'), all characters are allowed except" - "'=',':','{','}', and ' '"); - } - } - } - CLI::App_p subcom = std::shared_ptr<App>(new App(std::move(subcommand_description), subcommand_name, this)); - return add_subcommand(std::move(subcom)); - } + App *add_subcommand(std::string subcommand_name = "", std::string subcommand_description = ""); /// Add a previously created app as a subcommand - App *add_subcommand(CLI::App_p subcom) { - if(!subcom) - throw IncorrectConstruction("passed App is not valid"); - auto ckapp = (name_.empty() && parent_ != nullptr) ? _get_fallthrough_parent() : this; - auto &mstrg = _compare_subcommand_names(*subcom, *ckapp); - if(!mstrg.empty()) { - throw(OptionAlreadyAdded("subcommand name or alias matches existing subcommand: " + mstrg)); - } - subcom->parent_ = this; - subcommands_.push_back(std::move(subcom)); - return subcommands_.back().get(); - } + App *add_subcommand(CLI::App_p subcom); /// Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed. - bool remove_subcommand(App *subcom) { - // Make sure no links exist - for(App_p &sub : subcommands_) { - sub->remove_excludes(subcom); - sub->remove_needs(subcom); - } + bool remove_subcommand(App *subcom); - auto iterator = std::find_if( - std::begin(subcommands_), std::end(subcommands_), [subcom](const App_p &v) { return v.get() == subcom; }); - if(iterator != std::end(subcommands_)) { - subcommands_.erase(iterator); - return true; - } - return false; - } /// Check to see if a subcommand is part of this command (doesn't have to be in command line) /// returns the first subcommand if passed a nullptr - App *get_subcommand(const App *subcom) const { - if(subcom == nullptr) - throw OptionNotFound("nullptr passed"); - for(const App_p &subcomptr : subcommands_) - if(subcomptr.get() == subcom) - return subcomptr.get(); - throw OptionNotFound(subcom->get_name()); - } + App *get_subcommand(const App *subcom) const; /// Check to see if a subcommand is part of this command (text version) - App *get_subcommand(std::string subcom) const { - auto subc = _find_subcommand(subcom, false, false); - if(subc == nullptr) - throw OptionNotFound(subcom); - return subc; - } + CLI11_NODISCARD App *get_subcommand(std::string subcom) const; + /// Get a pointer to subcommand by index - App *get_subcommand(int index = 0) const { - if(index >= 0) { - auto uindex = static_cast<unsigned>(index); - if(uindex < subcommands_.size()) - return subcommands_[uindex].get(); - } - throw OptionNotFound(std::to_string(index)); - } + CLI11_NODISCARD App *get_subcommand(int index = 0) const; /// Check to see if a subcommand is part of this command and get a shared_ptr to it - CLI::App_p get_subcommand_ptr(App *subcom) const { - if(subcom == nullptr) - throw OptionNotFound("nullptr passed"); - for(const App_p &subcomptr : subcommands_) - if(subcomptr.get() == subcom) - return subcomptr; - throw OptionNotFound(subcom->get_name()); - } + CLI::App_p get_subcommand_ptr(App *subcom) const; /// Check to see if a subcommand is part of this command (text version) - CLI::App_p get_subcommand_ptr(std::string subcom) const { - for(const App_p &subcomptr : subcommands_) - if(subcomptr->check_name(subcom)) - return subcomptr; - throw OptionNotFound(subcom); - } + CLI11_NODISCARD CLI::App_p get_subcommand_ptr(std::string subcom) const; /// Get an owning pointer to subcommand by index - CLI::App_p get_subcommand_ptr(int index = 0) const { - if(index >= 0) { - auto uindex = static_cast<unsigned>(index); - if(uindex < subcommands_.size()) - return subcommands_[uindex]; - } - throw OptionNotFound(std::to_string(index)); - } + CLI11_NODISCARD CLI::App_p get_subcommand_ptr(int index = 0) const; /// Check to see if an option group is part of this App - App *get_option_group(std::string group_name) const { - for(const App_p &app : subcommands_) { - if(app->name_.empty() && app->group_ == group_name) { - return app.get(); - } - } - throw OptionNotFound(group_name); - } + CLI11_NODISCARD App *get_option_group(std::string group_name) const; /// No argument version of count counts the number of times this subcommand was /// passed in. The main app will return 1. Unnamed subcommands will also return 1 unless /// otherwise modified in a callback - std::size_t count() const { return parsed_; } + CLI11_NODISCARD std::size_t count() const { return parsed_; } /// Get a count of all the arguments processed in options and subcommands, this excludes arguments which were /// treated as extras. - std::size_t count_all() const { - std::size_t cnt{0}; - for(auto &opt : options_) { - cnt += opt->count(); - } - for(auto &sub : subcommands_) { - cnt += sub->count_all(); - } - if(!get_name().empty()) { // for named subcommands add the number of times the subcommand was called - cnt += parsed_; - } - return cnt; - } + CLI11_NODISCARD std::size_t count_all() const; /// Changes the group membership App *group(std::string group_name) { @@ -1187,199 +824,53 @@ class App { ///@{ // /// Reset the parsed data - void clear() { - - parsed_ = 0; - pre_parse_called_ = false; - - missing_.clear(); - parsed_subcommands_.clear(); - for(const Option_p &opt : options_) { - opt->clear(); - } - for(const App_p &subc : subcommands_) { - subc->clear(); - } - } + void clear(); /// Parses the command line - throws errors. /// This must be called after the options are in but before the rest of the program. - void parse(int argc, const char *const *argv) { - // If the name is not set, read from command line - if(name_.empty() || has_automatic_name_) { - has_automatic_name_ = true; - name_ = argv[0]; - } - - std::vector<std::string> args; - args.reserve(static_cast<std::size_t>(argc) - 1); - for(int i = argc - 1; i > 0; i--) - args.emplace_back(argv[i]); - parse(std::move(args)); - } + void parse(int argc, const char *const *argv); /// Parse a single string as if it contained command line arguments. /// This function splits the string into arguments then calls parse(std::vector<std::string> &) /// the function takes an optional boolean argument specifying if the programName is included in the string to /// process - void parse(std::string commandline, bool program_name_included = false) { - - if(program_name_included) { - auto nstr = detail::split_program_name(commandline); - if((name_.empty()) || (has_automatic_name_)) { - has_automatic_name_ = true; - name_ = nstr.first; - } - commandline = std::move(nstr.second); - } else { - detail::trim(commandline); - } - // the next section of code is to deal with quoted arguments after an '=' or ':' for windows like operations - if(!commandline.empty()) { - commandline = detail::find_and_modify(commandline, "=", detail::escape_detect); - if(allow_windows_style_options_) - commandline = detail::find_and_modify(commandline, ":", detail::escape_detect); - } - - auto args = detail::split_up(std::move(commandline)); - // remove all empty strings - args.erase(std::remove(args.begin(), args.end(), std::string{}), args.end()); - std::reverse(args.begin(), args.end()); - - parse(std::move(args)); - } + void parse(std::string commandline, bool program_name_included = false); /// The real work is done here. Expects a reversed vector. /// Changes the vector to the remaining options. - void parse(std::vector<std::string> &args) { - // Clear if parsed - if(parsed_ > 0) - clear(); - - // parsed_ is incremented in commands/subcommands, - // but placed here to make sure this is cleared when - // running parse after an error is thrown, even by _validate or _configure. - parsed_ = 1; - _validate(); - _configure(); - // set the parent as nullptr as this object should be the top now - parent_ = nullptr; - parsed_ = 0; - - _parse(args); - run_callback(); - } + void parse(std::vector<std::string> &args); /// The real work is done here. Expects a reversed vector. - void parse(std::vector<std::string> &&args) { - // Clear if parsed - if(parsed_ > 0) - clear(); - - // parsed_ is incremented in commands/subcommands, - // but placed here to make sure this is cleared when - // running parse after an error is thrown, even by _validate or _configure. - parsed_ = 1; - _validate(); - _configure(); - // set the parent as nullptr as this object should be the top now - parent_ = nullptr; - parsed_ = 0; - - _parse(std::move(args)); - run_callback(); - } - - void parse_from_stream(std::istream &input) { - if(parsed_ == 0) { - _validate(); - _configure(); - // set the parent as nullptr as this object should be the top now - } + void parse(std::vector<std::string> &&args); + + void parse_from_stream(std::istream &input); - _parse_stream(input); - run_callback(); - } /// Provide a function to print a help message. The function gets access to the App pointer and error. void failure_message(std::function<std::string(const App *, const Error &e)> function) { failure_message_ = function; } /// Print a nice error message and return the exit code - int exit(const Error &e, std::ostream &out = std::cout, std::ostream &err = std::cerr) const { - - /// Avoid printing anything if this is a CLI::RuntimeError - if(e.get_name() == "RuntimeError") - return e.get_exit_code(); - - if(e.get_name() == "CallForHelp") { - out << help(); - return e.get_exit_code(); - } - - if(e.get_name() == "CallForAllHelp") { - out << help("", AppFormatMode::All); - return e.get_exit_code(); - } - - if(e.get_name() == "CallForVersion") { - out << e.what() << std::endl; - return e.get_exit_code(); - } - - if(e.get_exit_code() != static_cast<int>(ExitCodes::Success)) { - if(failure_message_) - err << failure_message_(this, e) << std::flush; - } - - return e.get_exit_code(); - } + int exit(const Error &e, std::ostream &out = std::cout, std::ostream &err = std::cerr) const; ///@} /// @name Post parsing ///@{ /// Counts the number of times the given option was passed. - std::size_t count(std::string option_name) const { return get_option(option_name)->count(); } + CLI11_NODISCARD std::size_t count(std::string option_name) const { return get_option(option_name)->count(); } /// Get a subcommand pointer list to the currently selected subcommands (after parsing by default, in command /// line order; use parsed = false to get the original definition list.) - std::vector<App *> get_subcommands() const { return parsed_subcommands_; } + CLI11_NODISCARD std::vector<App *> get_subcommands() const { return parsed_subcommands_; } /// Get a filtered subcommand pointer list from the original definition list. An empty function will provide all /// subcommands (const) - std::vector<const App *> get_subcommands(const std::function<bool(const App *)> &filter) const { - std::vector<const App *> subcomms(subcommands_.size()); - std::transform(std::begin(subcommands_), std::end(subcommands_), std::begin(subcomms), [](const App_p &v) { - return v.get(); - }); - - if(filter) { - subcomms.erase(std::remove_if(std::begin(subcomms), - std::end(subcomms), - [&filter](const App *app) { return !filter(app); }), - std::end(subcomms)); - } - - return subcomms; - } + std::vector<const App *> get_subcommands(const std::function<bool(const App *)> &filter) const; /// Get a filtered subcommand pointer list from the original definition list. An empty function will provide all /// subcommands - std::vector<App *> get_subcommands(const std::function<bool(App *)> &filter) { - std::vector<App *> subcomms(subcommands_.size()); - std::transform(std::begin(subcommands_), std::end(subcommands_), std::begin(subcomms), [](const App_p &v) { - return v.get(); - }); - - if(filter) { - subcomms.erase( - std::remove_if(std::begin(subcomms), std::end(subcomms), [&filter](App *app) { return !filter(app); }), - std::end(subcomms)); - } - - return subcomms; - } + std::vector<App *> get_subcommands(const std::function<bool(App *)> &filter); /// Check to see if given subcommand was selected bool got_subcommand(const App *subcom) const { @@ -1388,7 +879,9 @@ class App { } /// Check with name instead of pointer to see if subcommand was selected - bool got_subcommand(std::string subcommand_name) const { return get_subcommand(subcommand_name)->parsed_ > 0; } + CLI11_NODISCARD bool got_subcommand(std::string subcommand_name) const { + return get_subcommand(subcommand_name)->parsed_ > 0; + } /// Sets excluded options for the subcommand App *excludes(Option *opt) { @@ -1435,47 +928,16 @@ class App { } /// Removes an option from the excludes list of this subcommand - bool remove_excludes(Option *opt) { - auto iterator = std::find(std::begin(exclude_options_), std::end(exclude_options_), opt); - if(iterator == std::end(exclude_options_)) { - return false; - } - exclude_options_.erase(iterator); - return true; - } + bool remove_excludes(Option *opt); /// Removes a subcommand from the excludes list of this subcommand - bool remove_excludes(App *app) { - auto iterator = std::find(std::begin(exclude_subcommands_), std::end(exclude_subcommands_), app); - if(iterator == std::end(exclude_subcommands_)) { - return false; - } - auto other_app = *iterator; - exclude_subcommands_.erase(iterator); - other_app->remove_excludes(this); - return true; - } + bool remove_excludes(App *app); /// Removes an option from the needs list of this subcommand - bool remove_needs(Option *opt) { - auto iterator = std::find(std::begin(need_options_), std::end(need_options_), opt); - if(iterator == std::end(need_options_)) { - return false; - } - need_options_.erase(iterator); - return true; - } + bool remove_needs(Option *opt); /// Removes a subcommand from the needs list of this subcommand - bool remove_needs(App *app) { - auto iterator = std::find(std::begin(need_subcommands_), std::end(need_subcommands_), app); - if(iterator == std::end(need_subcommands_)) { - return false; - } - need_subcommands_.erase(iterator); - return true; - } - + bool remove_needs(App *app); ///@} /// @name Help ///@{ @@ -1492,57 +954,30 @@ class App { } /// Produce a string that could be read in as a config of the current values of the App. Set default_also to /// include default arguments. write_descriptions will print a description for the App and for each option. - std::string config_to_str(bool default_also = false, bool write_description = false) const { + CLI11_NODISCARD std::string config_to_str(bool default_also = false, bool write_description = false) const { return config_formatter_->to_config(this, default_also, write_description, ""); } /// Makes a help message, using the currently configured formatter /// Will only do one subcommand at a time - std::string help(std::string prev = "", AppFormatMode mode = AppFormatMode::Normal) const { - if(prev.empty()) - prev = get_name(); - else - prev += " " + get_name(); - - // Delegate to subcommand if needed - auto selected_subcommands = get_subcommands(); - if(!selected_subcommands.empty()) { - return selected_subcommands.at(0)->help(prev, mode); - } - return formatter_->make_help(this, prev, mode); - } + CLI11_NODISCARD std::string help(std::string prev = "", AppFormatMode mode = AppFormatMode::Normal) const; /// Displays a version string - std::string version() const { - std::string val; - if(version_ptr_ != nullptr) { - auto rv = version_ptr_->results(); - version_ptr_->clear(); - version_ptr_->add_result("true"); - try { - version_ptr_->run_callback(); - } catch(const CLI::CallForVersion &cfv) { - val = cfv.what(); - } - version_ptr_->clear(); - version_ptr_->add_result(rv); - } - return val; - } + CLI11_NODISCARD std::string version() const; ///@} /// @name Getters ///@{ /// Access the formatter - std::shared_ptr<FormatterBase> get_formatter() const { return formatter_; } + CLI11_NODISCARD std::shared_ptr<FormatterBase> get_formatter() const { return formatter_; } /// Access the config formatter - std::shared_ptr<Config> get_config_formatter() const { return config_formatter_; } + CLI11_NODISCARD std::shared_ptr<Config> get_config_formatter() const { return config_formatter_; } /// Access the config formatter as a configBase pointer - std::shared_ptr<ConfigBase> get_config_formatter_base() const { + CLI11_NODISCARD std::shared_ptr<ConfigBase> get_config_formatter_base() const { // This is safer as a dynamic_cast if we have RTTI, as Config -> ConfigBase -#if defined(__cpp_rtti) || (defined(__GXX_RTTI) && __GXX_RTTI) || (defined(_HAS_STATIC_RTTI) && (_HAS_STATIC_RTTI == 0)) +#if CLI11_USE_STATIC_RTTI == 0 return std::dynamic_pointer_cast<ConfigBase>(config_formatter_); #else return std::static_pointer_cast<ConfigBase>(config_formatter_); @@ -1550,7 +985,7 @@ class App { } /// Get the app or subcommand description - std::string get_description() const { return description_; } + CLI11_NODISCARD std::string get_description() const { return description_; } /// Set the description of the app App *description(std::string app_description) { @@ -1559,79 +994,20 @@ class App { } /// Get the list of options (user facing function, so returns raw pointers), has optional filter function - std::vector<const Option *> get_options(const std::function<bool(const Option *)> filter = {}) const { - std::vector<const Option *> options(options_.size()); - std::transform(std::begin(options_), std::end(options_), std::begin(options), [](const Option_p &val) { - return val.get(); - }); - - if(filter) { - options.erase(std::remove_if(std::begin(options), - std::end(options), - [&filter](const Option *opt) { return !filter(opt); }), - std::end(options)); - } - - return options; - } + std::vector<const Option *> get_options(const std::function<bool(const Option *)> filter = {}) const; /// Non-const version of the above - std::vector<Option *> get_options(const std::function<bool(Option *)> filter = {}) { - std::vector<Option *> options(options_.size()); - std::transform(std::begin(options_), std::end(options_), std::begin(options), [](const Option_p &val) { - return val.get(); - }); - - if(filter) { - options.erase( - std::remove_if(std::begin(options), std::end(options), [&filter](Option *opt) { return !filter(opt); }), - std::end(options)); - } - - return options; - } + std::vector<Option *> get_options(const std::function<bool(Option *)> filter = {}); /// Get an option by name (noexcept non-const version) - Option *get_option_no_throw(std::string option_name) noexcept { - for(Option_p &opt : options_) { - if(opt->check_name(option_name)) { - return opt.get(); - } - } - for(auto &subc : subcommands_) { - // also check down into nameless subcommands - if(subc->get_name().empty()) { - auto opt = subc->get_option_no_throw(option_name); - if(opt != nullptr) { - return opt; - } - } - } - return nullptr; - } + Option *get_option_no_throw(std::string option_name) noexcept; /// Get an option by name (noexcept const version) - const Option *get_option_no_throw(std::string option_name) const noexcept { - for(const Option_p &opt : options_) { - if(opt->check_name(option_name)) { - return opt.get(); - } - } - for(const auto &subc : subcommands_) { - // also check down into nameless subcommands - if(subc->get_name().empty()) { - auto opt = subc->get_option_no_throw(option_name); - if(opt != nullptr) { - return opt; - } - } - } - return nullptr; - } + CLI11_NODISCARD const Option *get_option_no_throw(std::string option_name) const noexcept; /// Get an option by name - const Option *get_option(std::string option_name) const { - auto opt = get_option_no_throw(option_name); + CLI11_NODISCARD const Option *get_option(std::string option_name) const { + const auto *opt = get_option_no_throw(option_name); if(opt == nullptr) { throw OptionNotFound(option_name); } @@ -1640,7 +1016,7 @@ class App { /// Get an option by name (non-const version) Option *get_option(std::string option_name) { - auto opt = get_option_no_throw(option_name); + auto *opt = get_option_no_throw(option_name); if(opt == nullptr) { throw OptionNotFound(option_name); } @@ -1654,102 +1030,106 @@ class App { const Option *operator[](const char *option_name) const { return get_option(option_name); } /// Check the status of ignore_case - bool get_ignore_case() const { return ignore_case_; } + CLI11_NODISCARD bool get_ignore_case() const { return ignore_case_; } /// Check the status of ignore_underscore - bool get_ignore_underscore() const { return ignore_underscore_; } + CLI11_NODISCARD bool get_ignore_underscore() const { return ignore_underscore_; } /// Check the status of fallthrough - bool get_fallthrough() const { return fallthrough_; } + CLI11_NODISCARD bool get_fallthrough() const { return fallthrough_; } /// Check the status of the allow windows style options - bool get_allow_windows_style_options() const { return allow_windows_style_options_; } + CLI11_NODISCARD bool get_allow_windows_style_options() const { return allow_windows_style_options_; } /// Check the status of the allow windows style options - bool get_positionals_at_end() const { return positionals_at_end_; } + CLI11_NODISCARD bool get_positionals_at_end() const { return positionals_at_end_; } /// Check the status of the allow windows style options - bool get_configurable() const { return configurable_; } + CLI11_NODISCARD bool get_configurable() const { return configurable_; } /// Get the group of this subcommand - const std::string &get_group() const { return group_; } + CLI11_NODISCARD const std::string &get_group() const { return group_; } /// Generate and return the footer. - std::string get_footer() const { return (footer_callback_) ? footer_callback_() + '\n' + footer_ : footer_; } + CLI11_NODISCARD std::string get_footer() const { + return (footer_callback_) ? footer_callback_() + '\n' + footer_ : footer_; + } /// Get the required min subcommand value - std::size_t get_require_subcommand_min() const { return require_subcommand_min_; } + CLI11_NODISCARD std::size_t get_require_subcommand_min() const { return require_subcommand_min_; } /// Get the required max subcommand value - std::size_t get_require_subcommand_max() const { return require_subcommand_max_; } + CLI11_NODISCARD std::size_t get_require_subcommand_max() const { return require_subcommand_max_; } /// Get the required min option value - std::size_t get_require_option_min() const { return require_option_min_; } + CLI11_NODISCARD std::size_t get_require_option_min() const { return require_option_min_; } /// Get the required max option value - std::size_t get_require_option_max() const { return require_option_max_; } + CLI11_NODISCARD std::size_t get_require_option_max() const { return require_option_max_; } /// Get the prefix command status - bool get_prefix_command() const { return prefix_command_; } + CLI11_NODISCARD bool get_prefix_command() const { return prefix_command_; } /// Get the status of allow extras - bool get_allow_extras() const { return allow_extras_; } + CLI11_NODISCARD bool get_allow_extras() const { return allow_extras_; } /// Get the status of required - bool get_required() const { return required_; } + CLI11_NODISCARD bool get_required() const { return required_; } /// Get the status of disabled - bool get_disabled() const { return disabled_; } + CLI11_NODISCARD bool get_disabled() const { return disabled_; } /// Get the status of silence - bool get_silent() const { return silent_; } + CLI11_NODISCARD bool get_silent() const { return silent_; } /// Get the status of disabled - bool get_immediate_callback() const { return immediate_callback_; } + CLI11_NODISCARD bool get_immediate_callback() const { return immediate_callback_; } /// Get the status of disabled by default - bool get_disabled_by_default() const { return (default_startup == startup_mode::disabled); } + CLI11_NODISCARD bool get_disabled_by_default() const { return (default_startup == startup_mode::disabled); } /// Get the status of disabled by default - bool get_enabled_by_default() const { return (default_startup == startup_mode::enabled); } + CLI11_NODISCARD bool get_enabled_by_default() const { return (default_startup == startup_mode::enabled); } /// Get the status of validating positionals - bool get_validate_positionals() const { return validate_positionals_; } + CLI11_NODISCARD bool get_validate_positionals() const { return validate_positionals_; } + /// Get the status of validating optional vector arguments + CLI11_NODISCARD bool get_validate_optional_arguments() const { return validate_optional_arguments_; } /// Get the status of allow extras - config_extras_mode get_allow_config_extras() const { return allow_config_extras_; } + CLI11_NODISCARD config_extras_mode get_allow_config_extras() const { return allow_config_extras_; } /// Get a pointer to the help flag. Option *get_help_ptr() { return help_ptr_; } /// Get a pointer to the help flag. (const) - const Option *get_help_ptr() const { return help_ptr_; } + CLI11_NODISCARD const Option *get_help_ptr() const { return help_ptr_; } /// Get a pointer to the help all flag. (const) - const Option *get_help_all_ptr() const { return help_all_ptr_; } + CLI11_NODISCARD const Option *get_help_all_ptr() const { return help_all_ptr_; } /// Get a pointer to the config option. Option *get_config_ptr() { return config_ptr_; } /// Get a pointer to the config option. (const) - const Option *get_config_ptr() const { return config_ptr_; } + CLI11_NODISCARD const Option *get_config_ptr() const { return config_ptr_; } /// Get a pointer to the version option. Option *get_version_ptr() { return version_ptr_; } /// Get a pointer to the version option. (const) - const Option *get_version_ptr() const { return version_ptr_; } + CLI11_NODISCARD const Option *get_version_ptr() const { return version_ptr_; } /// Get the parent of this subcommand (or nullptr if main app) App *get_parent() { return parent_; } /// Get the parent of this subcommand (or nullptr if main app) (const version) - const App *get_parent() const { return parent_; } + CLI11_NODISCARD const App *get_parent() const { return parent_; } /// Get the name of the current app - const std::string &get_name() const { return name_; } + CLI11_NODISCARD const std::string &get_name() const { return name_; } /// Get the aliases of the current app - const std::vector<std::string> &get_aliases() const { return aliases_; } + CLI11_NODISCARD const std::vector<std::string> &get_aliases() const { return aliases_; } /// clear all the aliases of the current App App *clear_aliases() { @@ -1758,116 +1138,25 @@ class App { } /// Get a display name for an app - std::string get_display_name(bool with_aliases = false) const { - if(name_.empty()) { - return std::string("[Option Group: ") + get_group() + "]"; - } - if(aliases_.empty() || !with_aliases) { - return name_; - } - std::string dispname = name_; - for(const auto &lalias : aliases_) { - dispname.push_back(','); - dispname.push_back(' '); - dispname.append(lalias); - } - return dispname; - } + CLI11_NODISCARD std::string get_display_name(bool with_aliases = false) const; /// Check the name, case insensitive and underscore insensitive if set - bool check_name(std::string name_to_check) const { - std::string local_name = name_; - if(ignore_underscore_) { - local_name = detail::remove_underscore(name_); - name_to_check = detail::remove_underscore(name_to_check); - } - if(ignore_case_) { - local_name = detail::to_lower(name_); - name_to_check = detail::to_lower(name_to_check); - } - - if(local_name == name_to_check) { - return true; - } - for(auto les : aliases_) { - if(ignore_underscore_) { - les = detail::remove_underscore(les); - } - if(ignore_case_) { - les = detail::to_lower(les); - } - if(les == name_to_check) { - return true; - } - } - return false; - } + CLI11_NODISCARD bool check_name(std::string name_to_check) const; /// Get the groups available directly from this option (in order) - std::vector<std::string> get_groups() const { - std::vector<std::string> groups; - - for(const Option_p &opt : options_) { - // Add group if it is not already in there - if(std::find(groups.begin(), groups.end(), opt->get_group()) == groups.end()) { - groups.push_back(opt->get_group()); - } - } - - return groups; - } + CLI11_NODISCARD std::vector<std::string> get_groups() const; /// This gets a vector of pointers with the original parse order - const std::vector<Option *> &parse_order() const { return parse_order_; } + CLI11_NODISCARD const std::vector<Option *> &parse_order() const { return parse_order_; } /// This returns the missing options from the current subcommand - std::vector<std::string> remaining(bool recurse = false) const { - std::vector<std::string> miss_list; - for(const std::pair<detail::Classifier, std::string> &miss : missing_) { - miss_list.push_back(std::get<1>(miss)); - } - // Get from a subcommand that may allow extras - if(recurse) { - if(!allow_extras_) { - for(const auto &sub : subcommands_) { - if(sub->name_.empty() && !sub->missing_.empty()) { - for(const std::pair<detail::Classifier, std::string> &miss : sub->missing_) { - miss_list.push_back(std::get<1>(miss)); - } - } - } - } - // Recurse into subcommands - - for(const App *sub : parsed_subcommands_) { - std::vector<std::string> output = sub->remaining(recurse); - std::copy(std::begin(output), std::end(output), std::back_inserter(miss_list)); - } - } - return miss_list; - } + CLI11_NODISCARD std::vector<std::string> remaining(bool recurse = false) const; /// This returns the missing options in a form ready for processing by another command line program - std::vector<std::string> remaining_for_passthrough(bool recurse = false) const { - std::vector<std::string> miss_list = remaining(recurse); - std::reverse(std::begin(miss_list), std::end(miss_list)); - return miss_list; - } + CLI11_NODISCARD std::vector<std::string> remaining_for_passthrough(bool recurse = false) const; /// This returns the number of remaining options, minus the -- separator - std::size_t remaining_size(bool recurse = false) const { - auto remaining_options = static_cast<std::size_t>(std::count_if( - std::begin(missing_), std::end(missing_), [](const std::pair<detail::Classifier, std::string> &val) { - return val.first != detail::Classifier::POSITIONAL_MARK; - })); - - if(recurse) { - for(const App_p &sub : subcommands_) { - remaining_options += sub->remaining_size(recurse); - } - } - return remaining_options; - } + CLI11_NODISCARD std::size_t remaining_size(bool recurse = false) const; ///@} @@ -1876,1107 +1165,118 @@ class App { /// /// Currently checks to see if multiple positionals exist with unlimited args and checks if the min and max options /// are feasible - void _validate() const { - // count the number of positional only args - auto pcount = std::count_if(std::begin(options_), std::end(options_), [](const Option_p &opt) { - return opt->get_items_expected_max() >= detail::expected_max_vector_size && !opt->nonpositional(); - }); - if(pcount > 1) { - auto pcount_req = std::count_if(std::begin(options_), std::end(options_), [](const Option_p &opt) { - return opt->get_items_expected_max() >= detail::expected_max_vector_size && !opt->nonpositional() && - opt->get_required(); - }); - if(pcount - pcount_req > 1) { - throw InvalidError(name_); - } - } - - std::size_t nameless_subs{0}; - for(const App_p &app : subcommands_) { - app->_validate(); - if(app->get_name().empty()) - ++nameless_subs; - } - - if(require_option_min_ > 0) { - if(require_option_max_ > 0) { - if(require_option_max_ < require_option_min_) { - throw(InvalidError("Required min options greater than required max options", - ExitCodes::InvalidError)); - } - } - if(require_option_min_ > (options_.size() + nameless_subs)) { - throw(InvalidError("Required min options greater than number of available options", - ExitCodes::InvalidError)); - } - } - } + void _validate() const; /// configure subcommands to enable parsing through the current object /// set the correct fallthrough and prefix for nameless subcommands and manage the automatic enable or disable /// makes sure parent is set correctly - void _configure() { - if(default_startup == startup_mode::enabled) { - disabled_ = false; - } else if(default_startup == startup_mode::disabled) { - disabled_ = true; - } - for(const App_p &app : subcommands_) { - if(app->has_automatic_name_) { - app->name_.clear(); - } - if(app->name_.empty()) { - app->fallthrough_ = false; // make sure fallthrough_ is false to prevent infinite loop - app->prefix_command_ = false; - } - // make sure the parent is set to be this object in preparation for parse - app->parent_ = this; - app->_configure(); - } - } + void _configure(); /// Internal function to run (App) callback, bottom up - void run_callback(bool final_mode = false, bool suppress_final_callback = false) { - pre_callback(); - // in the main app if immediate_callback_ is set it runs the main callback before the used subcommands - if(!final_mode && parse_complete_callback_) { - parse_complete_callback_(); - } - // run the callbacks for the received subcommands - for(App *subc : get_subcommands()) { - subc->run_callback(true, suppress_final_callback); - } - // now run callbacks for option_groups - for(auto &subc : subcommands_) { - if(subc->name_.empty() && subc->count_all() > 0) { - subc->run_callback(true, suppress_final_callback); - } - } - - // finally run the main callback - if(final_callback_ && (parsed_ > 0) && (!suppress_final_callback)) { - if(!name_.empty() || count_all() > 0 || parent_ == nullptr) { - final_callback_(); - } - } - } + void run_callback(bool final_mode = false, bool suppress_final_callback = false); /// Check to see if a subcommand is valid. Give up immediately if subcommand max has been reached. - bool _valid_subcommand(const std::string ¤t, bool ignore_used = true) const { - // Don't match if max has been reached - but still check parents - if(require_subcommand_max_ != 0 && parsed_subcommands_.size() >= require_subcommand_max_) { - return parent_ != nullptr && parent_->_valid_subcommand(current, ignore_used); - } - auto com = _find_subcommand(current, true, ignore_used); - if(com != nullptr) { - return true; - } - // Check parent if exists, else return false - return parent_ != nullptr && parent_->_valid_subcommand(current, ignore_used); - } + CLI11_NODISCARD bool _valid_subcommand(const std::string ¤t, bool ignore_used = true) const; /// Selects a Classifier enum based on the type of the current argument - detail::Classifier _recognize(const std::string ¤t, bool ignore_used_subcommands = true) const { - std::string dummy1, dummy2; - - if(current == "--") - return detail::Classifier::POSITIONAL_MARK; - if(_valid_subcommand(current, ignore_used_subcommands)) - return detail::Classifier::SUBCOMMAND; - if(detail::split_long(current, dummy1, dummy2)) - return detail::Classifier::LONG; - if(detail::split_short(current, dummy1, dummy2)) { - if(dummy1[0] >= '0' && dummy1[0] <= '9') { - if(get_option_no_throw(std::string{'-', dummy1[0]}) == nullptr) { - return detail::Classifier::NONE; - } - } - return detail::Classifier::SHORT; - } - if((allow_windows_style_options_) && (detail::split_windows_style(current, dummy1, dummy2))) - return detail::Classifier::WINDOWS_STYLE; - if((current == "++") && !name_.empty() && parent_ != nullptr) - return detail::Classifier::SUBCOMMAND_TERMINATOR; - return detail::Classifier::NONE; - } + CLI11_NODISCARD detail::Classifier _recognize(const std::string ¤t, + bool ignore_used_subcommands = true) const; // The parse function is now broken into several parts, and part of process /// Read and process a configuration file (main app only) - void _process_config_file() { - if(config_ptr_ != nullptr) { - bool config_required = config_ptr_->get_required(); - auto file_given = config_ptr_->count() > 0; - auto config_files = config_ptr_->as<std::vector<std::string>>(); - if(config_files.empty() || config_files.front().empty()) { - if(config_required) { - throw FileError::Missing("no specified config file"); - } - return; - } - for(auto rit = config_files.rbegin(); rit != config_files.rend(); ++rit) { - const auto &config_file = *rit; - auto path_result = detail::check_path(config_file.c_str()); - if(path_result == detail::path_type::file) { - try { - std::vector<ConfigItem> values = config_formatter_->from_file(config_file); - _parse_config(values); - if(!file_given) { - config_ptr_->add_result(config_file); - } - } catch(const FileError &) { - if(config_required || file_given) - throw; - } - } else if(config_required || file_given) { - throw FileError::Missing(config_file); - } - } - } - } + void _process_config_file(); /// Get envname options if not yet passed. Runs on *all* subcommands. - void _process_env() { - for(const Option_p &opt : options_) { - if(opt->count() == 0 && !opt->envname_.empty()) { - char *buffer = nullptr; - std::string ename_string; - -#ifdef _MSC_VER - // Windows version - std::size_t sz = 0; - if(_dupenv_s(&buffer, &sz, opt->envname_.c_str()) == 0 && buffer != nullptr) { - ename_string = std::string(buffer); - free(buffer); - } -#else - // This also works on Windows, but gives a warning - buffer = std::getenv(opt->envname_.c_str()); - if(buffer != nullptr) - ename_string = std::string(buffer); -#endif - - if(!ename_string.empty()) { - opt->add_result(ename_string); - } - } - } - - for(App_p &sub : subcommands_) { - if(sub->get_name().empty() || !sub->parse_complete_callback_) - sub->_process_env(); - } - } + void _process_env(); /// Process callbacks. Runs on *all* subcommands. - void _process_callbacks() { - - for(App_p &sub : subcommands_) { - // process the priority option_groups first - if(sub->get_name().empty() && sub->parse_complete_callback_) { - if(sub->count_all() > 0) { - sub->_process_callbacks(); - sub->run_callback(); - } - } - } - - for(const Option_p &opt : options_) { - if((*opt) && !opt->get_callback_run()) { - opt->run_callback(); - } - } - for(App_p &sub : subcommands_) { - if(!sub->parse_complete_callback_) { - sub->_process_callbacks(); - } - } - } + void _process_callbacks(); /// Run help flag processing if any are found. /// /// The flags allow recursive calls to remember if there was a help flag on a parent. - void _process_help_flags(bool trigger_help = false, bool trigger_all_help = false) const { - const Option *help_ptr = get_help_ptr(); - const Option *help_all_ptr = get_help_all_ptr(); - - if(help_ptr != nullptr && help_ptr->count() > 0) - trigger_help = true; - if(help_all_ptr != nullptr && help_all_ptr->count() > 0) - trigger_all_help = true; - - // If there were parsed subcommands, call those. First subcommand wins if there are multiple ones. - if(!parsed_subcommands_.empty()) { - for(const App *sub : parsed_subcommands_) - sub->_process_help_flags(trigger_help, trigger_all_help); - - // Only the final subcommand should call for help. All help wins over help. - } else if(trigger_all_help) { - throw CallForAllHelp(); - } else if(trigger_help) { - throw CallForHelp(); - } - } + void _process_help_flags(bool trigger_help = false, bool trigger_all_help = false) const; /// Verify required options and cross requirements. Subcommands too (only if selected). - void _process_requirements() { - // check excludes - bool excluded{false}; - std::string excluder; - for(auto &opt : exclude_options_) { - if(opt->count() > 0) { - excluded = true; - excluder = opt->get_name(); - } - } - for(auto &subc : exclude_subcommands_) { - if(subc->count_all() > 0) { - excluded = true; - excluder = subc->get_display_name(); - } - } - if(excluded) { - if(count_all() > 0) { - throw ExcludesError(get_display_name(), excluder); - } - // if we are excluded but didn't receive anything, just return - return; - } - - // check excludes - bool missing_needed{false}; - std::string missing_need; - for(auto &opt : need_options_) { - if(opt->count() == 0) { - missing_needed = true; - missing_need = opt->get_name(); - } - } - for(auto &subc : need_subcommands_) { - if(subc->count_all() == 0) { - missing_needed = true; - missing_need = subc->get_display_name(); - } - } - if(missing_needed) { - if(count_all() > 0) { - throw RequiresError(get_display_name(), missing_need); - } - // if we missing something but didn't have any options, just return - return; - } - - std::size_t used_options = 0; - for(const Option_p &opt : options_) { - - if(opt->count() != 0) { - ++used_options; - } - // Required but empty - if(opt->get_required() && opt->count() == 0) { - throw RequiredError(opt->get_name()); - } - // Requires - for(const Option *opt_req : opt->needs_) - if(opt->count() > 0 && opt_req->count() == 0) - throw RequiresError(opt->get_name(), opt_req->get_name()); - // Excludes - for(const Option *opt_ex : opt->excludes_) - if(opt->count() > 0 && opt_ex->count() != 0) - throw ExcludesError(opt->get_name(), opt_ex->get_name()); - } - // check for the required number of subcommands - if(require_subcommand_min_ > 0) { - auto selected_subcommands = get_subcommands(); - if(require_subcommand_min_ > selected_subcommands.size()) - throw RequiredError::Subcommand(require_subcommand_min_); - } - - // Max error cannot occur, the extra subcommand will parse as an ExtrasError or a remaining item. - - // run this loop to check how many unnamed subcommands were actually used since they are considered options - // from the perspective of an App - for(App_p &sub : subcommands_) { - if(sub->disabled_) - continue; - if(sub->name_.empty() && sub->count_all() > 0) { - ++used_options; - } - } - - if(require_option_min_ > used_options || (require_option_max_ > 0 && require_option_max_ < used_options)) { - auto option_list = detail::join(options_, [this](const Option_p &ptr) { - if(ptr.get() == help_ptr_ || ptr.get() == help_all_ptr_) { - return std::string{}; - } - return ptr->get_name(false, true); - }); - - auto subc_list = get_subcommands([](App *app) { return ((app->get_name().empty()) && (!app->disabled_)); }); - if(!subc_list.empty()) { - option_list += "," + detail::join(subc_list, [](const App *app) { return app->get_display_name(); }); - } - throw RequiredError::Option(require_option_min_, require_option_max_, used_options, option_list); - } - - // now process the requirements for subcommands if needed - for(App_p &sub : subcommands_) { - if(sub->disabled_) - continue; - if(sub->name_.empty() && sub->required_ == false) { - if(sub->count_all() == 0) { - if(require_option_min_ > 0 && require_option_min_ <= used_options) { - continue; - // if we have met the requirement and there is nothing in this option group skip checking - // requirements - } - if(require_option_max_ > 0 && used_options >= require_option_min_) { - continue; - // if we have met the requirement and there is nothing in this option group skip checking - // requirements - } - } - } - if(sub->count() > 0 || sub->name_.empty()) { - sub->_process_requirements(); - } - - if(sub->required_ && sub->count_all() == 0) { - throw(CLI::RequiredError(sub->get_display_name())); - } - } - } + void _process_requirements(); /// Process callbacks and such. - void _process() { - CLI::FileError fe("ne"); - bool caught_error{false}; - try { - // the config file might generate a FileError but that should not be processed until later in the process - // to allow for help, version and other errors to generate first. - _process_config_file(); - // process env shouldn't throw but no reason to process it if config generated an error - _process_env(); - } catch(const CLI::FileError &fe2) { - fe = fe2; - caught_error = true; - } - // callbacks and help_flags can generate exceptions which should take priority over the config file error if one - // exists - _process_callbacks(); - _process_help_flags(); - - if(caught_error) { - throw CLI::FileError(std::move(fe)); - } - - _process_requirements(); - } + void _process(); /// Throw an error if anything is left over and should not be. - void _process_extras() { - if(!(allow_extras_ || prefix_command_)) { - std::size_t num_left_over = remaining_size(); - if(num_left_over > 0) { - throw ExtrasError(name_, remaining(false)); - } - } - - for(App_p &sub : subcommands_) { - if(sub->count() > 0) - sub->_process_extras(); - } - } + void _process_extras(); /// Throw an error if anything is left over and should not be. /// Modifies the args to fill in the missing items before throwing. - void _process_extras(std::vector<std::string> &args) { - if(!(allow_extras_ || prefix_command_)) { - std::size_t num_left_over = remaining_size(); - if(num_left_over > 0) { - args = remaining(false); - throw ExtrasError(name_, args); - } - } - - for(App_p &sub : subcommands_) { - if(sub->count() > 0) - sub->_process_extras(args); - } - } + void _process_extras(std::vector<std::string> &args); /// Internal function to recursively increment the parsed counter on the current app as well unnamed subcommands - void increment_parsed() { - ++parsed_; - for(App_p &sub : subcommands_) { - if(sub->get_name().empty()) - sub->increment_parsed(); - } - } - /// Internal parse function - void _parse(std::vector<std::string> &args) { - increment_parsed(); - _trigger_pre_parse(args.size()); - bool positional_only = false; - - while(!args.empty()) { - if(!_parse_single(args, positional_only)) { - break; - } - } - - if(parent_ == nullptr) { - _process(); - - // Throw error if any items are left over (depending on settings) - _process_extras(args); - - // Convert missing (pairs) to extras (string only) ready for processing in another app - args = remaining_for_passthrough(false); - } else if(parse_complete_callback_) { - _process_env(); - _process_callbacks(); - _process_help_flags(); - _process_requirements(); - run_callback(false, true); - } - } + void increment_parsed(); /// Internal parse function - void _parse(std::vector<std::string> &&args) { - // this can only be called by the top level in which case parent == nullptr by definition - // operation is simplified - increment_parsed(); - _trigger_pre_parse(args.size()); - bool positional_only = false; - - while(!args.empty()) { - _parse_single(args, positional_only); - } - _process(); + void _parse(std::vector<std::string> &args); - // Throw error if any items are left over (depending on settings) - _process_extras(); - } + /// Internal parse function + void _parse(std::vector<std::string> &&args); /// Internal function to parse a stream - void _parse_stream(std::istream &input) { - auto values = config_formatter_->from_config(input); - _parse_config(values); - increment_parsed(); - _trigger_pre_parse(values.size()); - _process(); - - // Throw error if any items are left over (depending on settings) - _process_extras(); - } + void _parse_stream(std::istream &input); /// Parse one config param, return false if not found in any subcommand, remove if it is /// /// If this has more than one dot.separated.name, go into the subcommand matching it /// Returns true if it managed to find the option, if false you'll need to remove the arg manually. - void _parse_config(const std::vector<ConfigItem> &args) { - for(const ConfigItem &item : args) { - if(!_parse_single_config(item) && allow_config_extras_ == config_extras_mode::error) - throw ConfigError::Extras(item.fullname()); - } - } + void _parse_config(const std::vector<ConfigItem> &args); /// Fill in a single config option - bool _parse_single_config(const ConfigItem &item, std::size_t level = 0) { - if(level < item.parents.size()) { - try { - auto subcom = get_subcommand(item.parents.at(level)); - auto result = subcom->_parse_single_config(item, level + 1); - - return result; - } catch(const OptionNotFound &) { - return false; - } - } - // check for section open - if(item.name == "++") { - if(configurable_) { - increment_parsed(); - _trigger_pre_parse(2); - if(parent_ != nullptr) { - parent_->parsed_subcommands_.push_back(this); - } - } - return true; - } - // check for section close - if(item.name == "--") { - if(configurable_) { - _process_callbacks(); - _process_requirements(); - run_callback(); - } - return true; - } - Option *op = get_option_no_throw("--" + item.name); - if(op == nullptr) { - if(item.name.size() == 1) { - op = get_option_no_throw("-" + item.name); - } - } - if(op == nullptr) { - op = get_option_no_throw(item.name); - } - if(op == nullptr) { - // If the option was not present - if(get_allow_config_extras() == config_extras_mode::capture) - // Should we worry about classifying the extras properly? - missing_.emplace_back(detail::Classifier::NONE, item.fullname()); - return false; - } - - if(!op->get_configurable()) { - if(get_allow_config_extras() == config_extras_mode::ignore_all) { - return false; - } - throw ConfigError::NotConfigurable(item.fullname()); - } - - if(op->empty()) { - // Flag parsing - if(op->get_expected_min() == 0) { - auto res = config_formatter_->to_flag(item); - res = op->get_flag_value(item.name, res); - - op->add_result(res); - - } else { - op->add_result(item.inputs); - op->run_callback(); - } - } - - return true; - } + bool _parse_single_config(const ConfigItem &item, std::size_t level = 0); /// Parse "one" argument (some may eat more than one), delegate to parent if fails, add to missing if missing /// from main return false if the parse has failed and needs to return to parent - bool _parse_single(std::vector<std::string> &args, bool &positional_only) { - bool retval = true; - detail::Classifier classifier = positional_only ? detail::Classifier::NONE : _recognize(args.back()); - switch(classifier) { - case detail::Classifier::POSITIONAL_MARK: - args.pop_back(); - positional_only = true; - if((!_has_remaining_positionals()) && (parent_ != nullptr)) { - retval = false; - } else { - _move_to_missing(classifier, "--"); - } - break; - case detail::Classifier::SUBCOMMAND_TERMINATOR: - // treat this like a positional mark if in the parent app - args.pop_back(); - retval = false; - break; - case detail::Classifier::SUBCOMMAND: - retval = _parse_subcommand(args); - break; - case detail::Classifier::LONG: - case detail::Classifier::SHORT: - case detail::Classifier::WINDOWS_STYLE: - // If already parsed a subcommand, don't accept options_ - _parse_arg(args, classifier); - break; - case detail::Classifier::NONE: - // Probably a positional or something for a parent (sub)command - retval = _parse_positional(args, false); - if(retval && positionals_at_end_) { - positional_only = true; - } - break; - // LCOV_EXCL_START - default: - throw HorribleError("unrecognized classifier (you should not see this!)"); - // LCOV_EXCL_STOP - } - return retval; - } + bool _parse_single(std::vector<std::string> &args, bool &positional_only); /// Count the required remaining positional arguments - std::size_t _count_remaining_positionals(bool required_only = false) const { - std::size_t retval = 0; - for(const Option_p &opt : options_) { - if(opt->get_positional() && (!required_only || opt->get_required())) { - if(opt->get_items_expected_min() > 0 && - static_cast<int>(opt->count()) < opt->get_items_expected_min()) { - retval += static_cast<std::size_t>(opt->get_items_expected_min()) - opt->count(); - } - } - } - return retval; - } + CLI11_NODISCARD std::size_t _count_remaining_positionals(bool required_only = false) const; /// Count the required remaining positional arguments - bool _has_remaining_positionals() const { - for(const Option_p &opt : options_) { - if(opt->get_positional() && ((static_cast<int>(opt->count()) < opt->get_items_expected_min()))) { - return true; - } - } - - return false; - } + CLI11_NODISCARD bool _has_remaining_positionals() const; /// Parse a positional, go up the tree to check /// @param haltOnSubcommand if set to true the operation will not process subcommands merely return false /// Return true if the positional was used false otherwise - bool _parse_positional(std::vector<std::string> &args, bool haltOnSubcommand) { - - const std::string &positional = args.back(); - - if(positionals_at_end_) { - // deal with the case of required arguments at the end which should take precedence over other arguments - auto arg_rem = args.size(); - auto remreq = _count_remaining_positionals(true); - if(arg_rem <= remreq) { - for(const Option_p &opt : options_) { - if(opt->get_positional() && opt->required_) { - if(static_cast<int>(opt->count()) < opt->get_items_expected_min()) { - if(validate_positionals_) { - std::string pos = positional; - pos = opt->_validate(pos, 0); - if(!pos.empty()) { - continue; - } - } - opt->add_result(positional); - parse_order_.push_back(opt.get()); - args.pop_back(); - return true; - } - } - } - } - } - for(const Option_p &opt : options_) { - // Eat options, one by one, until done - if(opt->get_positional() && - (static_cast<int>(opt->count()) < opt->get_items_expected_min() || opt->get_allow_extra_args())) { - if(validate_positionals_) { - std::string pos = positional; - pos = opt->_validate(pos, 0); - if(!pos.empty()) { - continue; - } - } - opt->add_result(positional); - parse_order_.push_back(opt.get()); - args.pop_back(); - return true; - } - } - - for(auto &subc : subcommands_) { - if((subc->name_.empty()) && (!subc->disabled_)) { - if(subc->_parse_positional(args, false)) { - if(!subc->pre_parse_called_) { - subc->_trigger_pre_parse(args.size()); - } - return true; - } - } - } - // let the parent deal with it if possible - if(parent_ != nullptr && fallthrough_) - return _get_fallthrough_parent()->_parse_positional(args, static_cast<bool>(parse_complete_callback_)); - - /// Try to find a local subcommand that is repeated - auto com = _find_subcommand(args.back(), true, false); - if(com != nullptr && (require_subcommand_max_ == 0 || require_subcommand_max_ > parsed_subcommands_.size())) { - if(haltOnSubcommand) { - return false; - } - args.pop_back(); - com->_parse(args); - return true; - } - /// now try one last gasp at subcommands that have been executed before, go to root app and try to find a - /// subcommand in a broader way, if one exists let the parent deal with it - auto parent_app = (parent_ != nullptr) ? _get_fallthrough_parent() : this; - com = parent_app->_find_subcommand(args.back(), true, false); - if(com != nullptr && (com->parent_->require_subcommand_max_ == 0 || - com->parent_->require_subcommand_max_ > com->parent_->parsed_subcommands_.size())) { - return false; - } - - if(positionals_at_end_) { - throw CLI::ExtrasError(name_, args); - } - /// If this is an option group don't deal with it - if(parent_ != nullptr && name_.empty()) { - return false; - } - /// We are out of other options this goes to missing - _move_to_missing(detail::Classifier::NONE, positional); - args.pop_back(); - if(prefix_command_) { - while(!args.empty()) { - _move_to_missing(detail::Classifier::NONE, args.back()); - args.pop_back(); - } - } - - return true; - } + bool _parse_positional(std::vector<std::string> &args, bool haltOnSubcommand); /// Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used /// subcommands be ignored - App *_find_subcommand(const std::string &subc_name, bool ignore_disabled, bool ignore_used) const noexcept { - for(const App_p &com : subcommands_) { - if(com->disabled_ && ignore_disabled) - continue; - if(com->get_name().empty()) { - auto subc = com->_find_subcommand(subc_name, ignore_disabled, ignore_used); - if(subc != nullptr) { - return subc; - } - } - if(com->check_name(subc_name)) { - if((!*com) || !ignore_used) - return com.get(); - } - } - return nullptr; - } + CLI11_NODISCARD App * + _find_subcommand(const std::string &subc_name, bool ignore_disabled, bool ignore_used) const noexcept; /// Parse a subcommand, modify args and continue /// /// Unlike the others, this one will always allow fallthrough /// return true if the subcommand was processed false otherwise - bool _parse_subcommand(std::vector<std::string> &args) { - if(_count_remaining_positionals(/* required */ true) > 0) { - _parse_positional(args, false); - return true; - } - auto com = _find_subcommand(args.back(), true, true); - if(com != nullptr) { - args.pop_back(); - if(!com->silent_) { - parsed_subcommands_.push_back(com); - } - com->_parse(args); - auto parent_app = com->parent_; - while(parent_app != this) { - parent_app->_trigger_pre_parse(args.size()); - if(!com->silent_) { - parent_app->parsed_subcommands_.push_back(com); - } - parent_app = parent_app->parent_; - } - return true; - } - - if(parent_ == nullptr) - throw HorribleError("Subcommand " + args.back() + " missing"); - return false; - } + bool _parse_subcommand(std::vector<std::string> &args); /// Parse a short (false) or long (true) argument, must be at the top of the list /// return true if the argument was processed or false if nothing was done - bool _parse_arg(std::vector<std::string> &args, detail::Classifier current_type) { - - std::string current = args.back(); - - std::string arg_name; - std::string value; - std::string rest; - - switch(current_type) { - case detail::Classifier::LONG: - if(!detail::split_long(current, arg_name, value)) - throw HorribleError("Long parsed but missing (you should not see this):" + args.back()); - break; - case detail::Classifier::SHORT: - if(!detail::split_short(current, arg_name, rest)) - throw HorribleError("Short parsed but missing! You should not see this"); - break; - case detail::Classifier::WINDOWS_STYLE: - if(!detail::split_windows_style(current, arg_name, value)) - throw HorribleError("windows option parsed but missing! You should not see this"); - break; - case detail::Classifier::SUBCOMMAND: - case detail::Classifier::SUBCOMMAND_TERMINATOR: - case detail::Classifier::POSITIONAL_MARK: - case detail::Classifier::NONE: - default: - throw HorribleError("parsing got called with invalid option! You should not see this"); - } - - auto op_ptr = - std::find_if(std::begin(options_), std::end(options_), [arg_name, current_type](const Option_p &opt) { - if(current_type == detail::Classifier::LONG) - return opt->check_lname(arg_name); - if(current_type == detail::Classifier::SHORT) - return opt->check_sname(arg_name); - // this will only get called for detail::Classifier::WINDOWS_STYLE - return opt->check_lname(arg_name) || opt->check_sname(arg_name); - }); - - // Option not found - if(op_ptr == std::end(options_)) { - for(auto &subc : subcommands_) { - if(subc->name_.empty() && !subc->disabled_) { - if(subc->_parse_arg(args, current_type)) { - if(!subc->pre_parse_called_) { - subc->_trigger_pre_parse(args.size()); - } - return true; - } - } - } - // If a subcommand, try the main command - if(parent_ != nullptr && fallthrough_) - return _get_fallthrough_parent()->_parse_arg(args, current_type); - // don't capture missing if this is a nameless subcommand - if(parent_ != nullptr && name_.empty()) { - return false; - } - // Otherwise, add to missing - args.pop_back(); - _move_to_missing(current_type, current); - return true; - } - - args.pop_back(); - - // Get a reference to the pointer to make syntax bearable - Option_p &op = *op_ptr; - /// if we require a separator add it here - if(op->get_inject_separator()) { - if(!op->results().empty() && !op->results().back().empty()) { - op->add_result(std::string{}); - } - } - if(op->get_trigger_on_parse() && op->current_option_state_ == Option::option_state::callback_run) { - op->clear(); - } - int min_num = (std::min)(op->get_type_size_min(), op->get_items_expected_min()); - int max_num = op->get_items_expected_max(); - // check container like options to limit the argument size to a single type if the allow_extra_flags argument is - // set. 16 is somewhat arbitrary (needs to be at least 4) - if(max_num >= detail::expected_max_vector_size / 16 && !op->get_allow_extra_args()) { - auto tmax = op->get_type_size_max(); - max_num = detail::checked_multiply(tmax, op->get_expected_min()) ? tmax : detail::expected_max_vector_size; - } - // Make sure we always eat the minimum for unlimited vectors - int collected = 0; // total number of arguments collected - int result_count = 0; // local variable for number of results in a single arg string - // deal with purely flag like things - if(max_num == 0) { - auto res = op->get_flag_value(arg_name, value); - op->add_result(res); - parse_order_.push_back(op.get()); - } else if(!value.empty()) { // --this=value - op->add_result(value, result_count); - parse_order_.push_back(op.get()); - collected += result_count; - // -Trest - } else if(!rest.empty()) { - op->add_result(rest, result_count); - parse_order_.push_back(op.get()); - rest = ""; - collected += result_count; - } - - // gather the minimum number of arguments - while(min_num > collected && !args.empty()) { - std::string current_ = args.back(); - args.pop_back(); - op->add_result(current_, result_count); - parse_order_.push_back(op.get()); - collected += result_count; - } - - if(min_num > collected) { // if we have run out of arguments and the minimum was not met - throw ArgumentMismatch::TypedAtLeast(op->get_name(), min_num, op->get_type_name()); - } - - if(max_num > collected || op->get_allow_extra_args()) { // we allow optional arguments - auto remreqpos = _count_remaining_positionals(true); - // we have met the minimum now optionally check up to the maximum - while((collected < max_num || op->get_allow_extra_args()) && !args.empty() && - _recognize(args.back(), false) == detail::Classifier::NONE) { - // If any required positionals remain, don't keep eating - if(remreqpos >= args.size()) { - break; - } - - op->add_result(args.back(), result_count); - parse_order_.push_back(op.get()); - args.pop_back(); - collected += result_count; - } - - // Allow -- to end an unlimited list and "eat" it - if(!args.empty() && _recognize(args.back()) == detail::Classifier::POSITIONAL_MARK) - args.pop_back(); - // optional flag that didn't receive anything now get the default value - if(min_num == 0 && max_num > 0 && collected == 0) { - auto res = op->get_flag_value(arg_name, std::string{}); - op->add_result(res); - parse_order_.push_back(op.get()); - } - } - - // if we only partially completed a type then add an empty string for later processing - if(min_num > 0 && op->get_type_size_max() != min_num && (collected % op->get_type_size_max()) != 0) { - op->add_result(std::string{}); - } - if(op->get_trigger_on_parse()) { - op->run_callback(); - } - if(!rest.empty()) { - rest = "-" + rest; - args.push_back(rest); - } - return true; - } + bool _parse_arg(std::vector<std::string> &args, detail::Classifier current_type); /// Trigger the pre_parse callback if needed - void _trigger_pre_parse(std::size_t remaining_args) { - if(!pre_parse_called_) { - pre_parse_called_ = true; - if(pre_parse_callback_) { - pre_parse_callback_(remaining_args); - } - } else if(immediate_callback_) { - if(!name_.empty()) { - auto pcnt = parsed_; - auto extras = std::move(missing_); - clear(); - parsed_ = pcnt; - pre_parse_called_ = true; - missing_ = std::move(extras); - } - } - } + void _trigger_pre_parse(std::size_t remaining_args); /// Get the appropriate parent to fallthrough to which is the first one that has a name or the main app - App *_get_fallthrough_parent() { - if(parent_ == nullptr) { - throw(HorribleError("No Valid parent")); - } - auto fallthrough_parent = parent_; - while((fallthrough_parent->parent_ != nullptr) && (fallthrough_parent->get_name().empty())) { - fallthrough_parent = fallthrough_parent->parent_; - } - return fallthrough_parent; - } + App *_get_fallthrough_parent(); /// Helper function to run through all possible comparisons of subcommand names to check there is no overlap - const std::string &_compare_subcommand_names(const App &subcom, const App &base) const { - static const std::string estring; - if(subcom.disabled_) { - return estring; - } - for(auto &subc : base.subcommands_) { - if(subc.get() != &subcom) { - if(subc->disabled_) { - continue; - } - if(!subcom.get_name().empty()) { - if(subc->check_name(subcom.get_name())) { - return subcom.get_name(); - } - } - if(!subc->get_name().empty()) { - if(subcom.check_name(subc->get_name())) { - return subc->get_name(); - } - } - for(const auto &les : subcom.aliases_) { - if(subc->check_name(les)) { - return les; - } - } - // this loop is needed in case of ignore_underscore or ignore_case on one but not the other - for(const auto &les : subc->aliases_) { - if(subcom.check_name(les)) { - return les; - } - } - // if the subcommand is an option group we need to check deeper - if(subc->get_name().empty()) { - auto &cmpres = _compare_subcommand_names(subcom, *subc); - if(!cmpres.empty()) { - return cmpres; - } - } - // if the test subcommand is an option group we need to check deeper - if(subcom.get_name().empty()) { - auto &cmpres = _compare_subcommand_names(*subc, subcom); - if(!cmpres.empty()) { - return cmpres; - } - } - } - } - return estring; - } + CLI11_NODISCARD const std::string &_compare_subcommand_names(const App &subcom, const App &base) const; + /// Helper function to place extra values in the most appropriate position - void _move_to_missing(detail::Classifier val_type, const std::string &val) { - if(allow_extras_ || subcommands_.empty()) { - missing_.emplace_back(val_type, val); - return; - } - // allow extra arguments to be places in an option group if it is allowed there - for(auto &subc : subcommands_) { - if(subc->name_.empty() && subc->allow_extras_) { - subc->missing_.emplace_back(val_type, val); - return; - } - } - // if we haven't found any place to put them yet put them in missing - missing_.emplace_back(val_type, val); - } + void _move_to_missing(detail::Classifier val_type, const std::string &val); public: /// function that could be used by subclasses of App to shift options around into subcommands - void _move_option(Option *opt, App *app) { - if(opt == nullptr) { - throw OptionNotFound("the option is NULL"); - } - // verify that the give app is actually a subcommand - bool found = false; - for(auto &subc : subcommands_) { - if(app == subc.get()) { - found = true; - } - } - if(!found) { - throw OptionNotFound("The Given app is not a subcommand"); - } - - if((help_ptr_ == opt) || (help_all_ptr_ == opt)) - throw OptionAlreadyAdded("cannot move help options"); - - if(config_ptr_ == opt) - throw OptionAlreadyAdded("cannot move config file options"); - - auto iterator = - std::find_if(std::begin(options_), std::end(options_), [opt](const Option_p &v) { return v.get() == opt; }); - if(iterator != std::end(options_)) { - const auto &opt_p = *iterator; - if(std::find_if(std::begin(app->options_), std::end(app->options_), [&opt_p](const Option_p &v) { - return (*v == *opt_p); - }) == std::end(app->options_)) { - // only erase after the insertion was successful - app->options_.push_back(std::move(*iterator)); - options_.erase(iterator); - } else { - throw OptionAlreadyAdded("option was not located: " + opt->get_name()); - } - } else { - throw OptionNotFound("could not locate the given Option"); - } - } + void _move_option(Option *opt, App *app); }; // namespace CLI /// Extension of App to better manage groups of options @@ -3012,154 +1312,53 @@ class Option_group : public App { return subcom; } }; -/// Helper function to enable one option group/subcommand when another is used -inline void TriggerOn(App *trigger_app, App *app_to_enable) { - app_to_enable->enabled_by_default(false); - app_to_enable->disabled_by_default(); - trigger_app->preparse_callback([app_to_enable](std::size_t) { app_to_enable->disabled(false); }); -} /// Helper function to enable one option group/subcommand when another is used -inline void TriggerOn(App *trigger_app, std::vector<App *> apps_to_enable) { - for(auto &app : apps_to_enable) { - app->enabled_by_default(false); - app->disabled_by_default(); - } +CLI11_INLINE void TriggerOn(App *trigger_app, App *app_to_enable); - trigger_app->preparse_callback([apps_to_enable](std::size_t) { - for(auto &app : apps_to_enable) { - app->disabled(false); - } - }); -} +/// Helper function to enable one option group/subcommand when another is used +CLI11_INLINE void TriggerOn(App *trigger_app, std::vector<App *> apps_to_enable); /// Helper function to disable one option group/subcommand when another is used -inline void TriggerOff(App *trigger_app, App *app_to_enable) { - app_to_enable->disabled_by_default(false); - app_to_enable->enabled_by_default(); - trigger_app->preparse_callback([app_to_enable](std::size_t) { app_to_enable->disabled(); }); -} +CLI11_INLINE void TriggerOff(App *trigger_app, App *app_to_enable); /// Helper function to disable one option group/subcommand when another is used -inline void TriggerOff(App *trigger_app, std::vector<App *> apps_to_enable) { - for(auto &app : apps_to_enable) { - app->disabled_by_default(false); - app->enabled_by_default(); - } - - trigger_app->preparse_callback([apps_to_enable](std::size_t) { - for(auto &app : apps_to_enable) { - app->disabled(); - } - }); -} +CLI11_INLINE void TriggerOff(App *trigger_app, std::vector<App *> apps_to_enable); /// Helper function to mark an option as deprecated -inline void deprecate_option(Option *opt, const std::string &replacement = "") { - Validator deprecate_warning{[opt, replacement](std::string &) { - std::cout << opt->get_name() << " is deprecated please use '" << replacement - << "' instead\n"; - return std::string(); - }, - "DEPRECATED"}; - deprecate_warning.application_index(0); - opt->check(deprecate_warning); - if(!replacement.empty()) { - opt->description(opt->get_description() + " DEPRECATED: please use '" + replacement + "' instead"); - } -} +CLI11_INLINE void deprecate_option(Option *opt, const std::string &replacement = ""); /// Helper function to mark an option as deprecated inline void deprecate_option(App *app, const std::string &option_name, const std::string &replacement = "") { - auto opt = app->get_option(option_name); + auto *opt = app->get_option(option_name); deprecate_option(opt, replacement); } /// Helper function to mark an option as deprecated inline void deprecate_option(App &app, const std::string &option_name, const std::string &replacement = "") { - auto opt = app.get_option(option_name); + auto *opt = app.get_option(option_name); deprecate_option(opt, replacement); } /// Helper function to mark an option as retired -inline void retire_option(App *app, Option *opt) { - App temp; - auto option_copy = temp.add_option(opt->get_name(false, true)) - ->type_size(opt->get_type_size_min(), opt->get_type_size_max()) - ->expected(opt->get_expected_min(), opt->get_expected_max()) - ->allow_extra_args(opt->get_allow_extra_args()); - - app->remove_option(opt); - auto opt2 = app->add_option(option_copy->get_name(false, true), "option has been retired and has no effect") - ->type_name("RETIRED") - ->default_str("RETIRED") - ->type_size(option_copy->get_type_size_min(), option_copy->get_type_size_max()) - ->expected(option_copy->get_expected_min(), option_copy->get_expected_max()) - ->allow_extra_args(option_copy->get_allow_extra_args()); - - Validator retired_warning{[opt2](std::string &) { - std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; - return std::string(); - }, - ""}; - retired_warning.application_index(0); - opt2->check(retired_warning); -} +CLI11_INLINE void retire_option(App *app, Option *opt); /// Helper function to mark an option as retired -inline void retire_option(App &app, Option *opt) { retire_option(&app, opt); } +CLI11_INLINE void retire_option(App &app, Option *opt); /// Helper function to mark an option as retired -inline void retire_option(App *app, const std::string &option_name) { - - auto opt = app->get_option_no_throw(option_name); - if(opt != nullptr) { - retire_option(app, opt); - return; - } - auto opt2 = app->add_option(option_name, "option has been retired and has no effect") - ->type_name("RETIRED") - ->expected(0, 1) - ->default_str("RETIRED"); - Validator retired_warning{[opt2](std::string &) { - std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; - return std::string(); - }, - ""}; - retired_warning.application_index(0); - opt2->check(retired_warning); -} +CLI11_INLINE void retire_option(App *app, const std::string &option_name); /// Helper function to mark an option as retired -inline void retire_option(App &app, const std::string &option_name) { retire_option(&app, option_name); } +CLI11_INLINE void retire_option(App &app, const std::string &option_name); namespace FailureMessage { /// Printout a clean, simple message on error (the default in CLI11 1.5+) -inline std::string simple(const App *app, const Error &e) { - std::string header = std::string(e.what()) + "\n"; - std::vector<std::string> names; - - // Collect names - if(app->get_help_ptr() != nullptr) - names.push_back(app->get_help_ptr()->get_name()); - - if(app->get_help_all_ptr() != nullptr) - names.push_back(app->get_help_all_ptr()->get_name()); - - // If any names found, suggest those - if(!names.empty()) - header += "Run with " + detail::join(names, " or ") + " for more information.\n"; - - return header; -} +CLI11_INLINE std::string simple(const App *app, const Error &e); /// Printout the full help string on error (if this fn is set, the old default for CLI11) -inline std::string help(const App *app, const Error &e) { - std::string header = std::string("ERROR: ") + e.get_name() + ": " + e.what() + "\n"; - header += app->help(); - return header; -} +CLI11_INLINE std::string help(const App *app, const Error &e); } // namespace FailureMessage @@ -3199,3 +1398,7 @@ struct AppFriend { // [CLI11:app_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/App_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/CLI.hpp b/packages/CLI11/include/CLI/CLI.hpp index 990ba4078138d69c39170892616d191a77e1d333..0b6c3448a450497948a480ebf18200f792098874 100644 --- a/packages/CLI11/include/CLI/CLI.hpp +++ b/packages/CLI11/include/CLI/CLI.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/Config.hpp b/packages/CLI11/include/CLI/Config.hpp index 57944ecae95d3a54b07b372fbd8179abf416dd01..685981c2fbd9eb62356a242780ae29a4e3c7804e 100644 --- a/packages/CLI11/include/CLI/Config.hpp +++ b/packages/CLI11/include/CLI/Config.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -8,6 +8,7 @@ // [CLI11:public_includes:set] #include <algorithm> +#include <cctype> #include <fstream> #include <iostream> #include <string> @@ -23,374 +24,25 @@ namespace CLI { // [CLI11:config_hpp:verbatim] namespace detail { -inline std::string convert_arg_for_ini(const std::string &arg, char stringQuote = '"', char characterQuote = '\'') { - if(arg.empty()) { - return std::string(2, stringQuote); - } - // some specifically supported strings - if(arg == "true" || arg == "false" || arg == "nan" || arg == "inf") { - return arg; - } - // floating point conversion can convert some hex codes, but don't try that here - if(arg.compare(0, 2, "0x") != 0 && arg.compare(0, 2, "0X") != 0) { - double val; - if(detail::lexical_cast(arg, val)) { - return arg; - } - } - // just quote a single non numeric character - if(arg.size() == 1) { - return std::string(1, characterQuote) + arg + characterQuote; - } - // handle hex, binary or octal arguments - if(arg.front() == '0') { - if(arg[1] == 'x') { - if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { - return (x >= '0' && x <= '9') || (x >= 'A' && x <= 'F') || (x >= 'a' && x <= 'f'); - })) { - return arg; - } - } else if(arg[1] == 'o') { - if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x >= '0' && x <= '7'); })) { - return arg; - } - } else if(arg[1] == 'b') { - if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x == '0' || x == '1'); })) { - return arg; - } - } - } - if(arg.find_first_of(stringQuote) == std::string::npos) { - return std::string(1, stringQuote) + arg + stringQuote; - } else { - return characterQuote + arg + characterQuote; - } -} +std::string convert_arg_for_ini(const std::string &arg, char stringQuote = '"', char characterQuote = '\''); /// Comma separated join, adds quotes if needed -inline std::string ini_join(const std::vector<std::string> &args, - char sepChar = ',', - char arrayStart = '[', - char arrayEnd = ']', - char stringQuote = '"', - char characterQuote = '\'') { - std::string joined; - if(args.size() > 1 && arrayStart != '\0') { - joined.push_back(arrayStart); - } - std::size_t start = 0; - for(const auto &arg : args) { - if(start++ > 0) { - joined.push_back(sepChar); - if(isspace(sepChar) == 0) { - joined.push_back(' '); - } - } - joined.append(convert_arg_for_ini(arg, stringQuote, characterQuote)); - } - if(args.size() > 1 && arrayEnd != '\0') { - joined.push_back(arrayEnd); - } - return joined; -} +std::string ini_join(const std::vector<std::string> &args, + char sepChar = ',', + char arrayStart = '[', + char arrayEnd = ']', + char stringQuote = '"', + char characterQuote = '\''); -inline std::vector<std::string> generate_parents(const std::string §ion, std::string &name, char parentSeparator) { - std::vector<std::string> parents; - if(detail::to_lower(section) != "default") { - if(section.find(parentSeparator) != std::string::npos) { - parents = detail::split(section, parentSeparator); - } else { - parents = {section}; - } - } - if(name.find(parentSeparator) != std::string::npos) { - std::vector<std::string> plist = detail::split(name, parentSeparator); - name = plist.back(); - detail::remove_quotes(name); - plist.pop_back(); - parents.insert(parents.end(), plist.begin(), plist.end()); - } - - // clean up quotes on the parents - for(auto &parent : parents) { - detail::remove_quotes(parent); - } - return parents; -} +std::vector<std::string> generate_parents(const std::string §ion, std::string &name, char parentSeparator); /// assuming non default segments do a check on the close and open of the segments in a configItem structure -inline void -checkParentSegments(std::vector<ConfigItem> &output, const std::string ¤tSection, char parentSeparator) { - - std::string estring; - auto parents = detail::generate_parents(currentSection, estring, parentSeparator); - if(!output.empty() && output.back().name == "--") { - std::size_t msize = (parents.size() > 1U) ? parents.size() : 2; - while(output.back().parents.size() >= msize) { - output.push_back(output.back()); - output.back().parents.pop_back(); - } - - if(parents.size() > 1) { - std::size_t common = 0; - std::size_t mpair = (std::min)(output.back().parents.size(), parents.size() - 1); - for(std::size_t ii = 0; ii < mpair; ++ii) { - if(output.back().parents[ii] != parents[ii]) { - break; - } - ++common; - } - if(common == mpair) { - output.pop_back(); - } else { - while(output.back().parents.size() > common + 1) { - output.push_back(output.back()); - output.back().parents.pop_back(); - } - } - for(std::size_t ii = common; ii < parents.size() - 1; ++ii) { - output.emplace_back(); - output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1); - output.back().name = "++"; - } - } - } else if(parents.size() > 1) { - for(std::size_t ii = 0; ii < parents.size() - 1; ++ii) { - output.emplace_back(); - output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1); - output.back().name = "++"; - } - } - - // insert a section end which is just an empty items_buffer - output.emplace_back(); - output.back().parents = std::move(parents); - output.back().name = "++"; -} +void checkParentSegments(std::vector<ConfigItem> &output, const std::string ¤tSection, char parentSeparator); } // namespace detail -inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) const { - std::string line; - std::string currentSection = "default"; - std::string previousSection = "default"; - std::vector<ConfigItem> output; - bool isDefaultArray = (arrayStart == '[' && arrayEnd == ']' && arraySeparator == ','); - bool isINIArray = (arrayStart == '\0' || arrayStart == ' ') && arrayStart == arrayEnd; - bool inSection{false}; - char aStart = (isINIArray) ? '[' : arrayStart; - char aEnd = (isINIArray) ? ']' : arrayEnd; - char aSep = (isINIArray && arraySeparator == ' ') ? ',' : arraySeparator; - int currentSectionIndex{0}; - while(getline(input, line)) { - std::vector<std::string> items_buffer; - std::string name; - - detail::trim(line); - std::size_t len = line.length(); - // lines have to be at least 3 characters to have any meaning to CLI just skip the rest - if(len < 3) { - continue; - } - if(line.front() == '[' && line.back() == ']') { - if(currentSection != "default") { - // insert a section end which is just an empty items_buffer - output.emplace_back(); - output.back().parents = detail::generate_parents(currentSection, name, parentSeparatorChar); - output.back().name = "--"; - } - currentSection = line.substr(1, len - 2); - // deal with double brackets for TOML - if(currentSection.size() > 1 && currentSection.front() == '[' && currentSection.back() == ']') { - currentSection = currentSection.substr(1, currentSection.size() - 2); - } - if(detail::to_lower(currentSection) == "default") { - currentSection = "default"; - } else { - detail::checkParentSegments(output, currentSection, parentSeparatorChar); - } - inSection = false; - if(currentSection == previousSection) { - ++currentSectionIndex; - } else { - currentSectionIndex = 0; - previousSection = currentSection; - } - continue; - } - - // comment lines - if(line.front() == ';' || line.front() == '#' || line.front() == commentChar) { - continue; - } - - // Find = in string, split and recombine - auto pos = line.find(valueDelimiter); - if(pos != std::string::npos) { - name = detail::trim_copy(line.substr(0, pos)); - std::string item = detail::trim_copy(line.substr(pos + 1)); - auto cloc = item.find(commentChar); - if(cloc != std::string::npos) { - item.erase(cloc, std::string::npos); - detail::trim(item); - } - if(item.size() > 1 && item.front() == aStart) { - for(std::string multiline; item.back() != aEnd && std::getline(input, multiline);) { - detail::trim(multiline); - item += multiline; - } - items_buffer = detail::split_up(item.substr(1, item.length() - 2), aSep); - } else if((isDefaultArray || isINIArray) && item.find_first_of(aSep) != std::string::npos) { - items_buffer = detail::split_up(item, aSep); - } else if((isDefaultArray || isINIArray) && item.find_first_of(' ') != std::string::npos) { - items_buffer = detail::split_up(item); - } else { - items_buffer = {item}; - } - } else { - name = detail::trim_copy(line); - auto cloc = name.find(commentChar); - if(cloc != std::string::npos) { - name.erase(cloc, std::string::npos); - detail::trim(name); - } - - items_buffer = {"true"}; - } - if(name.find(parentSeparatorChar) == std::string::npos) { - detail::remove_quotes(name); - } - // clean up quotes on the items - for(auto &it : items_buffer) { - detail::remove_quotes(it); - } - - std::vector<std::string> parents = detail::generate_parents(currentSection, name, parentSeparatorChar); - if(parents.size() > maximumLayers) { - continue; - } - if(!configSection.empty() && !inSection) { - if(parents.empty() || parents.front() != configSection) { - continue; - } - if(configIndex >= 0 && currentSectionIndex != configIndex) { - continue; - } - parents.erase(parents.begin()); - inSection = true; - } - if(!output.empty() && name == output.back().name && parents == output.back().parents) { - output.back().inputs.insert(output.back().inputs.end(), items_buffer.begin(), items_buffer.end()); - } else { - output.emplace_back(); - output.back().parents = std::move(parents); - output.back().name = std::move(name); - output.back().inputs = std::move(items_buffer); - } - } - if(currentSection != "default") { - // insert a section end which is just an empty items_buffer - std::string ename; - output.emplace_back(); - output.back().parents = detail::generate_parents(currentSection, ename, parentSeparatorChar); - output.back().name = "--"; - while(output.back().parents.size() > 1) { - output.push_back(output.back()); - output.back().parents.pop_back(); - } - } - return output; -} - -inline std::string -ConfigBase::to_config(const App *app, bool default_also, bool write_description, std::string prefix) const { - std::stringstream out; - std::string commentLead; - commentLead.push_back(commentChar); - commentLead.push_back(' '); - - std::vector<std::string> groups = app->get_groups(); - bool defaultUsed = false; - groups.insert(groups.begin(), std::string("Options")); - if(write_description && (app->get_configurable() || app->get_parent() == nullptr || app->get_name().empty())) { - out << commentLead << detail::fix_newlines(commentLead, app->get_description()) << '\n'; - } - for(auto &group : groups) { - if(group == "Options" || group.empty()) { - if(defaultUsed) { - continue; - } - defaultUsed = true; - } - if(write_description && group != "Options" && !group.empty()) { - out << '\n' << commentLead << group << " Options\n"; - } - for(const Option *opt : app->get_options({})) { - - // Only process options that are configurable - if(opt->get_configurable()) { - if(opt->get_group() != group) { - if(!(group == "Options" && opt->get_group().empty())) { - continue; - } - } - std::string name = prefix + opt->get_single_name(); - std::string value = detail::ini_join( - opt->reduced_results(), arraySeparator, arrayStart, arrayEnd, stringQuote, characterQuote); - - if(value.empty() && default_also) { - if(!opt->get_default_str().empty()) { - value = detail::convert_arg_for_ini(opt->get_default_str(), stringQuote, characterQuote); - } else if(opt->get_expected_min() == 0) { - value = "false"; - } else if(opt->get_run_callback_for_default()) { - value = "\"\""; // empty string default value - } - } - - if(!value.empty()) { - if(write_description && opt->has_description()) { - out << '\n'; - out << commentLead << detail::fix_newlines(commentLead, opt->get_description()) << '\n'; - } - out << name << valueDelimiter << value << '\n'; - } - } - } - } - auto subcommands = app->get_subcommands({}); - for(const App *subcom : subcommands) { - if(subcom->get_name().empty()) { - if(write_description && !subcom->get_group().empty()) { - out << '\n' << commentLead << subcom->get_group() << " Options\n"; - } - out << to_config(subcom, default_also, write_description, prefix); - } - } - - for(const App *subcom : subcommands) { - if(!subcom->get_name().empty()) { - if(subcom->get_configurable() && app->got_subcommand(subcom)) { - if(!prefix.empty() || app->get_parent() == nullptr) { - out << '[' << prefix << subcom->get_name() << "]\n"; - } else { - std::string subname = app->get_name() + parentSeparatorChar + subcom->get_name(); - auto p = app->get_parent(); - while(p->get_parent() != nullptr) { - subname = p->get_name() + parentSeparatorChar + subname; - p = p->get_parent(); - } - out << '[' << subname << "]\n"; - } - out << to_config(subcom, default_also, write_description, ""); - } else { - out << to_config( - subcom, default_also, write_description, prefix + subcom->get_name() + parentSeparatorChar); - } - } - } - - return out.str(); -} - // [CLI11:config_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Config_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/ConfigFwd.hpp b/packages/CLI11/include/CLI/ConfigFwd.hpp index ef2ac345f87986f8888512791a0255a9e1e5f1d3..44454b41a0ec9ba07a3410c6fbf035f5b32c3e51 100644 --- a/packages/CLI11/include/CLI/ConfigFwd.hpp +++ b/packages/CLI11/include/CLI/ConfigFwd.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -34,7 +34,7 @@ struct ConfigItem { std::vector<std::string> inputs{}; /// The list of parents and name joined by "." - std::string fullname() const { + CLI11_NODISCARD std::string fullname() const { std::vector<std::string> tmp = parents; tmp.emplace_back(name); return detail::join(tmp, "."); @@ -54,15 +54,18 @@ class Config { virtual std::vector<ConfigItem> from_config(std::istream &) const = 0; /// Get a flag value - virtual std::string to_flag(const ConfigItem &item) const { + CLI11_NODISCARD virtual std::string to_flag(const ConfigItem &item) const { if(item.inputs.size() == 1) { return item.inputs.at(0); } + if(item.inputs.empty()) { + return "{}"; + } throw ConversionError::TooManyInputsFlag(item.fullname()); } /// Parse a config file, throw an error (ParseError:ConfigParseError or FileError) on failure - std::vector<ConfigItem> from_file(const std::string &name) { + CLI11_NODISCARD std::vector<ConfigItem> from_file(const std::string &name) const { std::ifstream input{name}; if(!input.good()) throw FileError::Missing(name); @@ -145,7 +148,7 @@ class ConfigBase : public Config { /// get a reference to the configuration section std::string §ionRef() { return configSection; } /// get the section - const std::string §ion() const { return configSection; } + CLI11_NODISCARD const std::string §ion() const { return configSection; } /// specify a particular section of the configuration file to use ConfigBase *section(const std::string §ionName) { configSection = sectionName; @@ -155,7 +158,7 @@ class ConfigBase : public Config { /// get a reference to the configuration index int16_t &indexRef() { return configIndex; } /// get the section index - int16_t index() const { return configIndex; } + CLI11_NODISCARD int16_t index() const { return configIndex; } /// specify a particular index in the section to use (-1) for all sections to use ConfigBase *index(int16_t sectionIndex) { configIndex = sectionIndex; diff --git a/packages/CLI11/include/CLI/Error.hpp b/packages/CLI11/include/CLI/Error.hpp index de3122bb431406cf4f16d61161f413b2f2ef29f0..45df83bb60264209ed1dbc043f99948db71804df 100644 --- a/packages/CLI11/include/CLI/Error.hpp +++ b/packages/CLI11/include/CLI/Error.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -15,6 +15,7 @@ // [CLI11:public_includes:end] // CLI library includes +#include "Macros.hpp" #include "StringTools.hpp" namespace CLI { @@ -72,9 +73,9 @@ class Error : public std::runtime_error { std::string error_name{"Error"}; public: - int get_exit_code() const { return actual_exit_code; } + CLI11_NODISCARD int get_exit_code() const { return actual_exit_code; } - std::string get_name() const { return error_name; } + CLI11_NODISCARD std::string get_name() const { return error_name; } Error(std::string name, std::string msg, int exit_code = static_cast<int>(ExitCodes::BaseClass)) : runtime_error(msg), actual_exit_code(exit_code), error_name(std::move(name)) {} @@ -137,10 +138,10 @@ class OptionAlreadyAdded : public ConstructionError { explicit OptionAlreadyAdded(std::string name) : OptionAlreadyAdded(name + " is already added", ExitCodes::OptionAlreadyAdded) {} static OptionAlreadyAdded Requires(std::string name, std::string other) { - return OptionAlreadyAdded(name + " requires " + other, ExitCodes::OptionAlreadyAdded); + return {name + " requires " + other, ExitCodes::OptionAlreadyAdded}; } static OptionAlreadyAdded Excludes(std::string name, std::string other) { - return OptionAlreadyAdded(name + " excludes " + other, ExitCodes::OptionAlreadyAdded); + return {name + " excludes " + other, ExitCodes::OptionAlreadyAdded}; } }; @@ -223,32 +224,30 @@ class RequiredError : public ParseError { if(min_subcom == 1) { return RequiredError("A subcommand"); } - return RequiredError("Requires at least " + std::to_string(min_subcom) + " subcommands", - ExitCodes::RequiredError); + return {"Requires at least " + std::to_string(min_subcom) + " subcommands", ExitCodes::RequiredError}; } static RequiredError Option(std::size_t min_option, std::size_t max_option, std::size_t used, const std::string &option_list) { if((min_option == 1) && (max_option == 1) && (used == 0)) return RequiredError("Exactly 1 option from [" + option_list + "]"); if((min_option == 1) && (max_option == 1) && (used > 1)) { - return RequiredError("Exactly 1 option from [" + option_list + "] is required and " + std::to_string(used) + - " were given", - ExitCodes::RequiredError); + return {"Exactly 1 option from [" + option_list + "] is required and " + std::to_string(used) + + " were given", + ExitCodes::RequiredError}; } if((min_option == 1) && (used == 0)) return RequiredError("At least 1 option from [" + option_list + "]"); if(used < min_option) { - return RequiredError("Requires at least " + std::to_string(min_option) + " options used and only " + - std::to_string(used) + "were given from [" + option_list + "]", - ExitCodes::RequiredError); + return {"Requires at least " + std::to_string(min_option) + " options used and only " + + std::to_string(used) + "were given from [" + option_list + "]", + ExitCodes::RequiredError}; } if(max_option == 1) - return RequiredError("Requires at most 1 options be given from [" + option_list + "]", - ExitCodes::RequiredError); + return {"Requires at most 1 options be given from [" + option_list + "]", ExitCodes::RequiredError}; - return RequiredError("Requires at most " + std::to_string(max_option) + " options be used and " + - std::to_string(used) + "were given from [" + option_list + "]", - ExitCodes::RequiredError); + return {"Requires at most " + std::to_string(max_option) + " options be used and " + std::to_string(used) + + "were given from [" + option_list + "]", + ExitCodes::RequiredError}; } }; @@ -277,6 +276,10 @@ class ArgumentMismatch : public ParseError { static ArgumentMismatch FlagOverride(std::string name) { return ArgumentMismatch(name + " was given a disallowed flag override"); } + static ArgumentMismatch PartialType(std::string name, int num, std::string type) { + return ArgumentMismatch(name + ": " + type + " only partially specified: " + std::to_string(num) + + " required for each element"); + } }; /// Thrown when a requires option is missing diff --git a/packages/CLI11/include/CLI/Formatter.hpp b/packages/CLI11/include/CLI/Formatter.hpp index e45aa25d9739a78d60542b2cfd989199201ade27..c1eceac1224bdefbbe2d20418e7cfbbec585b9d4 100644 --- a/packages/CLI11/include/CLI/Formatter.hpp +++ b/packages/CLI11/include/CLI/Formatter.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -17,276 +17,9 @@ namespace CLI { // [CLI11:formatter_hpp:verbatim] - -inline std::string -Formatter::make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const { - std::stringstream out; - - out << "\n" << group << ":\n"; - for(const Option *opt : opts) { - out << make_option(opt, is_positional); - } - - return out.str(); -} - -inline std::string Formatter::make_positionals(const App *app) const { - std::vector<const Option *> opts = - app->get_options([](const Option *opt) { return !opt->get_group().empty() && opt->get_positional(); }); - - if(opts.empty()) - return std::string(); - - return make_group(get_label("Positionals"), true, opts); -} - -inline std::string Formatter::make_groups(const App *app, AppFormatMode mode) const { - std::stringstream out; - std::vector<std::string> groups = app->get_groups(); - - // Options - for(const std::string &group : groups) { - std::vector<const Option *> opts = app->get_options([app, mode, &group](const Option *opt) { - return opt->get_group() == group // Must be in the right group - && opt->nonpositional() // Must not be a positional - && (mode != AppFormatMode::Sub // If mode is Sub, then - || (app->get_help_ptr() != opt // Ignore help pointer - && app->get_help_all_ptr() != opt)); // Ignore help all pointer - }); - if(!group.empty() && !opts.empty()) { - out << make_group(group, false, opts); - - if(group != groups.back()) - out << "\n"; - } - } - - return out.str(); -} - -inline std::string Formatter::make_description(const App *app) const { - std::string desc = app->get_description(); - auto min_options = app->get_require_option_min(); - auto max_options = app->get_require_option_max(); - if(app->get_required()) { - desc += " REQUIRED "; - } - if((max_options == min_options) && (min_options > 0)) { - if(min_options == 1) { - desc += " \n[Exactly 1 of the following options is required]"; - } else { - desc += " \n[Exactly " + std::to_string(min_options) + "options from the following list are required]"; - } - } else if(max_options > 0) { - if(min_options > 0) { - desc += " \n[Between " + std::to_string(min_options) + " and " + std::to_string(max_options) + - " of the follow options are required]"; - } else { - desc += " \n[At most " + std::to_string(max_options) + " of the following options are allowed]"; - } - } else if(min_options > 0) { - desc += " \n[At least " + std::to_string(min_options) + " of the following options are required]"; - } - return (!desc.empty()) ? desc + "\n" : std::string{}; -} - -inline std::string Formatter::make_usage(const App *app, std::string name) const { - std::stringstream out; - - out << get_label("Usage") << ":" << (name.empty() ? "" : " ") << name; - - std::vector<std::string> groups = app->get_groups(); - - // Print an Options badge if any options exist - std::vector<const Option *> non_pos_options = - app->get_options([](const Option *opt) { return opt->nonpositional(); }); - if(!non_pos_options.empty()) - out << " [" << get_label("OPTIONS") << "]"; - - // Positionals need to be listed here - std::vector<const Option *> positionals = app->get_options([](const Option *opt) { return opt->get_positional(); }); - - // Print out positionals if any are left - if(!positionals.empty()) { - // Convert to help names - std::vector<std::string> positional_names(positionals.size()); - std::transform(positionals.begin(), positionals.end(), positional_names.begin(), [this](const Option *opt) { - return make_option_usage(opt); - }); - - out << " " << detail::join(positional_names, " "); - } - - // Add a marker if subcommands are expected or optional - if(!app->get_subcommands( - [](const CLI::App *subc) { return ((!subc->get_disabled()) && (!subc->get_name().empty())); }) - .empty()) { - out << " " << (app->get_require_subcommand_min() == 0 ? "[" : "") - << get_label(app->get_require_subcommand_max() < 2 || app->get_require_subcommand_min() > 1 ? "SUBCOMMAND" - : "SUBCOMMANDS") - << (app->get_require_subcommand_min() == 0 ? "]" : ""); - } - - out << std::endl; - - return out.str(); -} - -inline std::string Formatter::make_footer(const App *app) const { - std::string footer = app->get_footer(); - if(footer.empty()) { - return std::string{}; - } - return footer + "\n"; -} - -inline std::string Formatter::make_help(const App *app, std::string name, AppFormatMode mode) const { - - // This immediately forwards to the make_expanded method. This is done this way so that subcommands can - // have overridden formatters - if(mode == AppFormatMode::Sub) - return make_expanded(app); - - std::stringstream out; - if((app->get_name().empty()) && (app->get_parent() != nullptr)) { - if(app->get_group() != "Subcommands") { - out << app->get_group() << ':'; - } - } - - out << make_description(app); - out << make_usage(app, name); - out << make_positionals(app); - out << make_groups(app, mode); - out << make_subcommands(app, mode); - out << '\n' << make_footer(app); - - return out.str(); -} - -inline std::string Formatter::make_subcommands(const App *app, AppFormatMode mode) const { - std::stringstream out; - - std::vector<const App *> subcommands = app->get_subcommands({}); - - // Make a list in definition order of the groups seen - std::vector<std::string> subcmd_groups_seen; - for(const App *com : subcommands) { - if(com->get_name().empty()) { - if(!com->get_group().empty()) { - out << make_expanded(com); - } - continue; - } - std::string group_key = com->get_group(); - if(!group_key.empty() && - std::find_if(subcmd_groups_seen.begin(), subcmd_groups_seen.end(), [&group_key](std::string a) { - return detail::to_lower(a) == detail::to_lower(group_key); - }) == subcmd_groups_seen.end()) - subcmd_groups_seen.push_back(group_key); - } - - // For each group, filter out and print subcommands - for(const std::string &group : subcmd_groups_seen) { - out << "\n" << group << ":\n"; - std::vector<const App *> subcommands_group = app->get_subcommands( - [&group](const App *sub_app) { return detail::to_lower(sub_app->get_group()) == detail::to_lower(group); }); - for(const App *new_com : subcommands_group) { - if(new_com->get_name().empty()) - continue; - if(mode != AppFormatMode::All) { - out << make_subcommand(new_com); - } else { - out << new_com->help(new_com->get_name(), AppFormatMode::Sub); - out << "\n"; - } - } - } - - return out.str(); -} - -inline std::string Formatter::make_subcommand(const App *sub) const { - std::stringstream out; - detail::format_help(out, sub->get_display_name(true), sub->get_description(), column_width_); - return out.str(); -} - -inline std::string Formatter::make_expanded(const App *sub) const { - std::stringstream out; - out << sub->get_display_name(true) << "\n"; - - out << make_description(sub); - if(sub->get_name().empty() && !sub->get_aliases().empty()) { - detail::format_aliases(out, sub->get_aliases(), column_width_ + 2); - } - out << make_positionals(sub); - out << make_groups(sub, AppFormatMode::Sub); - out << make_subcommands(sub, AppFormatMode::Sub); - - // Drop blank spaces - std::string tmp = detail::find_and_replace(out.str(), "\n\n", "\n"); - tmp = tmp.substr(0, tmp.size() - 1); // Remove the final '\n' - - // Indent all but the first line (the name) - return detail::find_and_replace(tmp, "\n", "\n ") + "\n"; -} - -inline std::string Formatter::make_option_name(const Option *opt, bool is_positional) const { - if(is_positional) - return opt->get_name(true, false); - - return opt->get_name(false, true); -} - -inline std::string Formatter::make_option_opts(const Option *opt) const { - std::stringstream out; - - if(!opt->get_option_text().empty()) { - out << " " << opt->get_option_text(); - } else { - if(opt->get_type_size() != 0) { - if(!opt->get_type_name().empty()) - out << " " << get_label(opt->get_type_name()); - if(!opt->get_default_str().empty()) - out << "=" << opt->get_default_str(); - if(opt->get_expected_max() == detail::expected_max_vector_size) - out << " ..."; - else if(opt->get_expected_min() > 1) - out << " x " << opt->get_expected(); - - if(opt->get_required()) - out << " " << get_label("REQUIRED"); - } - if(!opt->get_envname().empty()) - out << " (" << get_label("Env") << ":" << opt->get_envname() << ")"; - if(!opt->get_needs().empty()) { - out << " " << get_label("Needs") << ":"; - for(const Option *op : opt->get_needs()) - out << " " << op->get_name(); - } - if(!opt->get_excludes().empty()) { - out << " " << get_label("Excludes") << ":"; - for(const Option *op : opt->get_excludes()) - out << " " << op->get_name(); - } - } - return out.str(); -} - -inline std::string Formatter::make_option_desc(const Option *opt) const { return opt->get_description(); } - -inline std::string Formatter::make_option_usage(const Option *opt) const { - // Note that these are positionals usages - std::stringstream out; - out << make_option_name(opt, true); - if(opt->get_expected_max() >= detail::expected_max_vector_size) - out << "..."; - else if(opt->get_expected_max() > 1) - out << "(" << opt->get_expected() << "x)"; - - return opt->get_required() ? out.str() : "[" + out.str() + "]"; -} - // [CLI11:formatter_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Formatter_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/FormatterFwd.hpp b/packages/CLI11/include/CLI/FormatterFwd.hpp index 728926c0f58909a61ffcf3af583ec28652e8fff0..792ebbc888dba07f2f36a2f19aa8461d597a7ad7 100644 --- a/packages/CLI11/include/CLI/FormatterFwd.hpp +++ b/packages/CLI11/include/CLI/FormatterFwd.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -7,6 +7,7 @@ #pragma once // [CLI11:public_includes:set] +#include <functional> #include <map> #include <string> #include <utility> @@ -78,15 +79,14 @@ class FormatterBase { ///@{ /// Get the current value of a name (REQUIRED, etc.) - std::string get_label(std::string key) const { + CLI11_NODISCARD std::string get_label(std::string key) const { if(labels_.find(key) == labels_.end()) return key; - else - return labels_.at(key); + return labels_.at(key); } /// Get the current column width - std::size_t get_column_width() const { return column_width_; } + CLI11_NODISCARD std::size_t get_column_width() const { return column_width_; } ///@} }; @@ -124,7 +124,8 @@ class Formatter : public FormatterBase { /// This prints out a group of options with title /// - virtual std::string make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const; + CLI11_NODISCARD virtual std::string + make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const; /// This prints out just the positionals "group" virtual std::string make_positionals(const App *app) const; diff --git a/packages/CLI11/include/CLI/Macros.hpp b/packages/CLI11/include/CLI/Macros.hpp index f228c918cd408ce33aeed734ca3cc2b2d40f6edf..690670619a2d8ef56f21740d12f4506c4718183c 100644 --- a/packages/CLI11/include/CLI/Macros.hpp +++ b/packages/CLI11/include/CLI/Macros.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -26,7 +26,7 @@ #define CLI11_CPP14 #if _MSVC_LANG > 201402L && _MSC_VER >= 1910 #define CLI11_CPP17 -#if __MSVC_LANG > 201703L && _MSC_VER >= 1910 +#if _MSVC_LANG > 201703L && _MSC_VER >= 1910 #define CLI11_CPP20 #endif #endif @@ -41,4 +41,35 @@ #define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason))) #endif +// GCC < 10 doesn't ignore this in unevaluated contexts +#if !defined(CLI11_CPP17) || \ + (defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 10 && __GNUC__ > 4) +#define CLI11_NODISCARD +#else +#define CLI11_NODISCARD [[nodiscard]] +#endif + +/** detection of rtti */ +#ifndef CLI11_USE_STATIC_RTTI +#if(defined(_HAS_STATIC_RTTI) && _HAS_STATIC_RTTI) +#define CLI11_USE_STATIC_RTTI 1 +#elif defined(__cpp_rtti) +#if(defined(_CPPRTTI) && _CPPRTTI == 0) +#define CLI11_USE_STATIC_RTTI 1 +#else +#define CLI11_USE_STATIC_RTTI 0 +#endif +#elif(defined(__GCC_RTTI) && __GXX_RTTI) +#define CLI11_USE_STATIC_RTTI 0 +#else +#define CLI11_USE_STATIC_RTTI 1 +#endif +#endif + +/** Inline macro **/ +#ifdef CLI11_COMPILE +#define CLI11_INLINE +#else +#define CLI11_INLINE inline +#endif // [CLI11:macros_hpp:end] diff --git a/packages/CLI11/include/CLI/Option.hpp b/packages/CLI11/include/CLI/Option.hpp index 25a676055fba34d7448e263df4e94be526de002e..458d9ffcbbc2d74a58d65a3a9e61e129d5b1606a 100644 --- a/packages/CLI11/include/CLI/Option.hpp +++ b/packages/CLI11/include/CLI/Option.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -40,7 +40,8 @@ enum class MultiOptionPolicy : char { TakeLast, //!< take only the last Expected number of arguments TakeFirst, //!< take only the first Expected number of arguments Join, //!< merge all the arguments together into a single string via the delimiter character default('\n') - TakeAll //!< just get all the passed argument regardless + TakeAll, //!< just get all the passed argument regardless + Sum //!< sum all the arguments together if numerical or concatenate directly without delimiter }; /// This is the CRTP base class for Option and OptionDefaults. It was designed this way @@ -77,17 +78,7 @@ template <typename CRTP> class OptionBase { MultiOptionPolicy multi_option_policy_{MultiOptionPolicy::Throw}; /// Copy the contents to another similar class (one based on OptionBase) - template <typename T> void copy_to(T *other) const { - other->group(group_); - other->required(required_); - other->ignore_case(ignore_case_); - other->ignore_underscore(ignore_underscore_); - other->configurable(configurable_); - other->disable_flag_override(disable_flag_override_); - other->delimiter(delimiter_); - other->always_capture_default(always_capture_default_); - other->multi_option_policy(multi_option_policy_); - } + template <typename T> void copy_to(T *other) const; public: // setters @@ -118,44 +109,44 @@ template <typename CRTP> class OptionBase { // Getters /// Get the group of this option - const std::string &get_group() const { return group_; } + CLI11_NODISCARD const std::string &get_group() const { return group_; } /// True if this is a required option - bool get_required() const { return required_; } + CLI11_NODISCARD bool get_required() const { return required_; } /// The status of ignore case - bool get_ignore_case() const { return ignore_case_; } + CLI11_NODISCARD bool get_ignore_case() const { return ignore_case_; } /// The status of ignore_underscore - bool get_ignore_underscore() const { return ignore_underscore_; } + CLI11_NODISCARD bool get_ignore_underscore() const { return ignore_underscore_; } /// The status of configurable - bool get_configurable() const { return configurable_; } + CLI11_NODISCARD bool get_configurable() const { return configurable_; } /// The status of configurable - bool get_disable_flag_override() const { return disable_flag_override_; } + CLI11_NODISCARD bool get_disable_flag_override() const { return disable_flag_override_; } /// Get the current delimiter char - char get_delimiter() const { return delimiter_; } + CLI11_NODISCARD char get_delimiter() const { return delimiter_; } /// Return true if this will automatically capture the default value for help printing - bool get_always_capture_default() const { return always_capture_default_; } + CLI11_NODISCARD bool get_always_capture_default() const { return always_capture_default_; } /// The status of the multi option policy - MultiOptionPolicy get_multi_option_policy() const { return multi_option_policy_; } + CLI11_NODISCARD MultiOptionPolicy get_multi_option_policy() const { return multi_option_policy_; } // Shortcuts for multi option policy /// Set the multi option policy to take last CRTP *take_last() { - auto self = static_cast<CRTP *>(this); + auto *self = static_cast<CRTP *>(this); self->multi_option_policy(MultiOptionPolicy::TakeLast); return self; } /// Set the multi option policy to take last CRTP *take_first() { - auto self = static_cast<CRTP *>(this); + auto *self = static_cast<CRTP *>(this); self->multi_option_policy(MultiOptionPolicy::TakeFirst); return self; } @@ -169,7 +160,7 @@ template <typename CRTP> class OptionBase { /// Set the multi option policy to join CRTP *join() { - auto self = static_cast<CRTP *>(this); + auto *self = static_cast<CRTP *>(this); self->multi_option_policy(MultiOptionPolicy::Join); return self; } @@ -360,10 +351,10 @@ class Option : public OptionBase<Option> { Option &operator=(const Option &) = delete; /// Count the total number of times an option was passed - std::size_t count() const { return results_.size(); } + CLI11_NODISCARD std::size_t count() const { return results_.size(); } /// True if the option was not passed - bool empty() const { return results_.empty(); } + CLI11_NODISCARD bool empty() const { return results_.empty(); } /// This bool operator returns true if any arguments were passed or the option callback is forced explicit operator bool() const { return !empty() || force_callback_; } @@ -379,46 +370,11 @@ class Option : public OptionBase<Option> { ///@{ /// Set the number of expected arguments - Option *expected(int value) { - if(value < 0) { - expected_min_ = -value; - if(expected_max_ < expected_min_) { - expected_max_ = expected_min_; - } - allow_extra_args_ = true; - flag_like_ = false; - } else if(value == detail::expected_max_vector_size) { - expected_min_ = 1; - expected_max_ = detail::expected_max_vector_size; - allow_extra_args_ = true; - flag_like_ = false; - } else { - expected_min_ = value; - expected_max_ = value; - flag_like_ = (expected_min_ == 0); - } - return this; - } + Option *expected(int value); /// Set the range of expected arguments - Option *expected(int value_min, int value_max) { - if(value_min < 0) { - value_min = -value_min; - } - - if(value_max < 0) { - value_max = detail::expected_max_vector_size; - } - if(value_max < value_min) { - expected_min_ = value_max; - expected_max_ = value_min; - } else { - expected_max_ = value_max; - expected_min_ = value_min; - } + Option *expected(int value_min, int value_max); - return this; - } /// Set the value of allow_extra_args which allows extra value arguments on the flag or option to be included /// with each instance Option *allow_extra_args(bool value = true) { @@ -426,14 +382,14 @@ class Option : public OptionBase<Option> { return this; } /// Get the current value of allow extra args - bool get_allow_extra_args() const { return allow_extra_args_; } + CLI11_NODISCARD bool get_allow_extra_args() const { return allow_extra_args_; } /// Set the value of trigger_on_parse which specifies that the option callback should be triggered on every parse Option *trigger_on_parse(bool value = true) { trigger_on_result_ = value; return this; } /// The status of trigger on parse - bool get_trigger_on_parse() const { return trigger_on_result_; } + CLI11_NODISCARD bool get_trigger_on_parse() const { return trigger_on_result_; } /// Set the value of force_callback Option *force_callback(bool value = true) { @@ -441,7 +397,7 @@ class Option : public OptionBase<Option> { return this; } /// The status of force_callback - bool get_force_callback() const { return force_callback_; } + CLI11_NODISCARD bool get_force_callback() const { return force_callback_; } /// Set the value of run_callback_for_default which controls whether the callback function should be called to set /// the default This is controlled automatically but could be manipulated by the user. @@ -450,81 +406,32 @@ class Option : public OptionBase<Option> { return this; } /// Get the current value of run_callback_for_default - bool get_run_callback_for_default() const { return run_callback_for_default_; } + CLI11_NODISCARD bool get_run_callback_for_default() const { return run_callback_for_default_; } /// Adds a Validator with a built in type name - Option *check(Validator validator, const std::string &validator_name = "") { - validator.non_modifying(); - validators_.push_back(std::move(validator)); - if(!validator_name.empty()) - validators_.back().name(validator_name); - return this; - } + Option *check(Validator validator, const std::string &validator_name = ""); /// Adds a Validator. Takes a const string& and returns an error message (empty if conversion/check is okay). Option *check(std::function<std::string(const std::string &)> Validator, std::string Validator_description = "", - std::string Validator_name = "") { - validators_.emplace_back(Validator, std::move(Validator_description), std::move(Validator_name)); - validators_.back().non_modifying(); - return this; - } + std::string Validator_name = ""); /// Adds a transforming Validator with a built in type name - Option *transform(Validator Validator, const std::string &Validator_name = "") { - validators_.insert(validators_.begin(), std::move(Validator)); - if(!Validator_name.empty()) - validators_.front().name(Validator_name); - return this; - } + Option *transform(Validator Validator, const std::string &Validator_name = ""); /// Adds a Validator-like function that can change result Option *transform(const std::function<std::string(std::string)> &func, std::string transform_description = "", - std::string transform_name = "") { - validators_.insert(validators_.begin(), - Validator( - [func](std::string &val) { - val = func(val); - return std::string{}; - }, - std::move(transform_description), - std::move(transform_name))); - - return this; - } + std::string transform_name = ""); /// Adds a user supplied function to run on each item passed in (communicate though lambda capture) - Option *each(const std::function<void(std::string)> &func) { - validators_.emplace_back( - [func](std::string &inout) { - func(inout); - return std::string{}; - }, - std::string{}); - return this; - } + Option *each(const std::function<void(std::string)> &func); + /// Get a named Validator - Validator *get_validator(const std::string &Validator_name = "") { - for(auto &Validator : validators_) { - if(Validator_name == Validator.get_name()) { - return &Validator; - } - } - if((Validator_name.empty()) && (!validators_.empty())) { - return &(validators_.front()); - } - throw OptionNotFound(std::string{"Validator "} + Validator_name + " Not Found"); - } + Validator *get_validator(const std::string &Validator_name = ""); /// Get a Validator by index NOTE: this may not be the order of definition - Validator *get_validator(int index) { - // This is an signed int so that it is not equivalent to a pointer. - if(index >= 0 && index < static_cast<int>(validators_.size())) { - return &(validators_[static_cast<decltype(validators_)::size_type>(index)]); - } - throw OptionNotFound("Validator index is not valid"); - } + Validator *get_validator(int index); /// Sets required options Option *needs(Option *opt) { @@ -546,35 +453,14 @@ class Option : public OptionBase<Option> { /// Any number supported, any mix of string and Opt template <typename A, typename B, typename... ARG> Option *needs(A opt, B opt1, ARG... args) { needs(opt); - return needs(opt1, args...); + return needs(opt1, args...); // NOLINT(readability-suspicious-call-argument) } /// Remove needs link from an option. Returns true if the option really was in the needs list. - bool remove_needs(Option *opt) { - auto iterator = std::find(std::begin(needs_), std::end(needs_), opt); - - if(iterator == std::end(needs_)) { - return false; - } - needs_.erase(iterator); - return true; - } + bool remove_needs(Option *opt); /// Sets excluded options - Option *excludes(Option *opt) { - if(opt == this) { - throw(IncorrectConstruction("and option cannot exclude itself")); - } - excludes_.insert(opt); - - // Help text should be symmetric - excluding a should exclude b - opt->excludes_.insert(this); - - // Ignoring the insert return value, excluding twice is now allowed. - // (Mostly to allow both directions to be excluded by user, even though the library does it for you.) - - return this; - } + Option *excludes(Option *opt); /// Can find a string if needed template <typename T = App> Option *excludes(std::string opt_name) { @@ -592,15 +478,7 @@ class Option : public OptionBase<Option> { } /// Remove needs link from an option. Returns true if the option really was in the needs list. - bool remove_excludes(Option *opt) { - auto iterator = std::find(std::begin(excludes_), std::end(excludes_), opt); - - if(iterator == std::end(excludes_)) { - return false; - } - excludes_.erase(iterator); - return true; - } + bool remove_excludes(Option *opt); /// Sets environment variable to read if no option given Option *envname(std::string name) { @@ -612,64 +490,16 @@ class Option : public OptionBase<Option> { /// /// The template hides the fact that we don't have the definition of App yet. /// You are never expected to add an argument to the template here. - template <typename T = App> Option *ignore_case(bool value = true) { - if(!ignore_case_ && value) { - ignore_case_ = value; - auto *parent = static_cast<T *>(parent_); - for(const Option_p &opt : parent->options_) { - if(opt.get() == this) { - continue; - } - auto &omatch = opt->matching_name(*this); - if(!omatch.empty()) { - ignore_case_ = false; - throw OptionAlreadyAdded("adding ignore case caused a name conflict with " + omatch); - } - } - } else { - ignore_case_ = value; - } - return this; - } + template <typename T = App> Option *ignore_case(bool value = true); /// Ignore underscores in the option names /// /// The template hides the fact that we don't have the definition of App yet. /// You are never expected to add an argument to the template here. - template <typename T = App> Option *ignore_underscore(bool value = true) { - - if(!ignore_underscore_ && value) { - ignore_underscore_ = value; - auto *parent = static_cast<T *>(parent_); - for(const Option_p &opt : parent->options_) { - if(opt.get() == this) { - continue; - } - auto &omatch = opt->matching_name(*this); - if(!omatch.empty()) { - ignore_underscore_ = false; - throw OptionAlreadyAdded("adding ignore underscore caused a name conflict with " + omatch); - } - } - } else { - ignore_underscore_ = value; - } - return this; - } + template <typename T = App> Option *ignore_underscore(bool value = true); /// Take the last argument if given multiple times (or another policy) - Option *multi_option_policy(MultiOptionPolicy value = MultiOptionPolicy::Throw) { - if(value != multi_option_policy_) { - if(multi_option_policy_ == MultiOptionPolicy::Throw && expected_max_ == detail::expected_max_vector_size && - expected_min_ > 1) { // this bizarre condition is to maintain backwards compatibility - // with the previous behavior of expected_ with vectors - expected_max_ = expected_min_; - } - multi_option_policy_ = value; - current_option_state_ = option_state::parsing; - } - return this; - } + Option *multi_option_policy(MultiOptionPolicy value = MultiOptionPolicy::Throw); /// Disable flag overrides values, e.g. --flag=<value> is not allowed Option *disable_flag_override(bool value = true) { @@ -681,41 +511,41 @@ class Option : public OptionBase<Option> { ///@{ /// The number of arguments the option expects - int get_type_size() const { return type_size_min_; } + CLI11_NODISCARD int get_type_size() const { return type_size_min_; } /// The minimum number of arguments the option expects - int get_type_size_min() const { return type_size_min_; } + CLI11_NODISCARD int get_type_size_min() const { return type_size_min_; } /// The maximum number of arguments the option expects - int get_type_size_max() const { return type_size_max_; } + CLI11_NODISCARD int get_type_size_max() const { return type_size_max_; } /// Return the inject_separator flag - int get_inject_separator() const { return inject_separator_; } + CLI11_NODISCARD bool get_inject_separator() const { return inject_separator_; } /// The environment variable associated to this value - std::string get_envname() const { return envname_; } + CLI11_NODISCARD std::string get_envname() const { return envname_; } /// The set of options needed - std::set<Option *> get_needs() const { return needs_; } + CLI11_NODISCARD std::set<Option *> get_needs() const { return needs_; } /// The set of options excluded - std::set<Option *> get_excludes() const { return excludes_; } + CLI11_NODISCARD std::set<Option *> get_excludes() const { return excludes_; } /// The default value (for help printing) - std::string get_default_str() const { return default_str_; } + CLI11_NODISCARD std::string get_default_str() const { return default_str_; } /// Get the callback function - callback_t get_callback() const { return callback_; } + CLI11_NODISCARD callback_t get_callback() const { return callback_; } /// Get the long names - const std::vector<std::string> &get_lnames() const { return lnames_; } + CLI11_NODISCARD const std::vector<std::string> &get_lnames() const { return lnames_; } /// Get the short names - const std::vector<std::string> &get_snames() const { return snames_; } + CLI11_NODISCARD const std::vector<std::string> &get_snames() const { return snames_; } /// Get the flag names with specified default values - const std::vector<std::string> &get_fnames() const { return fnames_; } + CLI11_NODISCARD const std::vector<std::string> &get_fnames() const { return fnames_; } /// Get a single name for the option, first of lname, pname, sname, envname - const std::string &get_single_name() const { + CLI11_NODISCARD const std::string &get_single_name() const { if(!lnames_.empty()) { return lnames_[0]; } @@ -728,35 +558,35 @@ class Option : public OptionBase<Option> { return envname_; } /// The number of times the option expects to be included - int get_expected() const { return expected_min_; } + CLI11_NODISCARD int get_expected() const { return expected_min_; } /// The number of times the option expects to be included - int get_expected_min() const { return expected_min_; } + CLI11_NODISCARD int get_expected_min() const { return expected_min_; } /// The max number of times the option expects to be included - int get_expected_max() const { return expected_max_; } + CLI11_NODISCARD int get_expected_max() const { return expected_max_; } /// The total min number of expected string values to be used - int get_items_expected_min() const { return type_size_min_ * expected_min_; } + CLI11_NODISCARD int get_items_expected_min() const { return type_size_min_ * expected_min_; } /// Get the maximum number of items expected to be returned and used for the callback - int get_items_expected_max() const { + CLI11_NODISCARD int get_items_expected_max() const { int t = type_size_max_; return detail::checked_multiply(t, expected_max_) ? t : detail::expected_max_vector_size; } /// The total min number of expected string values to be used - int get_items_expected() const { return get_items_expected_min(); } + CLI11_NODISCARD int get_items_expected() const { return get_items_expected_min(); } /// True if the argument can be given directly - bool get_positional() const { return pname_.length() > 0; } + CLI11_NODISCARD bool get_positional() const { return pname_.length() > 0; } /// True if option has at least one non-positional name - bool nonpositional() const { return (snames_.size() + lnames_.size()) > 0; } + CLI11_NODISCARD bool nonpositional() const { return (snames_.size() + lnames_.size()) > 0; } /// True if option has description - bool has_description() const { return description_.length() > 0; } + CLI11_NODISCARD bool has_description() const { return description_.length() > 0; } /// Get the description - const std::string &get_description() const { return description_; } + CLI11_NODISCARD const std::string &get_description() const { return description_; } /// Set the description Option *description(std::string option_description) { @@ -769,7 +599,7 @@ class Option : public OptionBase<Option> { return this; } - const std::string &get_option_text() const { return option_text_; } + CLI11_NODISCARD const std::string &get_option_text() const { return option_text_; } ///@} /// @name Help tools @@ -779,158 +609,38 @@ class Option : public OptionBase<Option> { /// Will include / prefer the positional name if positional is true. /// If all_options is false, pick just the most descriptive name to show. /// Use `get_name(true)` to get the positional name (replaces `get_pname`) - std::string get_name(bool positional = false, ///< Show the positional name - bool all_options = false ///< Show every option - ) const { - if(get_group().empty()) - return {}; // Hidden - - if(all_options) { - - std::vector<std::string> name_list; - - /// The all list will never include a positional unless asked or that's the only name. - if((positional && (!pname_.empty())) || (snames_.empty() && lnames_.empty())) { - name_list.push_back(pname_); - } - if((get_items_expected() == 0) && (!fnames_.empty())) { - for(const std::string &sname : snames_) { - name_list.push_back("-" + sname); - if(check_fname(sname)) { - name_list.back() += "{" + get_flag_value(sname, "") + "}"; - } - } - - for(const std::string &lname : lnames_) { - name_list.push_back("--" + lname); - if(check_fname(lname)) { - name_list.back() += "{" + get_flag_value(lname, "") + "}"; - } - } - } else { - for(const std::string &sname : snames_) - name_list.push_back("-" + sname); - - for(const std::string &lname : lnames_) - name_list.push_back("--" + lname); - } - - return detail::join(name_list); - } - - // This returns the positional name no matter what - if(positional) - return pname_; - - // Prefer long name - if(!lnames_.empty()) - return std::string(2, '-') + lnames_[0]; - - // Or short name if no long name - if(!snames_.empty()) - return std::string(1, '-') + snames_[0]; - - // If positional is the only name, it's okay to use that - return pname_; - } + CLI11_NODISCARD std::string get_name(bool positional = false, ///< Show the positional name + bool all_options = false ///< Show every option + ) const; ///@} /// @name Parser tools ///@{ /// Process the callback - void run_callback() { - if(force_callback_ && results_.empty()) { - add_result(default_str_); - } - if(current_option_state_ == option_state::parsing) { - _validate_results(results_); - current_option_state_ = option_state::validated; - } - - if(current_option_state_ < option_state::reduced) { - _reduce_results(proc_results_, results_); - current_option_state_ = option_state::reduced; - } - if(current_option_state_ >= option_state::reduced) { - current_option_state_ = option_state::callback_run; - if(!(callback_)) { - return; - } - const results_t &send_results = proc_results_.empty() ? results_ : proc_results_; - bool local_result = callback_(send_results); - - if(!local_result) - throw ConversionError(get_name(), results_); - } - } + void run_callback(); /// If options share any of the same names, find it - const std::string &matching_name(const Option &other) const { - static const std::string estring; - for(const std::string &sname : snames_) - if(other.check_sname(sname)) - return sname; - for(const std::string &lname : lnames_) - if(other.check_lname(lname)) - return lname; - - if(ignore_case_ || - ignore_underscore_) { // We need to do the inverse, in case we are ignore_case or ignore underscore - for(const std::string &sname : other.snames_) - if(check_sname(sname)) - return sname; - for(const std::string &lname : other.lnames_) - if(check_lname(lname)) - return lname; - } - return estring; - } + CLI11_NODISCARD const std::string &matching_name(const Option &other) const; + /// If options share any of the same names, they are equal (not counting positional) bool operator==(const Option &other) const { return !matching_name(other).empty(); } /// Check a name. Requires "-" or "--" for short / long, supports positional name - bool check_name(const std::string &name) const { - - if(name.length() > 2 && name[0] == '-' && name[1] == '-') - return check_lname(name.substr(2)); - if(name.length() > 1 && name.front() == '-') - return check_sname(name.substr(1)); - if(!pname_.empty()) { - std::string local_pname = pname_; - std::string local_name = name; - if(ignore_underscore_) { - local_pname = detail::remove_underscore(local_pname); - local_name = detail::remove_underscore(local_name); - } - if(ignore_case_) { - local_pname = detail::to_lower(local_pname); - local_name = detail::to_lower(local_name); - } - if(local_name == local_pname) { - return true; - } - } - - if(!envname_.empty()) { - // this needs to be the original since envname_ shouldn't match on case insensitivity - return (name == envname_); - } - return false; - } + CLI11_NODISCARD bool check_name(const std::string &name) const; /// Requires "-" to be removed from string - bool check_sname(std::string name) const { + CLI11_NODISCARD bool check_sname(std::string name) const { return (detail::find_member(std::move(name), snames_, ignore_case_) >= 0); } /// Requires "--" to be removed from string - bool check_lname(std::string name) const { + CLI11_NODISCARD bool check_lname(std::string name) const { return (detail::find_member(std::move(name), lnames_, ignore_case_, ignore_underscore_) >= 0); } /// Requires "--" to be removed from string - bool check_fname(std::string name) const { + CLI11_NODISCARD bool check_fname(std::string name) const { if(fnames_.empty()) { return false; } @@ -939,97 +649,26 @@ class Option : public OptionBase<Option> { /// Get the value that goes for a flag, nominally gets the default value but allows for overrides if not /// disabled - std::string get_flag_value(const std::string &name, std::string input_value) const { - static const std::string trueString{"true"}; - static const std::string falseString{"false"}; - static const std::string emptyString{"{}"}; - // check for disable flag override_ - if(disable_flag_override_) { - if(!((input_value.empty()) || (input_value == emptyString))) { - auto default_ind = detail::find_member(name, fnames_, ignore_case_, ignore_underscore_); - if(default_ind >= 0) { - // We can static cast this to std::size_t because it is more than 0 in this block - if(default_flag_values_[static_cast<std::size_t>(default_ind)].second != input_value) { - throw(ArgumentMismatch::FlagOverride(name)); - } - } else { - if(input_value != trueString) { - throw(ArgumentMismatch::FlagOverride(name)); - } - } - } - } - auto ind = detail::find_member(name, fnames_, ignore_case_, ignore_underscore_); - if((input_value.empty()) || (input_value == emptyString)) { - if(flag_like_) { - return (ind < 0) ? trueString : default_flag_values_[static_cast<std::size_t>(ind)].second; - } else { - return (ind < 0) ? default_str_ : default_flag_values_[static_cast<std::size_t>(ind)].second; - } - } - if(ind < 0) { - return input_value; - } - if(default_flag_values_[static_cast<std::size_t>(ind)].second == falseString) { - try { - auto val = detail::to_flag_value(input_value); - return (val == 1) ? falseString : (val == (-1) ? trueString : std::to_string(-val)); - } catch(const std::invalid_argument &) { - return input_value; - } - } else { - return input_value; - } - } + CLI11_NODISCARD std::string get_flag_value(const std::string &name, std::string input_value) const; /// Puts a result at the end - Option *add_result(std::string s) { - _add_result(std::move(s), results_); - current_option_state_ = option_state::parsing; - return this; - } + Option *add_result(std::string s); /// Puts a result at the end and get a count of the number of arguments actually added - Option *add_result(std::string s, int &results_added) { - results_added = _add_result(std::move(s), results_); - current_option_state_ = option_state::parsing; - return this; - } + Option *add_result(std::string s, int &results_added); /// Puts a result at the end - Option *add_result(std::vector<std::string> s) { - current_option_state_ = option_state::parsing; - for(auto &str : s) { - _add_result(std::move(str), results_); - } - return this; - } + Option *add_result(std::vector<std::string> s); /// Get the current complete results set - const results_t &results() const { return results_; } + CLI11_NODISCARD const results_t &results() const { return results_; } /// Get a copy of the results - results_t reduced_results() const { - results_t res = proc_results_.empty() ? results_ : proc_results_; - if(current_option_state_ < option_state::reduced) { - if(current_option_state_ == option_state::parsing) { - res = results_; - _validate_results(res); - } - if(!res.empty()) { - results_t extra; - _reduce_results(extra, res); - if(!extra.empty()) { - res = std::move(extra); - } - } - } - return res; - } + CLI11_NODISCARD results_t reduced_results() const; /// Get the results as a specified type template <typename T> void results(T &output) const { - bool retval; + bool retval = false; if(current_option_state_ >= option_state::reduced || (results_.size() == 1 && validators_.empty())) { const results_t &res = (proc_results_.empty()) ? results_ : proc_results_; retval = detail::lexical_conversion<T, T>(res, output); @@ -1059,14 +698,14 @@ class Option : public OptionBase<Option> { } /// Return the results as the specified type - template <typename T> T as() const { + template <typename T> CLI11_NODISCARD T as() const { T output; results(output); return output; } /// See if the callback has been run already - bool get_callback_run() const { return (current_option_state_ == option_state::callback_run); } + CLI11_NODISCARD bool get_callback_run() const { return (current_option_state_ == option_state::callback_run); } ///@} /// @name Custom options @@ -1085,48 +724,10 @@ class Option : public OptionBase<Option> { } /// Set a custom option size - Option *type_size(int option_type_size) { - if(option_type_size < 0) { - // this section is included for backwards compatibility - type_size_max_ = -option_type_size; - type_size_min_ = -option_type_size; - expected_max_ = detail::expected_max_vector_size; - } else { - type_size_max_ = option_type_size; - if(type_size_max_ < detail::expected_max_vector_size) { - type_size_min_ = option_type_size; - } else { - inject_separator_ = true; - } - if(type_size_max_ == 0) - required_ = false; - } - return this; - } - /// Set a custom option type size range - Option *type_size(int option_type_size_min, int option_type_size_max) { - if(option_type_size_min < 0 || option_type_size_max < 0) { - // this section is included for backwards compatibility - expected_max_ = detail::expected_max_vector_size; - option_type_size_min = (std::abs)(option_type_size_min); - option_type_size_max = (std::abs)(option_type_size_max); - } + Option *type_size(int option_type_size); - if(option_type_size_min > option_type_size_max) { - type_size_max_ = option_type_size_min; - type_size_min_ = option_type_size_max; - } else { - type_size_min_ = option_type_size_min; - type_size_max_ = option_type_size_max; - } - if(type_size_max_ == 0) { - required_ = false; - } - if(type_size_max_ >= detail::expected_max_vector_size) { - inject_separator_ = true; - } - return this; - } + /// Set a custom option type size range + Option *type_size(int option_type_size_min, int option_type_size_max); /// Set the value of the separator injection flag void inject_separator(bool value = true) { inject_separator_ = value; } @@ -1162,7 +763,7 @@ class Option : public OptionBase<Option> { add_result(val_str); // if trigger_on_result_ is set the callback already ran if(run_callback_for_default_ && !trigger_on_result_) { - run_callback(); // run callback sets the state we need to reset it again + run_callback(); // run callback sets the state, we need to reset it again current_option_state_ = option_state::parsing; } else { _validate_results(results_); @@ -1180,169 +781,27 @@ class Option : public OptionBase<Option> { } /// Get the full typename for this option - std::string get_type_name() const { - std::string full_type_name = type_name_(); - if(!validators_.empty()) { - for(auto &Validator : validators_) { - std::string vtype = Validator.get_description(); - if(!vtype.empty()) { - full_type_name += ":" + vtype; - } - } - } - return full_type_name; - } + CLI11_NODISCARD std::string get_type_name() const; private: /// Run the results through the Validators - void _validate_results(results_t &res) const { - // Run the Validators (can change the string) - if(!validators_.empty()) { - if(type_size_max_ > 1) { // in this context index refers to the index in the type - int index = 0; - if(get_items_expected_max() < static_cast<int>(res.size()) && - multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { - // create a negative index for the earliest ones - index = get_items_expected_max() - static_cast<int>(res.size()); - } - - for(std::string &result : res) { - if(detail::is_separator(result) && type_size_max_ != type_size_min_ && index >= 0) { - index = 0; // reset index for variable size chunks - continue; - } - auto err_msg = _validate(result, (index >= 0) ? (index % type_size_max_) : index); - if(!err_msg.empty()) - throw ValidationError(get_name(), err_msg); - ++index; - } - } else { - int index = 0; - if(expected_max_ < static_cast<int>(res.size()) && - multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { - // create a negative index for the earliest ones - index = expected_max_ - static_cast<int>(res.size()); - } - for(std::string &result : res) { - auto err_msg = _validate(result, index); - ++index; - if(!err_msg.empty()) - throw ValidationError(get_name(), err_msg); - } - } - } - } + void _validate_results(results_t &res) const; /** reduce the results in accordance with the MultiOptionPolicy - @param[out] res results are assigned to res if there if they are different + @param[out] out results are assigned to res if there if they are different */ - void _reduce_results(results_t &res, const results_t &original) const { - - // max num items expected or length of vector, always at least 1 - // Only valid for a trimming policy - - res.clear(); - // Operation depends on the policy setting - switch(multi_option_policy_) { - case MultiOptionPolicy::TakeAll: - break; - case MultiOptionPolicy::TakeLast: { - // Allow multi-option sizes (including 0) - std::size_t trim_size = std::min<std::size_t>( - static_cast<std::size_t>(std::max<int>(get_items_expected_max(), 1)), original.size()); - if(original.size() != trim_size) { - res.assign(original.end() - static_cast<results_t::difference_type>(trim_size), original.end()); - } - } break; - case MultiOptionPolicy::TakeFirst: { - std::size_t trim_size = std::min<std::size_t>( - static_cast<std::size_t>(std::max<int>(get_items_expected_max(), 1)), original.size()); - if(original.size() != trim_size) { - res.assign(original.begin(), original.begin() + static_cast<results_t::difference_type>(trim_size)); - } - } break; - case MultiOptionPolicy::Join: - if(results_.size() > 1) { - res.push_back(detail::join(original, std::string(1, (delimiter_ == '\0') ? '\n' : delimiter_))); - } - break; - case MultiOptionPolicy::Throw: - default: { - auto num_min = static_cast<std::size_t>(get_items_expected_min()); - auto num_max = static_cast<std::size_t>(get_items_expected_max()); - if(num_min == 0) { - num_min = 1; - } - if(num_max == 0) { - num_max = 1; - } - if(original.size() < num_min) { - throw ArgumentMismatch::AtLeast(get_name(), static_cast<int>(num_min), original.size()); - } - if(original.size() > num_max) { - throw ArgumentMismatch::AtMost(get_name(), static_cast<int>(num_max), original.size()); - } - break; - } - } - } + void _reduce_results(results_t &out, const results_t &original) const; // Run a result through the Validators - std::string _validate(std::string &result, int index) const { - std::string err_msg; - if(result.empty() && expected_min_ == 0) { - // an empty with nothing expected is allowed - return err_msg; - } - for(const auto &vali : validators_) { - auto v = vali.get_application_index(); - if(v == -1 || v == index) { - try { - err_msg = vali(result); - } catch(const ValidationError &err) { - err_msg = err.what(); - } - if(!err_msg.empty()) - break; - } - } - - return err_msg; - } + std::string _validate(std::string &result, int index) const; /// Add a single result to the result set, taking into account delimiters - int _add_result(std::string &&result, std::vector<std::string> &res) const { - int result_count = 0; - if(allow_extra_args_ && !result.empty() && result.front() == '[' && - result.back() == ']') { // this is now a vector string likely from the default or user entry - result.pop_back(); - - for(auto &var : CLI::detail::split(result.substr(1), ',')) { - if(!var.empty()) { - result_count += _add_result(std::move(var), res); - } - } - return result_count; - } - if(delimiter_ == '\0') { - res.push_back(std::move(result)); - ++result_count; - } else { - if((result.find_first_of(delimiter_) != std::string::npos)) { - for(const auto &var : CLI::detail::split(result, delimiter_)) { - if(!var.empty()) { - res.push_back(var); - ++result_count; - } - } - } else { - res.push_back(std::move(result)); - ++result_count; - } - } - return result_count; - } -}; // namespace CLI + int _add_result(std::string &&result, std::vector<std::string> &res) const; +}; // [CLI11:option_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Option_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/Split.hpp b/packages/CLI11/include/CLI/Split.hpp index 83ef572c1c42e7a575d0d22c7e2515959bf9b566..14be822893b010b76f80ce1b2eb5b89e1596197a 100644 --- a/packages/CLI11/include/CLI/Split.hpp +++ b/packages/CLI11/include/CLI/Split.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,8 +13,7 @@ #include <vector> // [CLI11:public_includes:end] -#include "Error.hpp" -#include "StringTools.hpp" +#include "Macros.hpp" namespace CLI { // [CLI11:split_hpp:verbatim] @@ -22,122 +21,28 @@ namespace CLI { namespace detail { // Returns false if not a short option. Otherwise, sets opt name and rest and returns true -inline bool split_short(const std::string ¤t, std::string &name, std::string &rest) { - if(current.size() > 1 && current[0] == '-' && valid_first_char(current[1])) { - name = current.substr(1, 1); - rest = current.substr(2); - return true; - } - return false; -} +CLI11_INLINE bool split_short(const std::string ¤t, std::string &name, std::string &rest); // Returns false if not a long option. Otherwise, sets opt name and other side of = and returns true -inline bool split_long(const std::string ¤t, std::string &name, std::string &value) { - if(current.size() > 2 && current.substr(0, 2) == "--" && valid_first_char(current[2])) { - auto loc = current.find_first_of('='); - if(loc != std::string::npos) { - name = current.substr(2, loc - 2); - value = current.substr(loc + 1); - } else { - name = current.substr(2); - value = ""; - } - return true; - } - return false; -} +CLI11_INLINE bool split_long(const std::string ¤t, std::string &name, std::string &value); // Returns false if not a windows style option. Otherwise, sets opt name and value and returns true -inline bool split_windows_style(const std::string ¤t, std::string &name, std::string &value) { - if(current.size() > 1 && current[0] == '/' && valid_first_char(current[1])) { - auto loc = current.find_first_of(':'); - if(loc != std::string::npos) { - name = current.substr(1, loc - 1); - value = current.substr(loc + 1); - } else { - name = current.substr(1); - value = ""; - } - return true; - } - return false; -} +CLI11_INLINE bool split_windows_style(const std::string ¤t, std::string &name, std::string &value); // Splits a string into multiple long and short names -inline std::vector<std::string> split_names(std::string current) { - std::vector<std::string> output; - std::size_t val; - while((val = current.find(",")) != std::string::npos) { - output.push_back(trim_copy(current.substr(0, val))); - current = current.substr(val + 1); - } - output.push_back(trim_copy(current)); - return output; -} +CLI11_INLINE std::vector<std::string> split_names(std::string current); /// extract default flag values either {def} or starting with a ! -inline std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str) { - std::vector<std::string> flags = split_names(str); - flags.erase(std::remove_if(flags.begin(), - flags.end(), - [](const std::string &name) { - return ((name.empty()) || (!(((name.find_first_of('{') != std::string::npos) && - (name.back() == '}')) || - (name[0] == '!')))); - }), - flags.end()); - std::vector<std::pair<std::string, std::string>> output; - output.reserve(flags.size()); - for(auto &flag : flags) { - auto def_start = flag.find_first_of('{'); - std::string defval = "false"; - if((def_start != std::string::npos) && (flag.back() == '}')) { - defval = flag.substr(def_start + 1); - defval.pop_back(); - flag.erase(def_start, std::string::npos); - } - flag.erase(0, flag.find_first_not_of("-!")); - output.emplace_back(flag, defval); - } - return output; -} +CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str); /// Get a vector of short names, one of long names, and a single name -inline std::tuple<std::vector<std::string>, std::vector<std::string>, std::string> -get_names(const std::vector<std::string> &input) { - - std::vector<std::string> short_names; - std::vector<std::string> long_names; - std::string pos_name; - - for(std::string name : input) { - if(name.length() == 0) { - continue; - } - if(name.length() > 1 && name[0] == '-' && name[1] != '-') { - if(name.length() == 2 && valid_first_char(name[1])) - short_names.emplace_back(1, name[1]); - else - throw BadNameString::OneCharName(name); - } else if(name.length() > 2 && name.substr(0, 2) == "--") { - name = name.substr(2); - if(valid_name_string(name)) - long_names.push_back(name); - else - throw BadNameString::BadLongName(name); - } else if(name == "-" || name == "--") { - throw BadNameString::DashesOnly(name); - } else { - if(pos_name.length() > 0) - throw BadNameString::MultiPositionalNames(name); - pos_name = name; - } - } - - return std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>( - short_names, long_names, pos_name); -} +CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string> +get_names(const std::vector<std::string> &input); } // namespace detail // [CLI11:split_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Split_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/StringTools.hpp b/packages/CLI11/include/CLI/StringTools.hpp index 4718aedd9a9e301591afacc4ac22730e02e1d183..a891b1279d8d6fc0a3cd61501dd21b6874483efc 100644 --- a/packages/CLI11/include/CLI/StringTools.hpp +++ b/packages/CLI11/include/CLI/StringTools.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -17,6 +17,8 @@ #include <vector> // [CLI11:public_includes:end] +#include "Macros.hpp" + namespace CLI { // [CLI11:string_tools_hpp:verbatim] @@ -43,21 +45,7 @@ namespace detail { constexpr int expected_max_vector_size{1 << 29}; // Based on http://stackoverflow.com/questions/236129/split-a-string-in-c /// Split a string by a delim -inline std::vector<std::string> split(const std::string &s, char delim) { - std::vector<std::string> elems; - // Check to see if empty string, give consistent result - if(s.empty()) { - elems.emplace_back(); - } else { - std::stringstream ss; - ss.str(s); - std::string item; - while(std::getline(ss, item, delim)) { - elems.push_back(item); - } - } - return elems; -} +CLI11_INLINE std::vector<std::string> split(const std::string &s, char delim); /// Simple function to join a string template <typename T> std::string join(const T &v, std::string delim = ",") { @@ -106,33 +94,16 @@ template <typename T> std::string rjoin(const T &v, std::string delim = ",") { // Based roughly on http://stackoverflow.com/questions/25829143/c-trim-whitespace-from-a-string /// Trim whitespace from left of string -inline std::string <rim(std::string &str) { - auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace<char>(ch, std::locale()); }); - str.erase(str.begin(), it); - return str; -} +CLI11_INLINE std::string <rim(std::string &str); /// Trim anything from left of string -inline std::string <rim(std::string &str, const std::string &filter) { - auto it = std::find_if(str.begin(), str.end(), [&filter](char ch) { return filter.find(ch) == std::string::npos; }); - str.erase(str.begin(), it); - return str; -} +CLI11_INLINE std::string <rim(std::string &str, const std::string &filter); /// Trim whitespace from right of string -inline std::string &rtrim(std::string &str) { - auto it = std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace<char>(ch, std::locale()); }); - str.erase(it.base(), str.end()); - return str; -} +CLI11_INLINE std::string &rtrim(std::string &str); /// Trim anything from right of string -inline std::string &rtrim(std::string &str, const std::string &filter) { - auto it = - std::find_if(str.rbegin(), str.rend(), [&filter](char ch) { return filter.find(ch) == std::string::npos; }); - str.erase(it.base(), str.end()); - return str; -} +CLI11_INLINE std::string &rtrim(std::string &str, const std::string &filter); /// Trim whitespace from string inline std::string &trim(std::string &str) { return ltrim(rtrim(str)); } @@ -147,31 +118,13 @@ inline std::string trim_copy(const std::string &str) { } /// remove quotes at the front and back of a string either '"' or '\'' -inline std::string &remove_quotes(std::string &str) { - if(str.length() > 1 && (str.front() == '"' || str.front() == '\'')) { - if(str.front() == str.back()) { - str.pop_back(); - str.erase(str.begin(), str.begin() + 1); - } - } - return str; -} +CLI11_INLINE std::string &remove_quotes(std::string &str); /// Add a leader to the beginning of all new lines (nothing is added /// at the start of the first line). `"; "` would be for ini files /// /// Can't use Regex, or this would be a subs. -inline std::string fix_newlines(const std::string &leader, std::string input) { - std::string::size_type n = 0; - while(n != std::string::npos && n < input.size()) { - n = input.find('\n', n); - if(n != std::string::npos) { - input = input.substr(0, n + 1) + leader + input.substr(n + 1); - n += leader.size(); - } - } - return input; -} +CLI11_INLINE std::string fix_newlines(const std::string &leader, std::string input); /// Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered) inline std::string trim_copy(const std::string &str, const std::string &filter) { @@ -179,40 +132,11 @@ inline std::string trim_copy(const std::string &str, const std::string &filter) return trim(s, filter); } /// Print a two part "help" string -inline std::ostream &format_help(std::ostream &out, std::string name, const std::string &description, std::size_t wid) { - name = " " + name; - out << std::setw(static_cast<int>(wid)) << std::left << name; - if(!description.empty()) { - if(name.length() >= wid) - out << "\n" << std::setw(static_cast<int>(wid)) << ""; - for(const char c : description) { - out.put(c); - if(c == '\n') { - out << std::setw(static_cast<int>(wid)) << ""; - } - } - } - out << "\n"; - return out; -} +CLI11_INLINE std::ostream & +format_help(std::ostream &out, std::string name, const std::string &description, std::size_t wid); /// Print subcommand aliases -inline std::ostream &format_aliases(std::ostream &out, const std::vector<std::string> &aliases, std::size_t wid) { - if(!aliases.empty()) { - out << std::setw(static_cast<int>(wid)) << " aliases: "; - bool front = true; - for(const auto &alias : aliases) { - if(!front) { - out << ", "; - } else { - front = false; - } - out << detail::fix_newlines(" ", alias); - } - out << "\n"; - } - return out; -} +CLI11_INLINE std::ostream &format_aliases(std::ostream &out, const std::vector<std::string> &aliases, std::size_t wid); /// Verify the first character of an option /// - is a trigger character, ! has special meaning and new lines would just be annoying to deal with @@ -227,16 +151,7 @@ template <typename T> bool valid_later_char(T c) { } /// Verify an option/subcommand name -inline bool valid_name_string(const std::string &str) { - if(str.empty() || !valid_first_char(str[0])) { - return false; - } - auto e = str.end(); - for(auto c = str.begin() + 1; c != e; ++c) - if(!valid_later_char(*c)) - return false; - return true; -} +CLI11_INLINE bool valid_name_string(const std::string &str); /// Verify an app name inline bool valid_alias_name_string(const std::string &str) { @@ -270,66 +185,20 @@ inline std::string remove_underscore(std::string str) { } /// Find and replace a substring with another substring -inline std::string find_and_replace(std::string str, std::string from, std::string to) { - - std::size_t start_pos = 0; - - while((start_pos = str.find(from, start_pos)) != std::string::npos) { - str.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - - return str; -} +CLI11_INLINE std::string find_and_replace(std::string str, std::string from, std::string to); /// check if the flag definitions has possible false flags inline bool has_default_flag_values(const std::string &flags) { return (flags.find_first_of("{!") != std::string::npos); } -inline void remove_default_flag_values(std::string &flags) { - auto loc = flags.find_first_of('{', 2); - while(loc != std::string::npos) { - auto finish = flags.find_first_of("},", loc + 1); - if((finish != std::string::npos) && (flags[finish] == '}')) { - flags.erase(flags.begin() + static_cast<std::ptrdiff_t>(loc), - flags.begin() + static_cast<std::ptrdiff_t>(finish) + 1); - } - loc = flags.find_first_of('{', loc + 1); - } - flags.erase(std::remove(flags.begin(), flags.end(), '!'), flags.end()); -} +CLI11_INLINE void remove_default_flag_values(std::string &flags); /// Check if a string is a member of a list of strings and optionally ignore case or ignore underscores -inline std::ptrdiff_t find_member(std::string name, - const std::vector<std::string> names, - bool ignore_case = false, - bool ignore_underscore = false) { - auto it = std::end(names); - if(ignore_case) { - if(ignore_underscore) { - name = detail::to_lower(detail::remove_underscore(name)); - it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { - return detail::to_lower(detail::remove_underscore(local_name)) == name; - }); - } else { - name = detail::to_lower(name); - it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { - return detail::to_lower(local_name) == name; - }); - } - - } else if(ignore_underscore) { - name = detail::remove_underscore(name); - it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { - return detail::remove_underscore(local_name) == name; - }); - } else { - it = std::find(std::begin(names), std::end(names), name); - } - - return (it != std::end(names)) ? (it - std::begin(names)) : (-1); -} +CLI11_INLINE std::ptrdiff_t find_member(std::string name, + const std::vector<std::string> names, + bool ignore_case = false, + bool ignore_underscore = false); /// Find a trigger string and call a modify callable function that takes the current string and starting position of the /// trigger and returns the position in the string to search for the next trigger string @@ -343,88 +212,23 @@ template <typename Callable> inline std::string find_and_modify(std::string str, /// Split a string '"one two" "three"' into 'one two', 'three' /// Quote characters can be ` ' or " -inline std::vector<std::string> split_up(std::string str, char delimiter = '\0') { - - const std::string delims("\'\"`"); - auto find_ws = [delimiter](char ch) { - return (delimiter == '\0') ? (std::isspace<char>(ch, std::locale()) != 0) : (ch == delimiter); - }; - trim(str); - - std::vector<std::string> output; - bool embeddedQuote = false; - char keyChar = ' '; - while(!str.empty()) { - if(delims.find_first_of(str[0]) != std::string::npos) { - keyChar = str[0]; - auto end = str.find_first_of(keyChar, 1); - while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes - end = str.find_first_of(keyChar, end + 1); - embeddedQuote = true; - } - if(end != std::string::npos) { - output.push_back(str.substr(1, end - 1)); - if(end + 2 < str.size()) { - str = str.substr(end + 2); - } else { - str.clear(); - } - - } else { - output.push_back(str.substr(1)); - str = ""; - } - } else { - auto it = std::find_if(std::begin(str), std::end(str), find_ws); - if(it != std::end(str)) { - std::string value = std::string(str.begin(), it); - output.push_back(value); - str = std::string(it + 1, str.end()); - } else { - output.push_back(str); - str = ""; - } - } - // transform any embedded quotes into the regular character - if(embeddedQuote) { - output.back() = find_and_replace(output.back(), std::string("\\") + keyChar, std::string(1, keyChar)); - embeddedQuote = false; - } - trim(str); - } - return output; -} +CLI11_INLINE std::vector<std::string> split_up(std::string str, char delimiter = '\0'); /// This function detects an equal or colon followed by an escaped quote after an argument /// then modifies the string to replace the equality with a space. This is needed /// to allow the split up function to work properly and is intended to be used with the find_and_modify function /// the return value is the offset+1 which is required by the find_and_modify function. -inline std::size_t escape_detect(std::string &str, std::size_t offset) { - auto next = str[offset + 1]; - if((next == '\"') || (next == '\'') || (next == '`')) { - auto astart = str.find_last_of("-/ \"\'`", offset - 1); - if(astart != std::string::npos) { - if(str[astart] == ((str[offset] == '=') ? '-' : '/')) - str[offset] = ' '; // interpret this as a space so the split_up works properly - } - } - return offset + 1; -} +CLI11_INLINE std::size_t escape_detect(std::string &str, std::size_t offset); /// Add quotes if the string contains spaces -inline std::string &add_quotes_if_needed(std::string &str) { - if((str.front() != '"' && str.front() != '\'') || str.front() != str.back()) { - char quote = str.find('"') < str.find('\'') ? '\'' : '"'; - if(str.find(' ') != std::string::npos) { - str.insert(0, 1, quote); - str.append(1, quote); - } - } - return str; -} +CLI11_INLINE std::string &add_quotes_if_needed(std::string &str); } // namespace detail // [CLI11:string_tools_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/StringTools_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/Timer.hpp b/packages/CLI11/include/CLI/Timer.hpp index 429ca026c5ea3d66a2dfe786d7965f231cf36b7f..c6898204e203bf1e860ab07e164849a2b60ba9f2 100644 --- a/packages/CLI11/include/CLI/Timer.hpp +++ b/packages/CLI11/include/CLI/Timer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -12,6 +12,8 @@ #define _GLIBCXX_USE_NANOSLEEP #endif +#include <cmath> + #include <array> #include <chrono> #include <functional> @@ -63,7 +65,7 @@ class Timer { /// Time a function by running it multiple times. Target time is the len to target. std::string time_it(std::function<void()> f, double target_time = 1) { time_point start = start_; - double total_time; + double total_time = NAN; start_ = clock::now(); std::size_t n = 0; @@ -79,7 +81,7 @@ class Timer { } /// This formats the numerical value for the time string - std::string make_time_str() const { + std::string make_time_str() const { // NOLINT(modernize-use-nodiscard) time_point stop = clock::now(); std::chrono::duration<double> elapsed = stop - start_; double time = elapsed.count() / static_cast<double>(cycles); @@ -88,7 +90,7 @@ class Timer { // LCOV_EXCL_START /// This prints out a time string from a time - std::string make_time_str(double time) const { + std::string make_time_str(double time) const { // NOLINT(modernize-use-nodiscard) auto print_it = [](double x, std::string unit) { const unsigned int buffer_length = 50; std::array<char, buffer_length> buffer; @@ -98,17 +100,16 @@ class Timer { if(time < .000001) return print_it(time * 1000000000, "ns"); - else if(time < .001) + if(time < .001) return print_it(time * 1000000, "us"); - else if(time < 1) + if(time < 1) return print_it(time * 1000, "ms"); - else - return print_it(time, "s"); + return print_it(time, "s"); } // LCOV_EXCL_STOP /// This is the main function, it creates a string - std::string to_string() const { return time_print_(title_, make_time_str()); } + std::string to_string() const { return time_print_(title_, make_time_str()); } // NOLINT(modernize-use-nodiscard) /// Division sets the number of cycles to divide by (no graphical change) Timer &operator/(std::size_t val) { diff --git a/packages/CLI11/include/CLI/TypeTools.hpp b/packages/CLI11/include/CLI/TypeTools.hpp index 0fa2299758d56b8b471fd8c6bc563aa08113459c..e3c97b17e9990bdc539f39e659807f4886a87f48 100644 --- a/packages/CLI11/include/CLI/TypeTools.hpp +++ b/packages/CLI11/include/CLI/TypeTools.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,6 +9,7 @@ // [CLI11:public_includes:set] #include <cstdint> #include <exception> +#include <limits> #include <memory> #include <string> #include <type_traits> @@ -148,7 +149,7 @@ template <typename T, typename C> class is_direct_constructible { #ifdef __CUDACC__ #pragma diag_suppress 2361 #endif - TT { std::declval<CC>() } + TT{std::declval<CC>()} #ifdef __CUDACC__ #pragma diag_default 2361 #endif @@ -275,7 +276,7 @@ template <typename T, enable_if_t<std::is_constructible<std::string, T>::value && !std::is_convertible<T, std::string>::value, detail::enabler> = detail::dummy> std::string to_string(const T &value) { - return std::string(value); + return std::string(value); // NOLINT(google-readability-casting) } /// Convert an object to a string (streaming must be supported for that type) @@ -295,7 +296,7 @@ template <typename T, !is_readable_container<typename std::remove_const<T>::type>::value, detail::enabler> = detail::dummy> std::string to_string(T &&) { - return std::string{}; + return {}; } /// convert a readable container to a string @@ -304,14 +305,17 @@ template <typename T, is_readable_container<T>::value, detail::enabler> = detail::dummy> std::string to_string(T &&variable) { - std::vector<std::string> defaults; auto cval = variable.begin(); auto end = variable.end(); + if(cval == end) { + return {"{}"}; + } + std::vector<std::string> defaults; while(cval != end) { defaults.emplace_back(CLI::detail::to_string(*cval)); ++cval; } - return std::string("[" + detail::join(defaults) + "]"); + return {"[" + detail::join(defaults) + "]"}; } /// special template overload @@ -759,8 +763,8 @@ inline typename std::enable_if<I == type_count_base<T>::value, std::string>::typ /// Recursively generate the tuple type name template <typename T, std::size_t I> inline typename std::enable_if<(I < type_count_base<T>::value), std::string>::type tuple_name() { - std::string str = std::string(type_name<typename std::decay<typename std::tuple_element<I, T>::type>::type>()) + - ',' + tuple_name<T, I + 1>(); + auto str = std::string{type_name<typename std::decay<typename std::tuple_element<I, T>::type>::type>()} + ',' + + tuple_name<T, I + 1>(); if(str.back() == ',') str.pop_back(); return str; @@ -796,7 +800,16 @@ bool integral_conversion(const std::string &input, T &output) noexcept { char *val = nullptr; std::uint64_t output_ll = std::strtoull(input.c_str(), &val, 0); output = static_cast<T>(output_ll); - return val == (input.c_str() + input.size()) && static_cast<std::uint64_t>(output) == output_ll; + if(val == (input.c_str() + input.size()) && static_cast<std::uint64_t>(output) == output_ll) { + return true; + } + val = nullptr; + std::int64_t output_sll = std::strtoll(input.c_str(), &val, 0); + if(val == (input.c_str() + input.size())) { + output = (output_sll < 0) ? static_cast<T>(0) : static_cast<T>(output_sll); + return (static_cast<std::int64_t>(output) == output_sll); + } + return false; } /// Convert to a signed integral @@ -808,7 +821,15 @@ bool integral_conversion(const std::string &input, T &output) noexcept { char *val = nullptr; std::int64_t output_ll = std::strtoll(input.c_str(), &val, 0); output = static_cast<T>(output_ll); - return val == (input.c_str() + input.size()) && static_cast<std::int64_t>(output) == output_ll; + if(val == (input.c_str() + input.size()) && static_cast<std::int64_t>(output) == output_ll) { + return true; + } + if(input == "true") { + // this is to deal with a few oddities with flags and wrapper int types + output = static_cast<T>(1); + return true; + } + return false; } /// Convert a flag into an integer value typically binary flags @@ -822,7 +843,7 @@ inline std::int64_t to_flag_value(std::string val) { return -1; } val = detail::to_lower(val); - std::int64_t ret; + std::int64_t ret = 0; if(val.size() == 1) { if(val[0] >= '1' && val[0] <= '9') { return (static_cast<std::int64_t>(val[0]) - '0'); @@ -998,17 +1019,18 @@ template < typename T, enable_if_t<classify_object<T>::value == object_category::number_constructible, detail::enabler> = detail::dummy> bool lexical_cast(const std::string &input, T &output) { - int val; + int val = 0; if(integral_conversion(input, val)) { output = T(val); return true; - } else { - double dval; - if(lexical_cast(input, dval)) { - output = T{dval}; - return true; - } } + + double dval = 0.0; + if(lexical_cast(input, dval)) { + output = T{dval}; + return true; + } + return from_stream(input, output); } @@ -1017,7 +1039,7 @@ template < typename T, enable_if_t<classify_object<T>::value == object_category::integer_constructible, detail::enabler> = detail::dummy> bool lexical_cast(const std::string &input, T &output) { - int val; + int val = 0; if(integral_conversion(input, val)) { output = T(val); return true; @@ -1030,7 +1052,7 @@ template < typename T, enable_if_t<classify_object<T>::value == object_category::double_constructible, detail::enabler> = detail::dummy> bool lexical_cast(const std::string &input, T &output) { - double val; + double val = 0.0; if(lexical_cast(input, val)) { output = T{val}; return true; @@ -1043,7 +1065,7 @@ template <typename T, enable_if_t<classify_object<T>::value == object_category::other && std::is_assignable<T &, int>::value, detail::enabler> = detail::dummy> bool lexical_cast(const std::string &input, T &output) { - int val; + int val = 0; if(integral_conversion(input, val)) { #ifdef _MSC_VER #pragma warning(push) @@ -1131,7 +1153,7 @@ bool lexical_assign(const std::string &input, AssignTo &output) { output = 0; return true; } - int val; + int val = 0; if(lexical_cast(input, val)) { output = val; return true; @@ -1208,6 +1230,13 @@ template <class AssignTo, detail::enabler> = detail::dummy> bool lexical_conversion(const std::vector<std ::string> &strings, AssignTo &output) { output.erase(output.begin(), output.end()); + if(strings.size() == 1 && strings[0] == "{}") { + return true; + } + bool skip_remaining = false; + if(strings.size() == 2 && strings[0] == "{}" && is_separator(strings[1])) { + skip_remaining = true; + } for(const auto &elem : strings) { typename AssignTo::value_type out; bool retval = lexical_assign<typename AssignTo::value_type, typename ConvertTo::value_type>(elem, out); @@ -1215,6 +1244,9 @@ bool lexical_conversion(const std::vector<std ::string> &strings, AssignTo &outp return false; } output.insert(output.end(), std::move(out)); + if(skip_remaining) { + break; + } } return (!output.empty()); } @@ -1235,9 +1267,8 @@ bool lexical_conversion(const std::vector<std::string> &strings, AssignTo &outpu output = ConvertTo{x, y}; } return worked; - } else { - return lexical_assign<AssignTo, ConvertTo>(strings[0], output); } + return lexical_assign<AssignTo, ConvertTo>(strings[0], output); } /// Conversion to a vector type using a particular single type as the conversion type @@ -1488,61 +1519,41 @@ bool lexical_conversion(const std::vector<std::string> &strings, AssignTo &outpu return false; } -/// Sum a vector of flag representations -/// The flag vector produces a series of strings in a vector, simple true is represented by a "1", simple false is -/// by -/// "-1" an if numbers are passed by some fashion they are captured as well so the function just checks for the most -/// common true and false strings then uses stoll to convert the rest for summing -template <typename T, enable_if_t<std::is_unsigned<T>::value, detail::enabler> = detail::dummy> -void sum_flag_vector(const std::vector<std::string> &flags, T &output) { - std::int64_t count{0}; - for(auto &flag : flags) { - count += detail::to_flag_value(flag); - } - output = (count > 0) ? static_cast<T>(count) : T{0}; -} - -/// Sum a vector of flag representations -/// The flag vector produces a series of strings in a vector, simple true is represented by a "1", simple false is -/// by -/// "-1" an if numbers are passed by some fashion they are captured as well so the function just checks for the most -/// common true and false strings then uses stoll to convert the rest for summing -template <typename T, enable_if_t<std::is_signed<T>::value, detail::enabler> = detail::dummy> -void sum_flag_vector(const std::vector<std::string> &flags, T &output) { - std::int64_t count{0}; - for(auto &flag : flags) { - count += detail::to_flag_value(flag); +/// Sum a vector of strings +inline std::string sum_string_vector(const std::vector<std::string> &values) { + double val{0.0}; + bool fail{false}; + std::string output; + for(const auto &arg : values) { + double tv{0.0}; + auto comp = detail::lexical_cast<double>(arg, tv); + if(!comp) { + try { + tv = static_cast<double>(detail::to_flag_value(arg)); + } catch(const std::exception &) { + fail = true; + break; + } + } + val += tv; } - output = static_cast<T>(count); -} - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4800) -#endif -// with Atomic<XX> this could produce a warning due to the conversion but if atomic gets here it is an old style so will -// most likely still work - -/// Sum a vector of flag representations -/// The flag vector produces a series of strings in a vector, simple true is represented by a "1", simple false is -/// by -/// "-1" an if numbers are passed by some fashion they are captured as well so the function just checks for the most -/// common true and false strings then uses stoll to convert the rest for summing -template <typename T, - enable_if_t<!std::is_signed<T>::value && !std::is_unsigned<T>::value, detail::enabler> = detail::dummy> -void sum_flag_vector(const std::vector<std::string> &flags, T &output) { - std::int64_t count{0}; - for(auto &flag : flags) { - count += detail::to_flag_value(flag); + if(fail) { + for(const auto &arg : values) { + output.append(arg); + } + } else { + if(val <= static_cast<double>((std::numeric_limits<std::int64_t>::min)()) || + val >= static_cast<double>((std::numeric_limits<std::int64_t>::max)()) || + // NOLINTNEXTLINE(clang-diagnostic-float-equal,bugprone-narrowing-conversions) + val == static_cast<std::int64_t>(val)) { + output = detail::value_string(static_cast<int64_t>(val)); + } else { + output = detail::value_string(val); + } } - std::string out = detail::to_string(count); - lexical_cast(out, output); + return output; } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - } // namespace detail // [CLI11:type_tools_hpp:end] } // namespace CLI diff --git a/packages/CLI11/include/CLI/Validators.hpp b/packages/CLI11/include/CLI/Validators.hpp index 03eb77b6ffbe290ad130daedd7227892ebeec356..9a6a364e35225fcfcd98d4a9db66da57c859e7a7 100644 --- a/packages/CLI11/include/CLI/Validators.hpp +++ b/packages/CLI11/include/CLI/Validators.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,6 +6,7 @@ #pragma once +#include "Error.hpp" #include "Macros.hpp" #include "StringTools.hpp" #include "TypeTools.hpp" @@ -32,6 +33,9 @@ // Filesystem cannot be used if targeting macOS < 10.15 #if defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 #define CLI11_HAS_FILESYSTEM 0 +#elif defined(__wasi__) +// As of wasi-sdk-14, filesystem is not implemented +#define CLI11_HAS_FILESYSTEM 0 #else #include <filesystem> #if defined __cpp_lib_filesystem && __cpp_lib_filesystem >= 201703 @@ -91,6 +95,9 @@ class Validator { /// specify that a validator should not modify the input bool non_modifying_{false}; + Validator(std::string validator_desc, std::function<std::string(std::string &)> func) + : desc_function_([validator_desc]() { return validator_desc; }), func_(std::move(func)) {} + public: Validator() = default; /// Construct a Validator with just the description string @@ -106,18 +113,7 @@ class Validator { } /// This is the required operator for a Validator - provided to help /// users (CLI11 uses the member `func` directly) - std::string operator()(std::string &str) const { - std::string retstring; - if(active_) { - if(non_modifying_) { - std::string value = str; - retstring = func_(value); - } else { - retstring = func_(str); - } - } - return retstring; - } + std::string operator()(std::string &str) const; /// This is the required operator for a Validator - provided to help /// users (CLI11 uses the member `func` directly) @@ -132,13 +128,10 @@ class Validator { return *this; } /// Specify the type string - Validator description(std::string validator_desc) const { - Validator newval(*this); - newval.desc_function_ = [validator_desc]() { return validator_desc; }; - return newval; - } + CLI11_NODISCARD Validator description(std::string validator_desc) const; + /// Generate type description information for the Validator - std::string get_description() const { + CLI11_NODISCARD std::string get_description() const { if(active_) { return desc_function_(); } @@ -150,20 +143,20 @@ class Validator { return *this; } /// Specify the type string - Validator name(std::string validator_name) const { + CLI11_NODISCARD Validator name(std::string validator_name) const { Validator newval(*this); newval.name_ = std::move(validator_name); return newval; } /// Get the name of the Validator - const std::string &get_name() const { return name_; } + CLI11_NODISCARD const std::string &get_name() const { return name_; } /// Specify whether the Validator is active or not Validator &active(bool active_val = true) { active_ = active_val; return *this; } /// Specify whether the Validator is active or not - Validator active(bool active_val = true) const { + CLI11_NODISCARD Validator active(bool active_val = true) const { Validator newval(*this); newval.active_ = active_val; return newval; @@ -180,107 +173,33 @@ class Validator { return *this; } /// Specify the application index of a validator - Validator application_index(int app_index) const { + CLI11_NODISCARD Validator application_index(int app_index) const { Validator newval(*this); newval.application_index_ = app_index; return newval; } /// Get the current value of the application index - int get_application_index() const { return application_index_; } + CLI11_NODISCARD int get_application_index() const { return application_index_; } /// Get a boolean if the validator is active - bool get_active() const { return active_; } + CLI11_NODISCARD bool get_active() const { return active_; } /// Get a boolean if the validator is allowed to modify the input returns true if it can modify the input - bool get_modifying() const { return !non_modifying_; } + CLI11_NODISCARD bool get_modifying() const { return !non_modifying_; } /// Combining validators is a new validator. Type comes from left validator if function, otherwise only set if the /// same. - Validator operator&(const Validator &other) const { - Validator newval; - - newval._merge_description(*this, other, " AND "); - - // Give references (will make a copy in lambda function) - const std::function<std::string(std::string & filename)> &f1 = func_; - const std::function<std::string(std::string & filename)> &f2 = other.func_; - - newval.func_ = [f1, f2](std::string &input) { - std::string s1 = f1(input); - std::string s2 = f2(input); - if(!s1.empty() && !s2.empty()) - return std::string("(") + s1 + ") AND (" + s2 + ")"; - else - return s1 + s2; - }; - - newval.active_ = (active_ & other.active_); - newval.application_index_ = application_index_; - return newval; - } + Validator operator&(const Validator &other) const; /// Combining validators is a new validator. Type comes from left validator if function, otherwise only set if the /// same. - Validator operator|(const Validator &other) const { - Validator newval; - - newval._merge_description(*this, other, " OR "); - - // Give references (will make a copy in lambda function) - const std::function<std::string(std::string &)> &f1 = func_; - const std::function<std::string(std::string &)> &f2 = other.func_; - - newval.func_ = [f1, f2](std::string &input) { - std::string s1 = f1(input); - std::string s2 = f2(input); - if(s1.empty() || s2.empty()) - return std::string(); - - return std::string("(") + s1 + ") OR (" + s2 + ")"; - }; - newval.active_ = (active_ & other.active_); - newval.application_index_ = application_index_; - return newval; - } + Validator operator|(const Validator &other) const; /// Create a validator that fails when a given validator succeeds - Validator operator!() const { - Validator newval; - const std::function<std::string()> &dfunc1 = desc_function_; - newval.desc_function_ = [dfunc1]() { - auto str = dfunc1(); - return (!str.empty()) ? std::string("NOT ") + str : std::string{}; - }; - // Give references (will make a copy in lambda function) - const std::function<std::string(std::string & res)> &f1 = func_; - - newval.func_ = [f1, dfunc1](std::string &test) -> std::string { - std::string s1 = f1(test); - if(s1.empty()) { - return std::string("check ") + dfunc1() + " succeeded improperly"; - } - return std::string{}; - }; - newval.active_ = active_; - newval.application_index_ = application_index_; - return newval; - } + Validator operator!() const; private: - void _merge_description(const Validator &val1, const Validator &val2, const std::string &merger) { - - const std::function<std::string()> &dfunc1 = val1.desc_function_; - const std::function<std::string()> &dfunc2 = val2.desc_function_; - - desc_function_ = [=]() { - std::string f1 = dfunc1(); - std::string f2 = dfunc2(); - if((f1.empty()) || (f2.empty())) { - return f1 + f2; - } - return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')'; - }; - } -}; // namespace CLI + void _merge_description(const Validator &val1, const Validator &val2, const std::string &merger); +}; /// Class wrapping some of the accessors of Validator class CustomValidator : public Validator { @@ -294,132 +213,37 @@ namespace detail { /// CLI enumeration of different file types enum class path_type { nonexistent, file, directory }; -#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 /// get the type of the path from a file name -inline path_type check_path(const char *file) noexcept { - std::error_code ec; - auto stat = std::filesystem::status(file, ec); - if(ec) { - return path_type::nonexistent; - } - switch(stat.type()) { - case std::filesystem::file_type::none: - case std::filesystem::file_type::not_found: - return path_type::nonexistent; - case std::filesystem::file_type::directory: - return path_type::directory; - case std::filesystem::file_type::symlink: - case std::filesystem::file_type::block: - case std::filesystem::file_type::character: - case std::filesystem::file_type::fifo: - case std::filesystem::file_type::socket: - case std::filesystem::file_type::regular: - case std::filesystem::file_type::unknown: - default: - return path_type::file; - } -} -#else -/// get the type of the path from a file name -inline path_type check_path(const char *file) noexcept { -#if defined(_MSC_VER) - struct __stat64 buffer; - if(_stat64(file, &buffer) == 0) { - return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file; - } -#else - struct stat buffer; - if(stat(file, &buffer) == 0) { - return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file; - } -#endif - return path_type::nonexistent; -} -#endif +CLI11_INLINE path_type check_path(const char *file) noexcept; + /// Check for an existing file (returns error message if check fails) class ExistingFileValidator : public Validator { public: - ExistingFileValidator() : Validator("FILE") { - func_ = [](std::string &filename) { - auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistent) { - return "File does not exist: " + filename; - } - if(path_result == path_type::directory) { - return "File is actually a directory: " + filename; - } - return std::string(); - }; - } + ExistingFileValidator(); }; /// Check for an existing directory (returns error message if check fails) class ExistingDirectoryValidator : public Validator { public: - ExistingDirectoryValidator() : Validator("DIR") { - func_ = [](std::string &filename) { - auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistent) { - return "Directory does not exist: " + filename; - } - if(path_result == path_type::file) { - return "Directory is actually a file: " + filename; - } - return std::string(); - }; - } + ExistingDirectoryValidator(); }; /// Check for an existing path class ExistingPathValidator : public Validator { public: - ExistingPathValidator() : Validator("PATH(existing)") { - func_ = [](std::string &filename) { - auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistent) { - return "Path does not exist: " + filename; - } - return std::string(); - }; - } + ExistingPathValidator(); }; /// Check for an non-existing path class NonexistentPathValidator : public Validator { public: - NonexistentPathValidator() : Validator("PATH(non-existing)") { - func_ = [](std::string &filename) { - auto path_result = check_path(filename.c_str()); - if(path_result != path_type::nonexistent) { - return "Path already exists: " + filename; - } - return std::string(); - }; - } + NonexistentPathValidator(); }; /// Validate the given string is a legal ipv4 address class IPV4Validator : public Validator { public: - IPV4Validator() : Validator("IPV4") { - func_ = [](std::string &ip_addr) { - auto result = CLI::detail::split(ip_addr, '.'); - if(result.size() != 4) { - return std::string("Invalid IPV4 address must have four parts (") + ip_addr + ')'; - } - int num; - for(const auto &var : result) { - bool retval = detail::lexical_cast(var, num); - if(!retval) { - return std::string("Failed parsing number (") + var + ')'; - } - if(num < 0 || num > 255) { - return std::string("Each IP number must be between 0 and 255 ") + var; - } - } - return std::string(); - }; - } + IPV4Validator(); }; } // namespace detail @@ -444,21 +268,27 @@ const detail::IPV4Validator ValidIPV4; /// Validate the input as a particular type template <typename DesiredType> class TypeValidator : public Validator { public: - explicit TypeValidator(const std::string &validator_name) : Validator(validator_name) { - func_ = [](std::string &input_string) { - auto val = DesiredType(); - if(!detail::lexical_cast(input_string, val)) { - return std::string("Failed parsing ") + input_string + " as a " + detail::type_name<DesiredType>(); - } - return std::string(); - }; - } + explicit TypeValidator(const std::string &validator_name) + : Validator(validator_name, [](std::string &input_string) { + auto val = DesiredType(); + if(!detail::lexical_cast(input_string, val)) { + return std::string("Failed parsing ") + input_string + " as a " + detail::type_name<DesiredType>(); + } + return std::string(); + }) {} TypeValidator() : TypeValidator(detail::type_name<DesiredType>()) {} }; /// Check for a number const TypeValidator<double> Number("NUMBER"); +/// Modify a path if the file is a particular default location, can be used as Check or transform +/// with the error return optionally disabled +class FileOnDefaultPath : public Validator { + public: + explicit FileOnDefaultPath(std::string default_path, bool enableErrorReturn = true); +}; + /// Produce a range (factory). Min and max are inclusive. class Range : public Validator { public: @@ -477,10 +307,12 @@ class Range : public Validator { func_ = [min_val, max_val](std::string &input) { T val; bool converted = detail::lexical_cast(input, val); - if((!converted) || (val < min_val || val > max_val)) - return std::string("Value ") + input + " not in range " + std::to_string(min_val) + " to " + - std::to_string(max_val); - + if((!converted) || (val < min_val || val > max_val)) { + std::stringstream out; + out << "Value " << input << " not in range ["; + out << min_val << " - " << max_val << "]"; + return out.str(); + } return std::string{}; }; } @@ -494,7 +326,7 @@ class Range : public Validator { /// Check for a non negative number const Range NonNegativeNumber((std::numeric_limits<double>::max)(), "NONNEGATIVE"); -/// Check for a positive valued number (val>0.0), min() her is the smallest positive number +/// Check for a positive valued number (val>0.0), <double>::min here is the smallest positive number const Range PositiveNumber((std::numeric_limits<double>::min)(), (std::numeric_limits<double>::max)(), "POSITIVE"); /// Produce a bounded range (factory). Min and max are inclusive. @@ -631,9 +463,8 @@ template <typename T> inline typename std::enable_if<std::is_signed<T>::value, T>::type overflowCheck(const T &a, const T &b) { if((a > 0) == (b > 0)) { return ((std::numeric_limits<T>::max)() / (std::abs)(a) < (std::abs)(b)); - } else { - return ((std::numeric_limits<T>::min)() / (std::abs)(a) > -(std::abs)(b)); } + return ((std::numeric_limits<T>::min)() / (std::abs)(a) > -(std::abs)(b)); } /// Do a check for overflow on unsigned numbers template <typename T> @@ -1023,6 +854,10 @@ class AsNumberWithUnit : public Validator { } }; +inline AsNumberWithUnit::Options operator|(const AsNumberWithUnit::Options &a, const AsNumberWithUnit::Options &b) { + return static_cast<AsNumberWithUnit::Options>(static_cast<int>(a) | static_cast<int>(b)); +} + /// Converts a human-readable size string (with unit literal) to uin64_t size. /// Example: /// "100" => 100 @@ -1045,44 +880,14 @@ class AsSizeValue : public AsNumberWithUnit { /// The first option is formally correct, but /// the second interpretation is more wide-spread /// (see https://en.wikipedia.org/wiki/Binary_prefix). - explicit AsSizeValue(bool kb_is_1000) : AsNumberWithUnit(get_mapping(kb_is_1000)) { - if(kb_is_1000) { - description("SIZE [b, kb(=1000b), kib(=1024b), ...]"); - } else { - description("SIZE [b, kb(=1024b), ...]"); - } - } + explicit AsSizeValue(bool kb_is_1000); private: /// Get <size unit, factor> mapping - static std::map<std::string, result_t> init_mapping(bool kb_is_1000) { - std::map<std::string, result_t> m; - result_t k_factor = kb_is_1000 ? 1000 : 1024; - result_t ki_factor = 1024; - result_t k = 1; - result_t ki = 1; - m["b"] = 1; - for(std::string p : {"k", "m", "g", "t", "p", "e"}) { - k *= k_factor; - ki *= ki_factor; - m[p] = k; - m[p + "b"] = k; - m[p + "i"] = ki; - m[p + "ib"] = ki; - } - return m; - } + static std::map<std::string, result_t> init_mapping(bool kb_is_1000); /// Cache calculated mapping - static std::map<std::string, result_t> get_mapping(bool kb_is_1000) { - if(kb_is_1000) { - static auto m = init_mapping(true); - return m; - } else { - static auto m = init_mapping(false); - return m; - } - } + static std::map<std::string, result_t> get_mapping(bool kb_is_1000); }; namespace detail { @@ -1090,53 +895,14 @@ namespace detail { /// the string is assumed to contain a file name followed by other arguments /// the return value contains is a pair with the first argument containing the program name and the second /// everything else. -inline std::pair<std::string, std::string> split_program_name(std::string commandline) { - // try to determine the programName - std::pair<std::string, std::string> vals; - trim(commandline); - auto esp = commandline.find_first_of(' ', 1); - while(detail::check_path(commandline.substr(0, esp).c_str()) != path_type::file) { - esp = commandline.find_first_of(' ', esp + 1); - if(esp == std::string::npos) { - // if we have reached the end and haven't found a valid file just assume the first argument is the - // program name - if(commandline[0] == '"' || commandline[0] == '\'' || commandline[0] == '`') { - bool embeddedQuote = false; - auto keyChar = commandline[0]; - auto end = commandline.find_first_of(keyChar, 1); - while((end != std::string::npos) && (commandline[end - 1] == '\\')) { // deal with escaped quotes - end = commandline.find_first_of(keyChar, end + 1); - embeddedQuote = true; - } - if(end != std::string::npos) { - vals.first = commandline.substr(1, end - 1); - esp = end + 1; - if(embeddedQuote) { - vals.first = find_and_replace(vals.first, std::string("\\") + keyChar, std::string(1, keyChar)); - } - } else { - esp = commandline.find_first_of(' ', 1); - } - } else { - esp = commandline.find_first_of(' ', 1); - } - - break; - } - } - if(vals.first.empty()) { - vals.first = commandline.substr(0, esp); - rtrim(vals.first); - } - - // strip the program name - vals.second = (esp != std::string::npos) ? commandline.substr(esp + 1) : std::string{}; - ltrim(vals.second); - return vals; -} +CLI11_INLINE std::pair<std::string, std::string> split_program_name(std::string commandline); } // namespace detail /// @} // [CLI11:validators_hpp:end] } // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Validators_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/Version.hpp b/packages/CLI11/include/CLI/Version.hpp index 4bc79a7737a558b264fac0f460c4dfcd324b7075..b03141b82829ef47539bd048bccfee71a70a9ae3 100644 --- a/packages/CLI11/include/CLI/Version.hpp +++ b/packages/CLI11/include/CLI/Version.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,8 +9,8 @@ // [CLI11:version_hpp:verbatim] #define CLI11_VERSION_MAJOR 2 -#define CLI11_VERSION_MINOR 1 -#define CLI11_VERSION_PATCH 2 -#define CLI11_VERSION "2.1.2" +#define CLI11_VERSION_MINOR 2 +#define CLI11_VERSION_PATCH 0 +#define CLI11_VERSION "2.2.0" // [CLI11:version_hpp:end] diff --git a/packages/CLI11/include/CLI/impl/App_inl.hpp b/packages/CLI11/include/CLI/impl/App_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bbda621df0a5bf9f6f34c8a8e7a452e789ac6ad7 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/App_inl.hpp @@ -0,0 +1,2072 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/App.hpp> + +// [CLI11:public_includes:set] +#include <algorithm> +#include <memory> +#include <string> +#include <utility> +#include <vector> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:app_inl_hpp:verbatim] + +CLI11_INLINE App::App(std::string app_description, std::string app_name, App *parent) + : name_(std::move(app_name)), description_(std::move(app_description)), parent_(parent) { + // Inherit if not from a nullptr + if(parent_ != nullptr) { + if(parent_->help_ptr_ != nullptr) + set_help_flag(parent_->help_ptr_->get_name(false, true), parent_->help_ptr_->get_description()); + if(parent_->help_all_ptr_ != nullptr) + set_help_all_flag(parent_->help_all_ptr_->get_name(false, true), parent_->help_all_ptr_->get_description()); + + /// OptionDefaults + option_defaults_ = parent_->option_defaults_; + + // INHERITABLE + failure_message_ = parent_->failure_message_; + allow_extras_ = parent_->allow_extras_; + allow_config_extras_ = parent_->allow_config_extras_; + prefix_command_ = parent_->prefix_command_; + immediate_callback_ = parent_->immediate_callback_; + ignore_case_ = parent_->ignore_case_; + ignore_underscore_ = parent_->ignore_underscore_; + fallthrough_ = parent_->fallthrough_; + validate_positionals_ = parent_->validate_positionals_; + validate_optional_arguments_ = parent_->validate_optional_arguments_; + configurable_ = parent_->configurable_; + allow_windows_style_options_ = parent_->allow_windows_style_options_; + group_ = parent_->group_; + footer_ = parent_->footer_; + formatter_ = parent_->formatter_; + config_formatter_ = parent_->config_formatter_; + require_subcommand_max_ = parent_->require_subcommand_max_; + } +} + +CLI11_INLINE App *App::name(std::string app_name) { + + if(parent_ != nullptr) { + auto oname = name_; + name_ = app_name; + const auto &res = _compare_subcommand_names(*this, *_get_fallthrough_parent()); + if(!res.empty()) { + name_ = oname; + throw(OptionAlreadyAdded(app_name + " conflicts with existing subcommand names")); + } + } else { + name_ = app_name; + } + has_automatic_name_ = false; + return this; +} + +CLI11_INLINE App *App::alias(std::string app_name) { + if(app_name.empty() || !detail::valid_alias_name_string(app_name)) { + throw IncorrectConstruction("Aliases may not be empty or contain newlines or null characters"); + } + if(parent_ != nullptr) { + aliases_.push_back(app_name); + const auto &res = _compare_subcommand_names(*this, *_get_fallthrough_parent()); + if(!res.empty()) { + aliases_.pop_back(); + throw(OptionAlreadyAdded("alias already matches an existing subcommand: " + app_name)); + } + } else { + aliases_.push_back(app_name); + } + + return this; +} + +CLI11_INLINE App *App::immediate_callback(bool immediate) { + immediate_callback_ = immediate; + if(immediate_callback_) { + if(final_callback_ && !(parse_complete_callback_)) { + std::swap(final_callback_, parse_complete_callback_); + } + } else if(!(final_callback_) && parse_complete_callback_) { + std::swap(final_callback_, parse_complete_callback_); + } + return this; +} + +CLI11_INLINE App *App::ignore_case(bool value) { + if(value && !ignore_case_) { + ignore_case_ = true; + auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; + const auto &match = _compare_subcommand_names(*this, *p); + if(!match.empty()) { + ignore_case_ = false; // we are throwing so need to be exception invariant + throw OptionAlreadyAdded("ignore case would cause subcommand name conflicts: " + match); + } + } + ignore_case_ = value; + return this; +} + +CLI11_INLINE App *App::ignore_underscore(bool value) { + if(value && !ignore_underscore_) { + ignore_underscore_ = true; + auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; + const auto &match = _compare_subcommand_names(*this, *p); + if(!match.empty()) { + ignore_underscore_ = false; + throw OptionAlreadyAdded("ignore underscore would cause subcommand name conflicts: " + match); + } + } + ignore_underscore_ = value; + return this; +} + +CLI11_INLINE Option *App::add_option(std::string option_name, + callback_t option_callback, + std::string option_description, + bool defaulted, + std::function<std::string()> func) { + Option myopt{option_name, option_description, option_callback, this}; + + if(std::find_if(std::begin(options_), std::end(options_), [&myopt](const Option_p &v) { return *v == myopt; }) == + std::end(options_)) { + options_.emplace_back(); + Option_p &option = options_.back(); + option.reset(new Option(option_name, option_description, option_callback, this)); + + // Set the default string capture function + option->default_function(func); + + // For compatibility with CLI11 1.7 and before, capture the default string here + if(defaulted) + option->capture_default_str(); + + // Transfer defaults to the new option + option_defaults_.copy_to(option.get()); + + // Don't bother to capture if we already did + if(!defaulted && option->get_always_capture_default()) + option->capture_default_str(); + + return option.get(); + } + // we know something matches now find what it is so we can produce more error information + for(auto &opt : options_) { + const auto &matchname = opt->matching_name(myopt); + if(!matchname.empty()) { + throw(OptionAlreadyAdded("added option matched existing option name: " + matchname)); + } + } + // this line should not be reached the above loop should trigger the throw + throw(OptionAlreadyAdded("added option matched existing option name")); // LCOV_EXCL_LINE +} + +CLI11_INLINE Option *App::set_help_flag(std::string flag_name, const std::string &help_description) { + // take flag_description by const reference otherwise add_flag tries to assign to help_description + if(help_ptr_ != nullptr) { + remove_option(help_ptr_); + help_ptr_ = nullptr; + } + + // Empty name will simply remove the help flag + if(!flag_name.empty()) { + help_ptr_ = add_flag(flag_name, help_description); + help_ptr_->configurable(false); + } + + return help_ptr_; +} + +CLI11_INLINE Option *App::set_help_all_flag(std::string help_name, const std::string &help_description) { + // take flag_description by const reference otherwise add_flag tries to assign to flag_description + if(help_all_ptr_ != nullptr) { + remove_option(help_all_ptr_); + help_all_ptr_ = nullptr; + } + + // Empty name will simply remove the help all flag + if(!help_name.empty()) { + help_all_ptr_ = add_flag(help_name, help_description); + help_all_ptr_->configurable(false); + } + + return help_all_ptr_; +} + +CLI11_INLINE Option * +App::set_version_flag(std::string flag_name, const std::string &versionString, const std::string &version_help) { + // take flag_description by const reference otherwise add_flag tries to assign to version_description + if(version_ptr_ != nullptr) { + remove_option(version_ptr_); + version_ptr_ = nullptr; + } + + // Empty name will simply remove the version flag + if(!flag_name.empty()) { + version_ptr_ = add_flag_callback( + flag_name, [versionString]() { throw(CLI::CallForVersion(versionString, 0)); }, version_help); + version_ptr_->configurable(false); + } + + return version_ptr_; +} + +CLI11_INLINE Option * +App::set_version_flag(std::string flag_name, std::function<std::string()> vfunc, const std::string &version_help) { + if(version_ptr_ != nullptr) { + remove_option(version_ptr_); + version_ptr_ = nullptr; + } + + // Empty name will simply remove the version flag + if(!flag_name.empty()) { + version_ptr_ = add_flag_callback( + flag_name, [vfunc]() { throw(CLI::CallForVersion(vfunc(), 0)); }, version_help); + version_ptr_->configurable(false); + } + + return version_ptr_; +} + +CLI11_INLINE Option *App::_add_flag_internal(std::string flag_name, CLI::callback_t fun, std::string flag_description) { + Option *opt = nullptr; + if(detail::has_default_flag_values(flag_name)) { + // check for default values and if it has them + auto flag_defaults = detail::get_default_flag_values(flag_name); + detail::remove_default_flag_values(flag_name); + opt = add_option(std::move(flag_name), std::move(fun), std::move(flag_description), false); + for(const auto &fname : flag_defaults) + opt->fnames_.push_back(fname.first); + opt->default_flag_values_ = std::move(flag_defaults); + } else { + opt = add_option(std::move(flag_name), std::move(fun), std::move(flag_description), false); + } + // flags cannot have positional values + if(opt->get_positional()) { + auto pos_name = opt->get_name(true); + remove_option(opt); + throw IncorrectConstruction::PositionalFlag(pos_name); + } + opt->multi_option_policy(MultiOptionPolicy::TakeLast); + opt->expected(0); + opt->required(false); + return opt; +} + +CLI11_INLINE Option *App::add_flag_callback(std::string flag_name, + std::function<void(void)> function, ///< A function to call, void(void) + std::string flag_description) { + + CLI::callback_t fun = [function](const CLI::results_t &res) { + bool trigger{false}; + auto result = CLI::detail::lexical_cast(res[0], trigger); + if(result && trigger) { + function(); + } + return result; + }; + return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)); +} + +CLI11_INLINE Option * +App::add_flag_function(std::string flag_name, + std::function<void(std::int64_t)> function, ///< A function to call, void(int) + std::string flag_description) { + + CLI::callback_t fun = [function](const CLI::results_t &res) { + std::int64_t flag_count{0}; + CLI::detail::lexical_cast(res[0], flag_count); + function(flag_count); + return true; + }; + return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)) + ->multi_option_policy(MultiOptionPolicy::Sum); +} + +CLI11_INLINE Option *App::set_config(std::string option_name, + std::string default_filename, + const std::string &help_message, + bool config_required) { + + // Remove existing config if present + if(config_ptr_ != nullptr) { + remove_option(config_ptr_); + config_ptr_ = nullptr; // need to remove the config_ptr completely + } + + // Only add config if option passed + if(!option_name.empty()) { + config_ptr_ = add_option(option_name, help_message); + if(config_required) { + config_ptr_->required(); + } + if(!default_filename.empty()) { + config_ptr_->default_str(std::move(default_filename)); + } + config_ptr_->configurable(false); + } + + return config_ptr_; +} + +CLI11_INLINE bool App::remove_option(Option *opt) { + // Make sure no links exist + for(Option_p &op : options_) { + op->remove_needs(opt); + op->remove_excludes(opt); + } + + if(help_ptr_ == opt) + help_ptr_ = nullptr; + if(help_all_ptr_ == opt) + help_all_ptr_ = nullptr; + + auto iterator = + std::find_if(std::begin(options_), std::end(options_), [opt](const Option_p &v) { return v.get() == opt; }); + if(iterator != std::end(options_)) { + options_.erase(iterator); + return true; + } + return false; +} + +CLI11_INLINE App *App::add_subcommand(std::string subcommand_name, std::string subcommand_description) { + if(!subcommand_name.empty() && !detail::valid_name_string(subcommand_name)) { + if(!detail::valid_first_char(subcommand_name[0])) { + throw IncorrectConstruction("Subcommand name starts with invalid character, '!' and '-' are not allowed"); + } + for(auto c : subcommand_name) { + if(!detail::valid_later_char(c)) { + throw IncorrectConstruction(std::string("Subcommand name contains invalid character ('") + c + + "'), all characters are allowed except" + "'=',':','{','}', and ' '"); + } + } + } + CLI::App_p subcom = std::shared_ptr<App>(new App(std::move(subcommand_description), subcommand_name, this)); + return add_subcommand(std::move(subcom)); +} + +CLI11_INLINE App *App::add_subcommand(CLI::App_p subcom) { + if(!subcom) + throw IncorrectConstruction("passed App is not valid"); + auto *ckapp = (name_.empty() && parent_ != nullptr) ? _get_fallthrough_parent() : this; + const auto &mstrg = _compare_subcommand_names(*subcom, *ckapp); + if(!mstrg.empty()) { + throw(OptionAlreadyAdded("subcommand name or alias matches existing subcommand: " + mstrg)); + } + subcom->parent_ = this; + subcommands_.push_back(std::move(subcom)); + return subcommands_.back().get(); +} + +CLI11_INLINE bool App::remove_subcommand(App *subcom) { + // Make sure no links exist + for(App_p &sub : subcommands_) { + sub->remove_excludes(subcom); + sub->remove_needs(subcom); + } + + auto iterator = std::find_if( + std::begin(subcommands_), std::end(subcommands_), [subcom](const App_p &v) { return v.get() == subcom; }); + if(iterator != std::end(subcommands_)) { + subcommands_.erase(iterator); + return true; + } + return false; +} + +CLI11_INLINE App *App::get_subcommand(const App *subcom) const { + if(subcom == nullptr) + throw OptionNotFound("nullptr passed"); + for(const App_p &subcomptr : subcommands_) + if(subcomptr.get() == subcom) + return subcomptr.get(); + throw OptionNotFound(subcom->get_name()); +} + +CLI11_NODISCARD CLI11_INLINE App *App::get_subcommand(std::string subcom) const { + auto *subc = _find_subcommand(subcom, false, false); + if(subc == nullptr) + throw OptionNotFound(subcom); + return subc; +} + +CLI11_NODISCARD CLI11_INLINE App *App::get_subcommand(int index) const { + if(index >= 0) { + auto uindex = static_cast<unsigned>(index); + if(uindex < subcommands_.size()) + return subcommands_[uindex].get(); + } + throw OptionNotFound(std::to_string(index)); +} + +CLI11_INLINE CLI::App_p App::get_subcommand_ptr(App *subcom) const { + if(subcom == nullptr) + throw OptionNotFound("nullptr passed"); + for(const App_p &subcomptr : subcommands_) + if(subcomptr.get() == subcom) + return subcomptr; + throw OptionNotFound(subcom->get_name()); +} + +CLI11_NODISCARD CLI11_INLINE CLI::App_p App::get_subcommand_ptr(std::string subcom) const { + for(const App_p &subcomptr : subcommands_) + if(subcomptr->check_name(subcom)) + return subcomptr; + throw OptionNotFound(subcom); +} + +CLI11_NODISCARD CLI11_INLINE CLI::App_p App::get_subcommand_ptr(int index) const { + if(index >= 0) { + auto uindex = static_cast<unsigned>(index); + if(uindex < subcommands_.size()) + return subcommands_[uindex]; + } + throw OptionNotFound(std::to_string(index)); +} + +CLI11_NODISCARD CLI11_INLINE std::size_t App::count_all() const { + std::size_t cnt{0}; + for(const auto &opt : options_) { + cnt += opt->count(); + } + for(const auto &sub : subcommands_) { + cnt += sub->count_all(); + } + if(!get_name().empty()) { // for named subcommands add the number of times the subcommand was called + cnt += parsed_; + } + return cnt; +} + +CLI11_INLINE void App::clear() { + + parsed_ = 0; + pre_parse_called_ = false; + + missing_.clear(); + parsed_subcommands_.clear(); + for(const Option_p &opt : options_) { + opt->clear(); + } + for(const App_p &subc : subcommands_) { + subc->clear(); + } +} + +CLI11_INLINE void App::parse(int argc, const char *const *argv) { + // If the name is not set, read from command line + if(name_.empty() || has_automatic_name_) { + has_automatic_name_ = true; + name_ = argv[0]; + } + + std::vector<std::string> args; + args.reserve(static_cast<std::size_t>(argc) - 1U); + for(auto i = static_cast<std::size_t>(argc) - 1U; i > 0U; --i) + args.emplace_back(argv[i]); + parse(std::move(args)); +} + +CLI11_INLINE void App::parse(std::string commandline, bool program_name_included) { + + if(program_name_included) { + auto nstr = detail::split_program_name(commandline); + if((name_.empty()) || (has_automatic_name_)) { + has_automatic_name_ = true; + name_ = nstr.first; + } + commandline = std::move(nstr.second); + } else { + detail::trim(commandline); + } + // the next section of code is to deal with quoted arguments after an '=' or ':' for windows like operations + if(!commandline.empty()) { + commandline = detail::find_and_modify(commandline, "=", detail::escape_detect); + if(allow_windows_style_options_) + commandline = detail::find_and_modify(commandline, ":", detail::escape_detect); + } + + auto args = detail::split_up(std::move(commandline)); + // remove all empty strings + args.erase(std::remove(args.begin(), args.end(), std::string{}), args.end()); + std::reverse(args.begin(), args.end()); + + parse(std::move(args)); +} + +CLI11_INLINE void App::parse(std::vector<std::string> &args) { + // Clear if parsed + if(parsed_ > 0) + clear(); + + // parsed_ is incremented in commands/subcommands, + // but placed here to make sure this is cleared when + // running parse after an error is thrown, even by _validate or _configure. + parsed_ = 1; + _validate(); + _configure(); + // set the parent as nullptr as this object should be the top now + parent_ = nullptr; + parsed_ = 0; + + _parse(args); + run_callback(); +} + +CLI11_INLINE void App::parse(std::vector<std::string> &&args) { + // Clear if parsed + if(parsed_ > 0) + clear(); + + // parsed_ is incremented in commands/subcommands, + // but placed here to make sure this is cleared when + // running parse after an error is thrown, even by _validate or _configure. + parsed_ = 1; + _validate(); + _configure(); + // set the parent as nullptr as this object should be the top now + parent_ = nullptr; + parsed_ = 0; + + _parse(std::move(args)); + run_callback(); +} + +CLI11_INLINE void App::parse_from_stream(std::istream &input) { + if(parsed_ == 0) { + _validate(); + _configure(); + // set the parent as nullptr as this object should be the top now + } + + _parse_stream(input); + run_callback(); +} + +CLI11_INLINE int App::exit(const Error &e, std::ostream &out, std::ostream &err) const { + + /// Avoid printing anything if this is a CLI::RuntimeError + if(e.get_name() == "RuntimeError") + return e.get_exit_code(); + + if(e.get_name() == "CallForHelp") { + out << help(); + return e.get_exit_code(); + } + + if(e.get_name() == "CallForAllHelp") { + out << help("", AppFormatMode::All); + return e.get_exit_code(); + } + + if(e.get_name() == "CallForVersion") { + out << e.what() << std::endl; + return e.get_exit_code(); + } + + if(e.get_exit_code() != static_cast<int>(ExitCodes::Success)) { + if(failure_message_) + err << failure_message_(this, e) << std::flush; + } + + return e.get_exit_code(); +} + +CLI11_INLINE std::vector<const App *> App::get_subcommands(const std::function<bool(const App *)> &filter) const { + std::vector<const App *> subcomms(subcommands_.size()); + std::transform( + std::begin(subcommands_), std::end(subcommands_), std::begin(subcomms), [](const App_p &v) { return v.get(); }); + + if(filter) { + subcomms.erase(std::remove_if(std::begin(subcomms), + std::end(subcomms), + [&filter](const App *app) { return !filter(app); }), + std::end(subcomms)); + } + + return subcomms; +} + +CLI11_INLINE std::vector<App *> App::get_subcommands(const std::function<bool(App *)> &filter) { + std::vector<App *> subcomms(subcommands_.size()); + std::transform( + std::begin(subcommands_), std::end(subcommands_), std::begin(subcomms), [](const App_p &v) { return v.get(); }); + + if(filter) { + subcomms.erase( + std::remove_if(std::begin(subcomms), std::end(subcomms), [&filter](App *app) { return !filter(app); }), + std::end(subcomms)); + } + + return subcomms; +} + +CLI11_INLINE bool App::remove_excludes(Option *opt) { + auto iterator = std::find(std::begin(exclude_options_), std::end(exclude_options_), opt); + if(iterator == std::end(exclude_options_)) { + return false; + } + exclude_options_.erase(iterator); + return true; +} + +CLI11_INLINE bool App::remove_excludes(App *app) { + auto iterator = std::find(std::begin(exclude_subcommands_), std::end(exclude_subcommands_), app); + if(iterator == std::end(exclude_subcommands_)) { + return false; + } + auto *other_app = *iterator; + exclude_subcommands_.erase(iterator); + other_app->remove_excludes(this); + return true; +} + +CLI11_INLINE bool App::remove_needs(Option *opt) { + auto iterator = std::find(std::begin(need_options_), std::end(need_options_), opt); + if(iterator == std::end(need_options_)) { + return false; + } + need_options_.erase(iterator); + return true; +} + +CLI11_INLINE bool App::remove_needs(App *app) { + auto iterator = std::find(std::begin(need_subcommands_), std::end(need_subcommands_), app); + if(iterator == std::end(need_subcommands_)) { + return false; + } + need_subcommands_.erase(iterator); + return true; +} + +CLI11_NODISCARD CLI11_INLINE std::string App::help(std::string prev, AppFormatMode mode) const { + if(prev.empty()) + prev = get_name(); + else + prev += " " + get_name(); + + // Delegate to subcommand if needed + auto selected_subcommands = get_subcommands(); + if(!selected_subcommands.empty()) { + return selected_subcommands.at(0)->help(prev, mode); + } + return formatter_->make_help(this, prev, mode); +} + +CLI11_NODISCARD CLI11_INLINE std::string App::version() const { + std::string val; + if(version_ptr_ != nullptr) { + auto rv = version_ptr_->results(); + version_ptr_->clear(); + version_ptr_->add_result("true"); + try { + version_ptr_->run_callback(); + } catch(const CLI::CallForVersion &cfv) { + val = cfv.what(); + } + version_ptr_->clear(); + version_ptr_->add_result(rv); + } + return val; +} + +CLI11_INLINE std::vector<const Option *> App::get_options(const std::function<bool(const Option *)> filter) const { + std::vector<const Option *> options(options_.size()); + std::transform( + std::begin(options_), std::end(options_), std::begin(options), [](const Option_p &val) { return val.get(); }); + + if(filter) { + options.erase(std::remove_if(std::begin(options), + std::end(options), + [&filter](const Option *opt) { return !filter(opt); }), + std::end(options)); + } + + return options; +} + +CLI11_INLINE std::vector<Option *> App::get_options(const std::function<bool(Option *)> filter) { + std::vector<Option *> options(options_.size()); + std::transform( + std::begin(options_), std::end(options_), std::begin(options), [](const Option_p &val) { return val.get(); }); + + if(filter) { + options.erase( + std::remove_if(std::begin(options), std::end(options), [&filter](Option *opt) { return !filter(opt); }), + std::end(options)); + } + + return options; +} + +CLI11_INLINE Option *App::get_option_no_throw(std::string option_name) noexcept { + for(Option_p &opt : options_) { + if(opt->check_name(option_name)) { + return opt.get(); + } + } + for(auto &subc : subcommands_) { + // also check down into nameless subcommands + if(subc->get_name().empty()) { + auto *opt = subc->get_option_no_throw(option_name); + if(opt != nullptr) { + return opt; + } + } + } + return nullptr; +} + +CLI11_NODISCARD CLI11_INLINE const Option *App::get_option_no_throw(std::string option_name) const noexcept { + for(const Option_p &opt : options_) { + if(opt->check_name(option_name)) { + return opt.get(); + } + } + for(const auto &subc : subcommands_) { + // also check down into nameless subcommands + if(subc->get_name().empty()) { + auto *opt = subc->get_option_no_throw(option_name); + if(opt != nullptr) { + return opt; + } + } + } + return nullptr; +} + +CLI11_NODISCARD CLI11_INLINE std::string App::get_display_name(bool with_aliases) const { + if(name_.empty()) { + return std::string("[Option Group: ") + get_group() + "]"; + } + if(aliases_.empty() || !with_aliases) { + return name_; + } + std::string dispname = name_; + for(const auto &lalias : aliases_) { + dispname.push_back(','); + dispname.push_back(' '); + dispname.append(lalias); + } + return dispname; +} + +CLI11_NODISCARD CLI11_INLINE bool App::check_name(std::string name_to_check) const { + std::string local_name = name_; + if(ignore_underscore_) { + local_name = detail::remove_underscore(name_); + name_to_check = detail::remove_underscore(name_to_check); + } + if(ignore_case_) { + local_name = detail::to_lower(name_); + name_to_check = detail::to_lower(name_to_check); + } + + if(local_name == name_to_check) { + return true; + } + for(auto les : aliases_) { // NOLINT(performance-for-range-copy) + if(ignore_underscore_) { + les = detail::remove_underscore(les); + } + if(ignore_case_) { + les = detail::to_lower(les); + } + if(les == name_to_check) { + return true; + } + } + return false; +} + +CLI11_NODISCARD CLI11_INLINE std::vector<std::string> App::get_groups() const { + std::vector<std::string> groups; + + for(const Option_p &opt : options_) { + // Add group if it is not already in there + if(std::find(groups.begin(), groups.end(), opt->get_group()) == groups.end()) { + groups.push_back(opt->get_group()); + } + } + + return groups; +} + +CLI11_NODISCARD CLI11_INLINE std::vector<std::string> App::remaining(bool recurse) const { + std::vector<std::string> miss_list; + for(const std::pair<detail::Classifier, std::string> &miss : missing_) { + miss_list.push_back(std::get<1>(miss)); + } + // Get from a subcommand that may allow extras + if(recurse) { + if(!allow_extras_) { + for(const auto &sub : subcommands_) { + if(sub->name_.empty() && !sub->missing_.empty()) { + for(const std::pair<detail::Classifier, std::string> &miss : sub->missing_) { + miss_list.push_back(std::get<1>(miss)); + } + } + } + } + // Recurse into subcommands + + for(const App *sub : parsed_subcommands_) { + std::vector<std::string> output = sub->remaining(recurse); + std::copy(std::begin(output), std::end(output), std::back_inserter(miss_list)); + } + } + return miss_list; +} + +CLI11_NODISCARD CLI11_INLINE std::vector<std::string> App::remaining_for_passthrough(bool recurse) const { + std::vector<std::string> miss_list = remaining(recurse); + std::reverse(std::begin(miss_list), std::end(miss_list)); + return miss_list; +} + +CLI11_NODISCARD CLI11_INLINE std::size_t App::remaining_size(bool recurse) const { + auto remaining_options = static_cast<std::size_t>(std::count_if( + std::begin(missing_), std::end(missing_), [](const std::pair<detail::Classifier, std::string> &val) { + return val.first != detail::Classifier::POSITIONAL_MARK; + })); + + if(recurse) { + for(const App_p &sub : subcommands_) { + remaining_options += sub->remaining_size(recurse); + } + } + return remaining_options; +} + +CLI11_INLINE void App::_validate() const { + // count the number of positional only args + auto pcount = std::count_if(std::begin(options_), std::end(options_), [](const Option_p &opt) { + return opt->get_items_expected_max() >= detail::expected_max_vector_size && !opt->nonpositional(); + }); + if(pcount > 1) { + auto pcount_req = std::count_if(std::begin(options_), std::end(options_), [](const Option_p &opt) { + return opt->get_items_expected_max() >= detail::expected_max_vector_size && !opt->nonpositional() && + opt->get_required(); + }); + if(pcount - pcount_req > 1) { + throw InvalidError(name_); + } + } + + std::size_t nameless_subs{0}; + for(const App_p &app : subcommands_) { + app->_validate(); + if(app->get_name().empty()) + ++nameless_subs; + } + + if(require_option_min_ > 0) { + if(require_option_max_ > 0) { + if(require_option_max_ < require_option_min_) { + throw(InvalidError("Required min options greater than required max options", ExitCodes::InvalidError)); + } + } + if(require_option_min_ > (options_.size() + nameless_subs)) { + throw( + InvalidError("Required min options greater than number of available options", ExitCodes::InvalidError)); + } + } +} + +CLI11_INLINE void App::_configure() { + if(default_startup == startup_mode::enabled) { + disabled_ = false; + } else if(default_startup == startup_mode::disabled) { + disabled_ = true; + } + for(const App_p &app : subcommands_) { + if(app->has_automatic_name_) { + app->name_.clear(); + } + if(app->name_.empty()) { + app->fallthrough_ = false; // make sure fallthrough_ is false to prevent infinite loop + app->prefix_command_ = false; + } + // make sure the parent is set to be this object in preparation for parse + app->parent_ = this; + app->_configure(); + } +} + +CLI11_INLINE void App::run_callback(bool final_mode, bool suppress_final_callback) { + pre_callback(); + // in the main app if immediate_callback_ is set it runs the main callback before the used subcommands + if(!final_mode && parse_complete_callback_) { + parse_complete_callback_(); + } + // run the callbacks for the received subcommands + for(App *subc : get_subcommands()) { + if(subc->parent_ == this) { + subc->run_callback(true, suppress_final_callback); + } + } + // now run callbacks for option_groups + for(auto &subc : subcommands_) { + if(subc->name_.empty() && subc->count_all() > 0) { + subc->run_callback(true, suppress_final_callback); + } + } + + // finally run the main callback + if(final_callback_ && (parsed_ > 0) && (!suppress_final_callback)) { + if(!name_.empty() || count_all() > 0 || parent_ == nullptr) { + final_callback_(); + } + } +} + +CLI11_NODISCARD CLI11_INLINE bool App::_valid_subcommand(const std::string ¤t, bool ignore_used) const { + // Don't match if max has been reached - but still check parents + if(require_subcommand_max_ != 0 && parsed_subcommands_.size() >= require_subcommand_max_) { + return parent_ != nullptr && parent_->_valid_subcommand(current, ignore_used); + } + auto *com = _find_subcommand(current, true, ignore_used); + if(com != nullptr) { + return true; + } + // Check parent if exists, else return false + return parent_ != nullptr && parent_->_valid_subcommand(current, ignore_used); +} + +CLI11_NODISCARD CLI11_INLINE detail::Classifier App::_recognize(const std::string ¤t, + bool ignore_used_subcommands) const { + std::string dummy1, dummy2; + + if(current == "--") + return detail::Classifier::POSITIONAL_MARK; + if(_valid_subcommand(current, ignore_used_subcommands)) + return detail::Classifier::SUBCOMMAND; + if(detail::split_long(current, dummy1, dummy2)) + return detail::Classifier::LONG; + if(detail::split_short(current, dummy1, dummy2)) { + if(dummy1[0] >= '0' && dummy1[0] <= '9') { + if(get_option_no_throw(std::string{'-', dummy1[0]}) == nullptr) { + return detail::Classifier::NONE; + } + } + return detail::Classifier::SHORT; + } + if((allow_windows_style_options_) && (detail::split_windows_style(current, dummy1, dummy2))) + return detail::Classifier::WINDOWS_STYLE; + if((current == "++") && !name_.empty() && parent_ != nullptr) + return detail::Classifier::SUBCOMMAND_TERMINATOR; + return detail::Classifier::NONE; +} + +CLI11_INLINE void App::_process_config_file() { + if(config_ptr_ != nullptr) { + bool config_required = config_ptr_->get_required(); + auto file_given = config_ptr_->count() > 0; + auto config_files = config_ptr_->as<std::vector<std::string>>(); + if(config_files.empty() || config_files.front().empty()) { + if(config_required) { + throw FileError::Missing("no specified config file"); + } + return; + } + for(auto rit = config_files.rbegin(); rit != config_files.rend(); ++rit) { + const auto &config_file = *rit; + auto path_result = detail::check_path(config_file.c_str()); + if(path_result == detail::path_type::file) { + try { + std::vector<ConfigItem> values = config_formatter_->from_file(config_file); + _parse_config(values); + if(!file_given) { + config_ptr_->add_result(config_file); + } + } catch(const FileError &) { + if(config_required || file_given) + throw; + } + } else if(config_required || file_given) { + throw FileError::Missing(config_file); + } + } + } +} + +CLI11_INLINE void App::_process_env() { + for(const Option_p &opt : options_) { + if(opt->count() == 0 && !opt->envname_.empty()) { + char *buffer = nullptr; + std::string ename_string; + +#ifdef _MSC_VER + // Windows version + std::size_t sz = 0; + if(_dupenv_s(&buffer, &sz, opt->envname_.c_str()) == 0 && buffer != nullptr) { + ename_string = std::string(buffer); + free(buffer); + } +#else + // This also works on Windows, but gives a warning + buffer = std::getenv(opt->envname_.c_str()); + if(buffer != nullptr) + ename_string = std::string(buffer); +#endif + + if(!ename_string.empty()) { + opt->add_result(ename_string); + } + } + } + + for(App_p &sub : subcommands_) { + if(sub->get_name().empty() || !sub->parse_complete_callback_) + sub->_process_env(); + } +} + +CLI11_INLINE void App::_process_callbacks() { + + for(App_p &sub : subcommands_) { + // process the priority option_groups first + if(sub->get_name().empty() && sub->parse_complete_callback_) { + if(sub->count_all() > 0) { + sub->_process_callbacks(); + sub->run_callback(); + } + } + } + + for(const Option_p &opt : options_) { + if((*opt) && !opt->get_callback_run()) { + opt->run_callback(); + } + } + for(App_p &sub : subcommands_) { + if(!sub->parse_complete_callback_) { + sub->_process_callbacks(); + } + } +} + +CLI11_INLINE void App::_process_help_flags(bool trigger_help, bool trigger_all_help) const { + const Option *help_ptr = get_help_ptr(); + const Option *help_all_ptr = get_help_all_ptr(); + + if(help_ptr != nullptr && help_ptr->count() > 0) + trigger_help = true; + if(help_all_ptr != nullptr && help_all_ptr->count() > 0) + trigger_all_help = true; + + // If there were parsed subcommands, call those. First subcommand wins if there are multiple ones. + if(!parsed_subcommands_.empty()) { + for(const App *sub : parsed_subcommands_) + sub->_process_help_flags(trigger_help, trigger_all_help); + + // Only the final subcommand should call for help. All help wins over help. + } else if(trigger_all_help) { + throw CallForAllHelp(); + } else if(trigger_help) { + throw CallForHelp(); + } +} + +CLI11_INLINE void App::_process_requirements() { + // check excludes + bool excluded{false}; + std::string excluder; + for(const auto &opt : exclude_options_) { + if(opt->count() > 0) { + excluded = true; + excluder = opt->get_name(); + } + } + for(const auto &subc : exclude_subcommands_) { + if(subc->count_all() > 0) { + excluded = true; + excluder = subc->get_display_name(); + } + } + if(excluded) { + if(count_all() > 0) { + throw ExcludesError(get_display_name(), excluder); + } + // if we are excluded but didn't receive anything, just return + return; + } + + // check excludes + bool missing_needed{false}; + std::string missing_need; + for(const auto &opt : need_options_) { + if(opt->count() == 0) { + missing_needed = true; + missing_need = opt->get_name(); + } + } + for(const auto &subc : need_subcommands_) { + if(subc->count_all() == 0) { + missing_needed = true; + missing_need = subc->get_display_name(); + } + } + if(missing_needed) { + if(count_all() > 0) { + throw RequiresError(get_display_name(), missing_need); + } + // if we missing something but didn't have any options, just return + return; + } + + std::size_t used_options = 0; + for(const Option_p &opt : options_) { + + if(opt->count() != 0) { + ++used_options; + } + // Required but empty + if(opt->get_required() && opt->count() == 0) { + throw RequiredError(opt->get_name()); + } + // Requires + for(const Option *opt_req : opt->needs_) + if(opt->count() > 0 && opt_req->count() == 0) + throw RequiresError(opt->get_name(), opt_req->get_name()); + // Excludes + for(const Option *opt_ex : opt->excludes_) + if(opt->count() > 0 && opt_ex->count() != 0) + throw ExcludesError(opt->get_name(), opt_ex->get_name()); + } + // check for the required number of subcommands + if(require_subcommand_min_ > 0) { + auto selected_subcommands = get_subcommands(); + if(require_subcommand_min_ > selected_subcommands.size()) + throw RequiredError::Subcommand(require_subcommand_min_); + } + + // Max error cannot occur, the extra subcommand will parse as an ExtrasError or a remaining item. + + // run this loop to check how many unnamed subcommands were actually used since they are considered options + // from the perspective of an App + for(App_p &sub : subcommands_) { + if(sub->disabled_) + continue; + if(sub->name_.empty() && sub->count_all() > 0) { + ++used_options; + } + } + + if(require_option_min_ > used_options || (require_option_max_ > 0 && require_option_max_ < used_options)) { + auto option_list = detail::join(options_, [this](const Option_p &ptr) { + if(ptr.get() == help_ptr_ || ptr.get() == help_all_ptr_) { + return std::string{}; + } + return ptr->get_name(false, true); + }); + + auto subc_list = get_subcommands([](App *app) { return ((app->get_name().empty()) && (!app->disabled_)); }); + if(!subc_list.empty()) { + option_list += "," + detail::join(subc_list, [](const App *app) { return app->get_display_name(); }); + } + throw RequiredError::Option(require_option_min_, require_option_max_, used_options, option_list); + } + + // now process the requirements for subcommands if needed + for(App_p &sub : subcommands_) { + if(sub->disabled_) + continue; + if(sub->name_.empty() && sub->required_ == false) { + if(sub->count_all() == 0) { + if(require_option_min_ > 0 && require_option_min_ <= used_options) { + continue; + // if we have met the requirement and there is nothing in this option group skip checking + // requirements + } + if(require_option_max_ > 0 && used_options >= require_option_min_) { + continue; + // if we have met the requirement and there is nothing in this option group skip checking + // requirements + } + } + } + if(sub->count() > 0 || sub->name_.empty()) { + sub->_process_requirements(); + } + + if(sub->required_ && sub->count_all() == 0) { + throw(CLI::RequiredError(sub->get_display_name())); + } + } +} + +CLI11_INLINE void App::_process() { + try { + // the config file might generate a FileError but that should not be processed until later in the process + // to allow for help, version and other errors to generate first. + _process_config_file(); + + // process env shouldn't throw but no reason to process it if config generated an error + _process_env(); + } catch(const CLI::FileError &) { + // callbacks and help_flags can generate exceptions which should take priority + // over the config file error if one exists. + _process_callbacks(); + _process_help_flags(); + throw; + } + + _process_callbacks(); + _process_help_flags(); + + _process_requirements(); +} + +CLI11_INLINE void App::_process_extras() { + if(!(allow_extras_ || prefix_command_)) { + std::size_t num_left_over = remaining_size(); + if(num_left_over > 0) { + throw ExtrasError(name_, remaining(false)); + } + } + + for(App_p &sub : subcommands_) { + if(sub->count() > 0) + sub->_process_extras(); + } +} + +CLI11_INLINE void App::_process_extras(std::vector<std::string> &args) { + if(!(allow_extras_ || prefix_command_)) { + std::size_t num_left_over = remaining_size(); + if(num_left_over > 0) { + args = remaining(false); + throw ExtrasError(name_, args); + } + } + + for(App_p &sub : subcommands_) { + if(sub->count() > 0) + sub->_process_extras(args); + } +} + +CLI11_INLINE void App::increment_parsed() { + ++parsed_; + for(App_p &sub : subcommands_) { + if(sub->get_name().empty()) + sub->increment_parsed(); + } +} + +CLI11_INLINE void App::_parse(std::vector<std::string> &args) { + increment_parsed(); + _trigger_pre_parse(args.size()); + bool positional_only = false; + + while(!args.empty()) { + if(!_parse_single(args, positional_only)) { + break; + } + } + + if(parent_ == nullptr) { + _process(); + + // Throw error if any items are left over (depending on settings) + _process_extras(args); + + // Convert missing (pairs) to extras (string only) ready for processing in another app + args = remaining_for_passthrough(false); + } else if(parse_complete_callback_) { + _process_env(); + _process_callbacks(); + _process_help_flags(); + _process_requirements(); + run_callback(false, true); + } +} + +CLI11_INLINE void App::_parse(std::vector<std::string> &&args) { + // this can only be called by the top level in which case parent == nullptr by definition + // operation is simplified + increment_parsed(); + _trigger_pre_parse(args.size()); + bool positional_only = false; + + while(!args.empty()) { + _parse_single(args, positional_only); + } + _process(); + + // Throw error if any items are left over (depending on settings) + _process_extras(); +} + +CLI11_INLINE void App::_parse_stream(std::istream &input) { + auto values = config_formatter_->from_config(input); + _parse_config(values); + increment_parsed(); + _trigger_pre_parse(values.size()); + _process(); + + // Throw error if any items are left over (depending on settings) + _process_extras(); +} + +CLI11_INLINE void App::_parse_config(const std::vector<ConfigItem> &args) { + for(const ConfigItem &item : args) { + if(!_parse_single_config(item) && allow_config_extras_ == config_extras_mode::error) + throw ConfigError::Extras(item.fullname()); + } +} + +CLI11_INLINE bool App::_parse_single_config(const ConfigItem &item, std::size_t level) { + if(level < item.parents.size()) { + try { + auto *subcom = get_subcommand(item.parents.at(level)); + auto result = subcom->_parse_single_config(item, level + 1); + + return result; + } catch(const OptionNotFound &) { + return false; + } + } + // check for section open + if(item.name == "++") { + if(configurable_) { + increment_parsed(); + _trigger_pre_parse(2); + if(parent_ != nullptr) { + parent_->parsed_subcommands_.push_back(this); + } + } + return true; + } + // check for section close + if(item.name == "--") { + if(configurable_ && parse_complete_callback_) { + _process_callbacks(); + _process_requirements(); + run_callback(); + } + return true; + } + Option *op = get_option_no_throw("--" + item.name); + if(op == nullptr) { + if(item.name.size() == 1) { + op = get_option_no_throw("-" + item.name); + } + } + if(op == nullptr) { + op = get_option_no_throw(item.name); + } + if(op == nullptr) { + // If the option was not present + if(get_allow_config_extras() == config_extras_mode::capture) + // Should we worry about classifying the extras properly? + missing_.emplace_back(detail::Classifier::NONE, item.fullname()); + return false; + } + + if(!op->get_configurable()) { + if(get_allow_config_extras() == config_extras_mode::ignore_all) { + return false; + } + throw ConfigError::NotConfigurable(item.fullname()); + } + + if(op->empty()) { + + if(op->get_expected_min() == 0) { + // Flag parsing + auto res = config_formatter_->to_flag(item); + res = op->get_flag_value(item.name, res); + + op->add_result(res); + + } else { + op->add_result(item.inputs); + op->run_callback(); + } + } + + return true; +} + +CLI11_INLINE bool App::_parse_single(std::vector<std::string> &args, bool &positional_only) { + bool retval = true; + detail::Classifier classifier = positional_only ? detail::Classifier::NONE : _recognize(args.back()); + switch(classifier) { + case detail::Classifier::POSITIONAL_MARK: + args.pop_back(); + positional_only = true; + if((!_has_remaining_positionals()) && (parent_ != nullptr)) { + retval = false; + } else { + _move_to_missing(classifier, "--"); + } + break; + case detail::Classifier::SUBCOMMAND_TERMINATOR: + // treat this like a positional mark if in the parent app + args.pop_back(); + retval = false; + break; + case detail::Classifier::SUBCOMMAND: + retval = _parse_subcommand(args); + break; + case detail::Classifier::LONG: + case detail::Classifier::SHORT: + case detail::Classifier::WINDOWS_STYLE: + // If already parsed a subcommand, don't accept options_ + _parse_arg(args, classifier); + break; + case detail::Classifier::NONE: + // Probably a positional or something for a parent (sub)command + retval = _parse_positional(args, false); + if(retval && positionals_at_end_) { + positional_only = true; + } + break; + // LCOV_EXCL_START + default: + throw HorribleError("unrecognized classifier (you should not see this!)"); + // LCOV_EXCL_STOP + } + return retval; +} + +CLI11_NODISCARD CLI11_INLINE std::size_t App::_count_remaining_positionals(bool required_only) const { + std::size_t retval = 0; + for(const Option_p &opt : options_) { + if(opt->get_positional() && (!required_only || opt->get_required())) { + if(opt->get_items_expected_min() > 0 && static_cast<int>(opt->count()) < opt->get_items_expected_min()) { + retval += static_cast<std::size_t>(opt->get_items_expected_min()) - opt->count(); + } + } + } + return retval; +} + +CLI11_NODISCARD CLI11_INLINE bool App::_has_remaining_positionals() const { + for(const Option_p &opt : options_) { + if(opt->get_positional() && ((static_cast<int>(opt->count()) < opt->get_items_expected_min()))) { + return true; + } + } + + return false; +} + +CLI11_INLINE bool App::_parse_positional(std::vector<std::string> &args, bool haltOnSubcommand) { + + const std::string &positional = args.back(); + + if(positionals_at_end_) { + // deal with the case of required arguments at the end which should take precedence over other arguments + auto arg_rem = args.size(); + auto remreq = _count_remaining_positionals(true); + if(arg_rem <= remreq) { + for(const Option_p &opt : options_) { + if(opt->get_positional() && opt->required_) { + if(static_cast<int>(opt->count()) < opt->get_items_expected_min()) { + if(validate_positionals_) { + std::string pos = positional; + pos = opt->_validate(pos, 0); + if(!pos.empty()) { + continue; + } + } + + parse_order_.push_back(opt.get()); + /// if we require a separator add it here + if(opt->get_inject_separator()) { + if(!opt->results().empty() && !opt->results().back().empty()) { + opt->add_result(std::string{}); + } + } + if(opt->get_trigger_on_parse() && + opt->current_option_state_ == Option::option_state::callback_run) { + opt->clear(); + } + opt->add_result(positional); + if(opt->get_trigger_on_parse()) { + opt->run_callback(); + } + args.pop_back(); + return true; + } + } + } + } + } + for(const Option_p &opt : options_) { + // Eat options, one by one, until done + if(opt->get_positional() && + (static_cast<int>(opt->count()) < opt->get_items_expected_min() || opt->get_allow_extra_args())) { + if(validate_positionals_) { + std::string pos = positional; + pos = opt->_validate(pos, 0); + if(!pos.empty()) { + continue; + } + } + if(opt->get_inject_separator()) { + if(!opt->results().empty() && !opt->results().back().empty()) { + opt->add_result(std::string{}); + } + } + if(opt->get_trigger_on_parse() && opt->current_option_state_ == Option::option_state::callback_run) { + opt->clear(); + } + opt->add_result(positional); + if(opt->get_trigger_on_parse()) { + opt->run_callback(); + } + parse_order_.push_back(opt.get()); + args.pop_back(); + return true; + } + } + + for(auto &subc : subcommands_) { + if((subc->name_.empty()) && (!subc->disabled_)) { + if(subc->_parse_positional(args, false)) { + if(!subc->pre_parse_called_) { + subc->_trigger_pre_parse(args.size()); + } + return true; + } + } + } + // let the parent deal with it if possible + if(parent_ != nullptr && fallthrough_) + return _get_fallthrough_parent()->_parse_positional(args, static_cast<bool>(parse_complete_callback_)); + + /// Try to find a local subcommand that is repeated + auto *com = _find_subcommand(args.back(), true, false); + if(com != nullptr && (require_subcommand_max_ == 0 || require_subcommand_max_ > parsed_subcommands_.size())) { + if(haltOnSubcommand) { + return false; + } + args.pop_back(); + com->_parse(args); + return true; + } + /// now try one last gasp at subcommands that have been executed before, go to root app and try to find a + /// subcommand in a broader way, if one exists let the parent deal with it + auto *parent_app = (parent_ != nullptr) ? _get_fallthrough_parent() : this; + com = parent_app->_find_subcommand(args.back(), true, false); + if(com != nullptr && (com->parent_->require_subcommand_max_ == 0 || + com->parent_->require_subcommand_max_ > com->parent_->parsed_subcommands_.size())) { + return false; + } + + if(positionals_at_end_) { + throw CLI::ExtrasError(name_, args); + } + /// If this is an option group don't deal with it + if(parent_ != nullptr && name_.empty()) { + return false; + } + /// We are out of other options this goes to missing + _move_to_missing(detail::Classifier::NONE, positional); + args.pop_back(); + if(prefix_command_) { + while(!args.empty()) { + _move_to_missing(detail::Classifier::NONE, args.back()); + args.pop_back(); + } + } + + return true; +} + +CLI11_NODISCARD CLI11_INLINE App * +App::_find_subcommand(const std::string &subc_name, bool ignore_disabled, bool ignore_used) const noexcept { + for(const App_p &com : subcommands_) { + if(com->disabled_ && ignore_disabled) + continue; + if(com->get_name().empty()) { + auto *subc = com->_find_subcommand(subc_name, ignore_disabled, ignore_used); + if(subc != nullptr) { + return subc; + } + } + if(com->check_name(subc_name)) { + if((!*com) || !ignore_used) + return com.get(); + } + } + return nullptr; +} + +CLI11_INLINE bool App::_parse_subcommand(std::vector<std::string> &args) { + if(_count_remaining_positionals(/* required */ true) > 0) { + _parse_positional(args, false); + return true; + } + auto *com = _find_subcommand(args.back(), true, true); + if(com != nullptr) { + args.pop_back(); + if(!com->silent_) { + parsed_subcommands_.push_back(com); + } + com->_parse(args); + auto *parent_app = com->parent_; + while(parent_app != this) { + parent_app->_trigger_pre_parse(args.size()); + if(!com->silent_) { + parent_app->parsed_subcommands_.push_back(com); + } + parent_app = parent_app->parent_; + } + return true; + } + + if(parent_ == nullptr) + throw HorribleError("Subcommand " + args.back() + " missing"); + return false; +} + +CLI11_INLINE bool App::_parse_arg(std::vector<std::string> &args, detail::Classifier current_type) { + + std::string current = args.back(); + + std::string arg_name; + std::string value; + std::string rest; + + switch(current_type) { + case detail::Classifier::LONG: + if(!detail::split_long(current, arg_name, value)) + throw HorribleError("Long parsed but missing (you should not see this):" + args.back()); + break; + case detail::Classifier::SHORT: + if(!detail::split_short(current, arg_name, rest)) + throw HorribleError("Short parsed but missing! You should not see this"); + break; + case detail::Classifier::WINDOWS_STYLE: + if(!detail::split_windows_style(current, arg_name, value)) + throw HorribleError("windows option parsed but missing! You should not see this"); + break; + case detail::Classifier::SUBCOMMAND: + case detail::Classifier::SUBCOMMAND_TERMINATOR: + case detail::Classifier::POSITIONAL_MARK: + case detail::Classifier::NONE: + default: + throw HorribleError("parsing got called with invalid option! You should not see this"); + } + + auto op_ptr = std::find_if(std::begin(options_), std::end(options_), [arg_name, current_type](const Option_p &opt) { + if(current_type == detail::Classifier::LONG) + return opt->check_lname(arg_name); + if(current_type == detail::Classifier::SHORT) + return opt->check_sname(arg_name); + // this will only get called for detail::Classifier::WINDOWS_STYLE + return opt->check_lname(arg_name) || opt->check_sname(arg_name); + }); + + // Option not found + if(op_ptr == std::end(options_)) { + for(auto &subc : subcommands_) { + if(subc->name_.empty() && !subc->disabled_) { + if(subc->_parse_arg(args, current_type)) { + if(!subc->pre_parse_called_) { + subc->_trigger_pre_parse(args.size()); + } + return true; + } + } + } + + // don't capture missing if this is a nameless subcommand and nameless subcommands can't fallthrough + if(parent_ != nullptr && name_.empty()) { + return false; + } + + // If a subcommand, try the main command + if(parent_ != nullptr && fallthrough_) + return _get_fallthrough_parent()->_parse_arg(args, current_type); + + // Otherwise, add to missing + args.pop_back(); + _move_to_missing(current_type, current); + return true; + } + + args.pop_back(); + + // Get a reference to the pointer to make syntax bearable + Option_p &op = *op_ptr; + /// if we require a separator add it here + if(op->get_inject_separator()) { + if(!op->results().empty() && !op->results().back().empty()) { + op->add_result(std::string{}); + } + } + if(op->get_trigger_on_parse() && op->current_option_state_ == Option::option_state::callback_run) { + op->clear(); + } + int min_num = (std::min)(op->get_type_size_min(), op->get_items_expected_min()); + int max_num = op->get_items_expected_max(); + // check container like options to limit the argument size to a single type if the allow_extra_flags argument is + // set. 16 is somewhat arbitrary (needs to be at least 4) + if(max_num >= detail::expected_max_vector_size / 16 && !op->get_allow_extra_args()) { + auto tmax = op->get_type_size_max(); + max_num = detail::checked_multiply(tmax, op->get_expected_min()) ? tmax : detail::expected_max_vector_size; + } + // Make sure we always eat the minimum for unlimited vectors + int collected = 0; // total number of arguments collected + int result_count = 0; // local variable for number of results in a single arg string + // deal with purely flag like things + if(max_num == 0) { + auto res = op->get_flag_value(arg_name, value); + op->add_result(res); + parse_order_.push_back(op.get()); + } else if(!value.empty()) { // --this=value + op->add_result(value, result_count); + parse_order_.push_back(op.get()); + collected += result_count; + // -Trest + } else if(!rest.empty()) { + op->add_result(rest, result_count); + parse_order_.push_back(op.get()); + rest = ""; + collected += result_count; + } + + // gather the minimum number of arguments + while(min_num > collected && !args.empty()) { + std::string current_ = args.back(); + args.pop_back(); + op->add_result(current_, result_count); + parse_order_.push_back(op.get()); + collected += result_count; + } + + if(min_num > collected) { // if we have run out of arguments and the minimum was not met + throw ArgumentMismatch::TypedAtLeast(op->get_name(), min_num, op->get_type_name()); + } + + // now check for optional arguments + if(max_num > collected || op->get_allow_extra_args()) { // we allow optional arguments + auto remreqpos = _count_remaining_positionals(true); + // we have met the minimum now optionally check up to the maximum + while((collected < max_num || op->get_allow_extra_args()) && !args.empty() && + _recognize(args.back(), false) == detail::Classifier::NONE) { + // If any required positionals remain, don't keep eating + if(remreqpos >= args.size()) { + break; + } + if(validate_optional_arguments_) { + std::string arg = args.back(); + arg = op->_validate(arg, 0); + if(!arg.empty()) { + break; + } + } + op->add_result(args.back(), result_count); + parse_order_.push_back(op.get()); + args.pop_back(); + collected += result_count; + } + + // Allow -- to end an unlimited list and "eat" it + if(!args.empty() && _recognize(args.back()) == detail::Classifier::POSITIONAL_MARK) + args.pop_back(); + // optional flag that didn't receive anything now get the default value + if(min_num == 0 && max_num > 0 && collected == 0) { + auto res = op->get_flag_value(arg_name, std::string{}); + op->add_result(res); + parse_order_.push_back(op.get()); + } + } + // if we only partially completed a type then add an empty string if allowed for later processing + if(min_num > 0 && (collected % op->get_type_size_max()) != 0) { + if(op->get_type_size_max() != op->get_type_size_min()) { + op->add_result(std::string{}); + } else { + throw ArgumentMismatch::PartialType(op->get_name(), op->get_type_size_min(), op->get_type_name()); + } + } + if(op->get_trigger_on_parse()) { + op->run_callback(); + } + if(!rest.empty()) { + rest = "-" + rest; + args.push_back(rest); + } + return true; +} + +CLI11_INLINE void App::_trigger_pre_parse(std::size_t remaining_args) { + if(!pre_parse_called_) { + pre_parse_called_ = true; + if(pre_parse_callback_) { + pre_parse_callback_(remaining_args); + } + } else if(immediate_callback_) { + if(!name_.empty()) { + auto pcnt = parsed_; + auto extras = std::move(missing_); + clear(); + parsed_ = pcnt; + pre_parse_called_ = true; + missing_ = std::move(extras); + } + } +} + +CLI11_INLINE App *App::_get_fallthrough_parent() { + if(parent_ == nullptr) { + throw(HorribleError("No Valid parent")); + } + auto *fallthrough_parent = parent_; + while((fallthrough_parent->parent_ != nullptr) && (fallthrough_parent->get_name().empty())) { + fallthrough_parent = fallthrough_parent->parent_; + } + return fallthrough_parent; +} + +CLI11_NODISCARD CLI11_INLINE const std::string &App::_compare_subcommand_names(const App &subcom, + const App &base) const { + static const std::string estring; + if(subcom.disabled_) { + return estring; + } + for(const auto &subc : base.subcommands_) { + if(subc.get() != &subcom) { + if(subc->disabled_) { + continue; + } + if(!subcom.get_name().empty()) { + if(subc->check_name(subcom.get_name())) { + return subcom.get_name(); + } + } + if(!subc->get_name().empty()) { + if(subcom.check_name(subc->get_name())) { + return subc->get_name(); + } + } + for(const auto &les : subcom.aliases_) { + if(subc->check_name(les)) { + return les; + } + } + // this loop is needed in case of ignore_underscore or ignore_case on one but not the other + for(const auto &les : subc->aliases_) { + if(subcom.check_name(les)) { + return les; + } + } + // if the subcommand is an option group we need to check deeper + if(subc->get_name().empty()) { + const auto &cmpres = _compare_subcommand_names(subcom, *subc); + if(!cmpres.empty()) { + return cmpres; + } + } + // if the test subcommand is an option group we need to check deeper + if(subcom.get_name().empty()) { + const auto &cmpres = _compare_subcommand_names(*subc, subcom); + if(!cmpres.empty()) { + return cmpres; + } + } + } + } + return estring; +} + +CLI11_INLINE void App::_move_to_missing(detail::Classifier val_type, const std::string &val) { + if(allow_extras_ || subcommands_.empty()) { + missing_.emplace_back(val_type, val); + return; + } + // allow extra arguments to be places in an option group if it is allowed there + for(auto &subc : subcommands_) { + if(subc->name_.empty() && subc->allow_extras_) { + subc->missing_.emplace_back(val_type, val); + return; + } + } + // if we haven't found any place to put them yet put them in missing + missing_.emplace_back(val_type, val); +} + +CLI11_INLINE void App::_move_option(Option *opt, App *app) { + if(opt == nullptr) { + throw OptionNotFound("the option is NULL"); + } + // verify that the give app is actually a subcommand + bool found = false; + for(auto &subc : subcommands_) { + if(app == subc.get()) { + found = true; + } + } + if(!found) { + throw OptionNotFound("The Given app is not a subcommand"); + } + + if((help_ptr_ == opt) || (help_all_ptr_ == opt)) + throw OptionAlreadyAdded("cannot move help options"); + + if(config_ptr_ == opt) + throw OptionAlreadyAdded("cannot move config file options"); + + auto iterator = + std::find_if(std::begin(options_), std::end(options_), [opt](const Option_p &v) { return v.get() == opt; }); + if(iterator != std::end(options_)) { + const auto &opt_p = *iterator; + if(std::find_if(std::begin(app->options_), std::end(app->options_), [&opt_p](const Option_p &v) { + return (*v == *opt_p); + }) == std::end(app->options_)) { + // only erase after the insertion was successful + app->options_.push_back(std::move(*iterator)); + options_.erase(iterator); + } else { + throw OptionAlreadyAdded("option was not located: " + opt->get_name()); + } + } else { + throw OptionNotFound("could not locate the given Option"); + } +} + +CLI11_INLINE void TriggerOn(App *trigger_app, App *app_to_enable) { + app_to_enable->enabled_by_default(false); + app_to_enable->disabled_by_default(); + trigger_app->preparse_callback([app_to_enable](std::size_t) { app_to_enable->disabled(false); }); +} + +CLI11_INLINE void TriggerOn(App *trigger_app, std::vector<App *> apps_to_enable) { + for(auto &app : apps_to_enable) { + app->enabled_by_default(false); + app->disabled_by_default(); + } + + trigger_app->preparse_callback([apps_to_enable](std::size_t) { + for(const auto &app : apps_to_enable) { + app->disabled(false); + } + }); +} + +CLI11_INLINE void TriggerOff(App *trigger_app, App *app_to_enable) { + app_to_enable->disabled_by_default(false); + app_to_enable->enabled_by_default(); + trigger_app->preparse_callback([app_to_enable](std::size_t) { app_to_enable->disabled(); }); +} + +CLI11_INLINE void TriggerOff(App *trigger_app, std::vector<App *> apps_to_enable) { + for(auto &app : apps_to_enable) { + app->disabled_by_default(false); + app->enabled_by_default(); + } + + trigger_app->preparse_callback([apps_to_enable](std::size_t) { + for(const auto &app : apps_to_enable) { + app->disabled(); + } + }); +} + +CLI11_INLINE void deprecate_option(Option *opt, const std::string &replacement) { + Validator deprecate_warning{[opt, replacement](std::string &) { + std::cout << opt->get_name() << " is deprecated please use '" << replacement + << "' instead\n"; + return std::string(); + }, + "DEPRECATED"}; + deprecate_warning.application_index(0); + opt->check(deprecate_warning); + if(!replacement.empty()) { + opt->description(opt->get_description() + " DEPRECATED: please use '" + replacement + "' instead"); + } +} + +CLI11_INLINE void retire_option(App *app, Option *opt) { + App temp; + auto *option_copy = temp.add_option(opt->get_name(false, true)) + ->type_size(opt->get_type_size_min(), opt->get_type_size_max()) + ->expected(opt->get_expected_min(), opt->get_expected_max()) + ->allow_extra_args(opt->get_allow_extra_args()); + + app->remove_option(opt); + auto *opt2 = app->add_option(option_copy->get_name(false, true), "option has been retired and has no effect") + ->type_name("RETIRED") + ->default_str("RETIRED") + ->type_size(option_copy->get_type_size_min(), option_copy->get_type_size_max()) + ->expected(option_copy->get_expected_min(), option_copy->get_expected_max()) + ->allow_extra_args(option_copy->get_allow_extra_args()); + + Validator retired_warning{[opt2](std::string &) { + std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; + return std::string(); + }, + ""}; + retired_warning.application_index(0); + opt2->check(retired_warning); +} + +CLI11_INLINE void retire_option(App &app, Option *opt) { retire_option(&app, opt); } + +CLI11_INLINE void retire_option(App *app, const std::string &option_name) { + + auto *opt = app->get_option_no_throw(option_name); + if(opt != nullptr) { + retire_option(app, opt); + return; + } + auto *opt2 = app->add_option(option_name, "option has been retired and has no effect") + ->type_name("RETIRED") + ->expected(0, 1) + ->default_str("RETIRED"); + Validator retired_warning{[opt2](std::string &) { + std::cout << "WARNING " << opt2->get_name() << " is retired and has no effect\n"; + return std::string(); + }, + ""}; + retired_warning.application_index(0); + opt2->check(retired_warning); +} + +CLI11_INLINE void retire_option(App &app, const std::string &option_name) { retire_option(&app, option_name); } + +namespace FailureMessage { + +CLI11_INLINE std::string simple(const App *app, const Error &e) { + std::string header = std::string(e.what()) + "\n"; + std::vector<std::string> names; + + // Collect names + if(app->get_help_ptr() != nullptr) + names.push_back(app->get_help_ptr()->get_name()); + + if(app->get_help_all_ptr() != nullptr) + names.push_back(app->get_help_all_ptr()->get_name()); + + // If any names found, suggest those + if(!names.empty()) + header += "Run with " + detail::join(names, " or ") + " for more information.\n"; + + return header; +} + +CLI11_INLINE std::string help(const App *app, const Error &e) { + std::string header = std::string("ERROR: ") + e.get_name() + ": " + e.what() + "\n"; + header += app->help(); + return header; +} + +} // namespace FailureMessage + +// [CLI11:app_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Config_inl.hpp b/packages/CLI11/include/CLI/impl/Config_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0f9695f2922384cc938df24ad26aaa15ab030984 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Config_inl.hpp @@ -0,0 +1,391 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Config.hpp> + +// [CLI11:public_includes:set] +#include <algorithm> +#include <string> +#include <utility> +#include <vector> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:config_inl_hpp:verbatim] + +namespace detail { + +CLI11_INLINE std::string convert_arg_for_ini(const std::string &arg, char stringQuote, char characterQuote) { + if(arg.empty()) { + return std::string(2, stringQuote); + } + // some specifically supported strings + if(arg == "true" || arg == "false" || arg == "nan" || arg == "inf") { + return arg; + } + // floating point conversion can convert some hex codes, but don't try that here + if(arg.compare(0, 2, "0x") != 0 && arg.compare(0, 2, "0X") != 0) { + double val = 0.0; + if(detail::lexical_cast(arg, val)) { + return arg; + } + } + // just quote a single non numeric character + if(arg.size() == 1) { + return std::string(1, characterQuote) + arg + characterQuote; + } + // handle hex, binary or octal arguments + if(arg.front() == '0') { + if(arg[1] == 'x') { + if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { + return (x >= '0' && x <= '9') || (x >= 'A' && x <= 'F') || (x >= 'a' && x <= 'f'); + })) { + return arg; + } + } else if(arg[1] == 'o') { + if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x >= '0' && x <= '7'); })) { + return arg; + } + } else if(arg[1] == 'b') { + if(std::all_of(arg.begin() + 2, arg.end(), [](char x) { return (x == '0' || x == '1'); })) { + return arg; + } + } + } + if(arg.find_first_of(stringQuote) == std::string::npos) { + return std::string(1, stringQuote) + arg + stringQuote; + } + return characterQuote + arg + characterQuote; +} + +CLI11_INLINE std::string ini_join(const std::vector<std::string> &args, + char sepChar, + char arrayStart, + char arrayEnd, + char stringQuote, + char characterQuote) { + std::string joined; + if(args.size() > 1 && arrayStart != '\0') { + joined.push_back(arrayStart); + } + std::size_t start = 0; + for(const auto &arg : args) { + if(start++ > 0) { + joined.push_back(sepChar); + if(!std::isspace<char>(sepChar, std::locale())) { + joined.push_back(' '); + } + } + joined.append(convert_arg_for_ini(arg, stringQuote, characterQuote)); + } + if(args.size() > 1 && arrayEnd != '\0') { + joined.push_back(arrayEnd); + } + return joined; +} + +CLI11_INLINE std::vector<std::string> +generate_parents(const std::string §ion, std::string &name, char parentSeparator) { + std::vector<std::string> parents; + if(detail::to_lower(section) != "default") { + if(section.find(parentSeparator) != std::string::npos) { + parents = detail::split(section, parentSeparator); + } else { + parents = {section}; + } + } + if(name.find(parentSeparator) != std::string::npos) { + std::vector<std::string> plist = detail::split(name, parentSeparator); + name = plist.back(); + detail::remove_quotes(name); + plist.pop_back(); + parents.insert(parents.end(), plist.begin(), plist.end()); + } + + // clean up quotes on the parents + for(auto &parent : parents) { + detail::remove_quotes(parent); + } + return parents; +} + +CLI11_INLINE void +checkParentSegments(std::vector<ConfigItem> &output, const std::string ¤tSection, char parentSeparator) { + + std::string estring; + auto parents = detail::generate_parents(currentSection, estring, parentSeparator); + if(!output.empty() && output.back().name == "--") { + std::size_t msize = (parents.size() > 1U) ? parents.size() : 2; + while(output.back().parents.size() >= msize) { + output.push_back(output.back()); + output.back().parents.pop_back(); + } + + if(parents.size() > 1) { + std::size_t common = 0; + std::size_t mpair = (std::min)(output.back().parents.size(), parents.size() - 1); + for(std::size_t ii = 0; ii < mpair; ++ii) { + if(output.back().parents[ii] != parents[ii]) { + break; + } + ++common; + } + if(common == mpair) { + output.pop_back(); + } else { + while(output.back().parents.size() > common + 1) { + output.push_back(output.back()); + output.back().parents.pop_back(); + } + } + for(std::size_t ii = common; ii < parents.size() - 1; ++ii) { + output.emplace_back(); + output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1); + output.back().name = "++"; + } + } + } else if(parents.size() > 1) { + for(std::size_t ii = 0; ii < parents.size() - 1; ++ii) { + output.emplace_back(); + output.back().parents.assign(parents.begin(), parents.begin() + static_cast<std::ptrdiff_t>(ii) + 1); + output.back().name = "++"; + } + } + + // insert a section end which is just an empty items_buffer + output.emplace_back(); + output.back().parents = std::move(parents); + output.back().name = "++"; +} +} // namespace detail + +inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) const { + std::string line; + std::string currentSection = "default"; + std::string previousSection = "default"; + std::vector<ConfigItem> output; + bool isDefaultArray = (arrayStart == '[' && arrayEnd == ']' && arraySeparator == ','); + bool isINIArray = (arrayStart == '\0' || arrayStart == ' ') && arrayStart == arrayEnd; + bool inSection{false}; + char aStart = (isINIArray) ? '[' : arrayStart; + char aEnd = (isINIArray) ? ']' : arrayEnd; + char aSep = (isINIArray && arraySeparator == ' ') ? ',' : arraySeparator; + int currentSectionIndex{0}; + while(getline(input, line)) { + std::vector<std::string> items_buffer; + std::string name; + + detail::trim(line); + std::size_t len = line.length(); + // lines have to be at least 3 characters to have any meaning to CLI just skip the rest + if(len < 3) { + continue; + } + if(line.front() == '[' && line.back() == ']') { + if(currentSection != "default") { + // insert a section end which is just an empty items_buffer + output.emplace_back(); + output.back().parents = detail::generate_parents(currentSection, name, parentSeparatorChar); + output.back().name = "--"; + } + currentSection = line.substr(1, len - 2); + // deal with double brackets for TOML + if(currentSection.size() > 1 && currentSection.front() == '[' && currentSection.back() == ']') { + currentSection = currentSection.substr(1, currentSection.size() - 2); + } + if(detail::to_lower(currentSection) == "default") { + currentSection = "default"; + } else { + detail::checkParentSegments(output, currentSection, parentSeparatorChar); + } + inSection = false; + if(currentSection == previousSection) { + ++currentSectionIndex; + } else { + currentSectionIndex = 0; + previousSection = currentSection; + } + continue; + } + + // comment lines + if(line.front() == ';' || line.front() == '#' || line.front() == commentChar) { + continue; + } + + // Find = in string, split and recombine + auto pos = line.find(valueDelimiter); + if(pos != std::string::npos) { + name = detail::trim_copy(line.substr(0, pos)); + std::string item = detail::trim_copy(line.substr(pos + 1)); + auto cloc = item.find(commentChar); + if(cloc != std::string::npos) { + item.erase(cloc, std::string::npos); // NOLINT(readability-suspicious-call-argument) + detail::trim(item); + } + if(item.size() > 1 && item.front() == aStart) { + for(std::string multiline; item.back() != aEnd && std::getline(input, multiline);) { + detail::trim(multiline); + item += multiline; + } + items_buffer = detail::split_up(item.substr(1, item.length() - 2), aSep); + } else if((isDefaultArray || isINIArray) && item.find_first_of(aSep) != std::string::npos) { + items_buffer = detail::split_up(item, aSep); + } else if((isDefaultArray || isINIArray) && item.find_first_of(' ') != std::string::npos) { + items_buffer = detail::split_up(item); + } else { + items_buffer = {item}; + } + } else { + name = detail::trim_copy(line); + auto cloc = name.find(commentChar); + if(cloc != std::string::npos) { + name.erase(cloc, std::string::npos); // NOLINT(readability-suspicious-call-argument) + detail::trim(name); + } + + items_buffer = {"true"}; + } + if(name.find(parentSeparatorChar) == std::string::npos) { + detail::remove_quotes(name); + } + // clean up quotes on the items + for(auto &it : items_buffer) { + detail::remove_quotes(it); + } + + std::vector<std::string> parents = detail::generate_parents(currentSection, name, parentSeparatorChar); + if(parents.size() > maximumLayers) { + continue; + } + if(!configSection.empty() && !inSection) { + if(parents.empty() || parents.front() != configSection) { + continue; + } + if(configIndex >= 0 && currentSectionIndex != configIndex) { + continue; + } + parents.erase(parents.begin()); + inSection = true; + } + if(!output.empty() && name == output.back().name && parents == output.back().parents) { + output.back().inputs.insert(output.back().inputs.end(), items_buffer.begin(), items_buffer.end()); + } else { + output.emplace_back(); + output.back().parents = std::move(parents); + output.back().name = std::move(name); + output.back().inputs = std::move(items_buffer); + } + } + if(currentSection != "default") { + // insert a section end which is just an empty items_buffer + std::string ename; + output.emplace_back(); + output.back().parents = detail::generate_parents(currentSection, ename, parentSeparatorChar); + output.back().name = "--"; + while(output.back().parents.size() > 1) { + output.push_back(output.back()); + output.back().parents.pop_back(); + } + } + return output; +} + +CLI11_INLINE std::string +ConfigBase::to_config(const App *app, bool default_also, bool write_description, std::string prefix) const { + std::stringstream out; + std::string commentLead; + commentLead.push_back(commentChar); + commentLead.push_back(' '); + + std::vector<std::string> groups = app->get_groups(); + bool defaultUsed = false; + groups.insert(groups.begin(), std::string("Options")); + if(write_description && (app->get_configurable() || app->get_parent() == nullptr || app->get_name().empty())) { + out << commentLead << detail::fix_newlines(commentLead, app->get_description()) << '\n'; + } + for(auto &group : groups) { + if(group == "Options" || group.empty()) { + if(defaultUsed) { + continue; + } + defaultUsed = true; + } + if(write_description && group != "Options" && !group.empty()) { + out << '\n' << commentLead << group << " Options\n"; + } + for(const Option *opt : app->get_options({})) { + + // Only process options that are configurable + if(opt->get_configurable()) { + if(opt->get_group() != group) { + if(!(group == "Options" && opt->get_group().empty())) { + continue; + } + } + std::string name = prefix + opt->get_single_name(); + std::string value = detail::ini_join( + opt->reduced_results(), arraySeparator, arrayStart, arrayEnd, stringQuote, characterQuote); + + if(value.empty() && default_also) { + if(!opt->get_default_str().empty()) { + value = detail::convert_arg_for_ini(opt->get_default_str(), stringQuote, characterQuote); + } else if(opt->get_expected_min() == 0) { + value = "false"; + } else if(opt->get_run_callback_for_default()) { + value = "\"\""; // empty string default value + } + } + + if(!value.empty()) { + if(write_description && opt->has_description()) { + out << '\n'; + out << commentLead << detail::fix_newlines(commentLead, opt->get_description()) << '\n'; + } + out << name << valueDelimiter << value << '\n'; + } + } + } + } + auto subcommands = app->get_subcommands({}); + for(const App *subcom : subcommands) { + if(subcom->get_name().empty()) { + if(write_description && !subcom->get_group().empty()) { + out << '\n' << commentLead << subcom->get_group() << " Options\n"; + } + out << to_config(subcom, default_also, write_description, prefix); + } + } + + for(const App *subcom : subcommands) { + if(!subcom->get_name().empty()) { + if(subcom->get_configurable() && app->got_subcommand(subcom)) { + if(!prefix.empty() || app->get_parent() == nullptr) { + out << '[' << prefix << subcom->get_name() << "]\n"; + } else { + std::string subname = app->get_name() + parentSeparatorChar + subcom->get_name(); + const auto *p = app->get_parent(); + while(p->get_parent() != nullptr) { + subname = p->get_name() + parentSeparatorChar + subname; + p = p->get_parent(); + } + out << '[' << subname << "]\n"; + } + out << to_config(subcom, default_also, write_description, ""); + } else { + out << to_config( + subcom, default_also, write_description, prefix + subcom->get_name() + parentSeparatorChar); + } + } + } + + return out.str(); +} +// [CLI11:config_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Formatter_inl.hpp b/packages/CLI11/include/CLI/impl/Formatter_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..37249e082e23d9e3bf947eceb0dd8eb721d11391 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Formatter_inl.hpp @@ -0,0 +1,291 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Formatter.hpp> + +// [CLI11:public_includes:set] +#include <algorithm> +#include <string> +#include <utility> +#include <vector> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:formatter_inl_hpp:verbatim] +CLI11_INLINE std::string +Formatter::make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const { + std::stringstream out; + + out << "\n" << group << ":\n"; + for(const Option *opt : opts) { + out << make_option(opt, is_positional); + } + + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_positionals(const App *app) const { + std::vector<const Option *> opts = + app->get_options([](const Option *opt) { return !opt->get_group().empty() && opt->get_positional(); }); + + if(opts.empty()) + return {}; + + return make_group(get_label("Positionals"), true, opts); +} + +CLI11_INLINE std::string Formatter::make_groups(const App *app, AppFormatMode mode) const { + std::stringstream out; + std::vector<std::string> groups = app->get_groups(); + + // Options + for(const std::string &group : groups) { + std::vector<const Option *> opts = app->get_options([app, mode, &group](const Option *opt) { + return opt->get_group() == group // Must be in the right group + && opt->nonpositional() // Must not be a positional + && (mode != AppFormatMode::Sub // If mode is Sub, then + || (app->get_help_ptr() != opt // Ignore help pointer + && app->get_help_all_ptr() != opt)); // Ignore help all pointer + }); + if(!group.empty() && !opts.empty()) { + out << make_group(group, false, opts); + + if(group != groups.back()) + out << "\n"; + } + } + + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_description(const App *app) const { + std::string desc = app->get_description(); + auto min_options = app->get_require_option_min(); + auto max_options = app->get_require_option_max(); + if(app->get_required()) { + desc += " REQUIRED "; + } + if((max_options == min_options) && (min_options > 0)) { + if(min_options == 1) { + desc += " \n[Exactly 1 of the following options is required]"; + } else { + desc += " \n[Exactly " + std::to_string(min_options) + "options from the following list are required]"; + } + } else if(max_options > 0) { + if(min_options > 0) { + desc += " \n[Between " + std::to_string(min_options) + " and " + std::to_string(max_options) + + " of the follow options are required]"; + } else { + desc += " \n[At most " + std::to_string(max_options) + " of the following options are allowed]"; + } + } else if(min_options > 0) { + desc += " \n[At least " + std::to_string(min_options) + " of the following options are required]"; + } + return (!desc.empty()) ? desc + "\n" : std::string{}; +} + +CLI11_INLINE std::string Formatter::make_usage(const App *app, std::string name) const { + std::stringstream out; + + out << get_label("Usage") << ":" << (name.empty() ? "" : " ") << name; + + std::vector<std::string> groups = app->get_groups(); + + // Print an Options badge if any options exist + std::vector<const Option *> non_pos_options = + app->get_options([](const Option *opt) { return opt->nonpositional(); }); + if(!non_pos_options.empty()) + out << " [" << get_label("OPTIONS") << "]"; + + // Positionals need to be listed here + std::vector<const Option *> positionals = app->get_options([](const Option *opt) { return opt->get_positional(); }); + + // Print out positionals if any are left + if(!positionals.empty()) { + // Convert to help names + std::vector<std::string> positional_names(positionals.size()); + std::transform(positionals.begin(), positionals.end(), positional_names.begin(), [this](const Option *opt) { + return make_option_usage(opt); + }); + + out << " " << detail::join(positional_names, " "); + } + + // Add a marker if subcommands are expected or optional + if(!app->get_subcommands( + [](const CLI::App *subc) { return ((!subc->get_disabled()) && (!subc->get_name().empty())); }) + .empty()) { + out << " " << (app->get_require_subcommand_min() == 0 ? "[" : "") + << get_label(app->get_require_subcommand_max() < 2 || app->get_require_subcommand_min() > 1 ? "SUBCOMMAND" + : "SUBCOMMANDS") + << (app->get_require_subcommand_min() == 0 ? "]" : ""); + } + + out << std::endl; + + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_footer(const App *app) const { + std::string footer = app->get_footer(); + if(footer.empty()) { + return std::string{}; + } + return footer + "\n"; +} + +CLI11_INLINE std::string Formatter::make_help(const App *app, std::string name, AppFormatMode mode) const { + + // This immediately forwards to the make_expanded method. This is done this way so that subcommands can + // have overridden formatters + if(mode == AppFormatMode::Sub) + return make_expanded(app); + + std::stringstream out; + if((app->get_name().empty()) && (app->get_parent() != nullptr)) { + if(app->get_group() != "Subcommands") { + out << app->get_group() << ':'; + } + } + + out << make_description(app); + out << make_usage(app, name); + out << make_positionals(app); + out << make_groups(app, mode); + out << make_subcommands(app, mode); + out << '\n' << make_footer(app); + + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_subcommands(const App *app, AppFormatMode mode) const { + std::stringstream out; + + std::vector<const App *> subcommands = app->get_subcommands({}); + + // Make a list in definition order of the groups seen + std::vector<std::string> subcmd_groups_seen; + for(const App *com : subcommands) { + if(com->get_name().empty()) { + if(!com->get_group().empty()) { + out << make_expanded(com); + } + continue; + } + std::string group_key = com->get_group(); + if(!group_key.empty() && + std::find_if(subcmd_groups_seen.begin(), subcmd_groups_seen.end(), [&group_key](std::string a) { + return detail::to_lower(a) == detail::to_lower(group_key); + }) == subcmd_groups_seen.end()) + subcmd_groups_seen.push_back(group_key); + } + + // For each group, filter out and print subcommands + for(const std::string &group : subcmd_groups_seen) { + out << "\n" << group << ":\n"; + std::vector<const App *> subcommands_group = app->get_subcommands( + [&group](const App *sub_app) { return detail::to_lower(sub_app->get_group()) == detail::to_lower(group); }); + for(const App *new_com : subcommands_group) { + if(new_com->get_name().empty()) + continue; + if(mode != AppFormatMode::All) { + out << make_subcommand(new_com); + } else { + out << new_com->help(new_com->get_name(), AppFormatMode::Sub); + out << "\n"; + } + } + } + + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_subcommand(const App *sub) const { + std::stringstream out; + detail::format_help(out, sub->get_display_name(true), sub->get_description(), column_width_); + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_expanded(const App *sub) const { + std::stringstream out; + out << sub->get_display_name(true) << "\n"; + + out << make_description(sub); + if(sub->get_name().empty() && !sub->get_aliases().empty()) { + detail::format_aliases(out, sub->get_aliases(), column_width_ + 2); + } + out << make_positionals(sub); + out << make_groups(sub, AppFormatMode::Sub); + out << make_subcommands(sub, AppFormatMode::Sub); + + // Drop blank spaces + std::string tmp = detail::find_and_replace(out.str(), "\n\n", "\n"); + tmp = tmp.substr(0, tmp.size() - 1); // Remove the final '\n' + + // Indent all but the first line (the name) + return detail::find_and_replace(tmp, "\n", "\n ") + "\n"; +} + +CLI11_INLINE std::string Formatter::make_option_name(const Option *opt, bool is_positional) const { + if(is_positional) + return opt->get_name(true, false); + + return opt->get_name(false, true); +} + +CLI11_INLINE std::string Formatter::make_option_opts(const Option *opt) const { + std::stringstream out; + + if(!opt->get_option_text().empty()) { + out << " " << opt->get_option_text(); + } else { + if(opt->get_type_size() != 0) { + if(!opt->get_type_name().empty()) + out << " " << get_label(opt->get_type_name()); + if(!opt->get_default_str().empty()) + out << " [" << opt->get_default_str() << "] "; + if(opt->get_expected_max() == detail::expected_max_vector_size) + out << " ..."; + else if(opt->get_expected_min() > 1) + out << " x " << opt->get_expected(); + + if(opt->get_required()) + out << " " << get_label("REQUIRED"); + } + if(!opt->get_envname().empty()) + out << " (" << get_label("Env") << ":" << opt->get_envname() << ")"; + if(!opt->get_needs().empty()) { + out << " " << get_label("Needs") << ":"; + for(const Option *op : opt->get_needs()) + out << " " << op->get_name(); + } + if(!opt->get_excludes().empty()) { + out << " " << get_label("Excludes") << ":"; + for(const Option *op : opt->get_excludes()) + out << " " << op->get_name(); + } + } + return out.str(); +} + +CLI11_INLINE std::string Formatter::make_option_desc(const Option *opt) const { return opt->get_description(); } + +CLI11_INLINE std::string Formatter::make_option_usage(const Option *opt) const { + // Note that these are positionals usages + std::stringstream out; + out << make_option_name(opt, true); + if(opt->get_expected_max() >= detail::expected_max_vector_size) + out << "..."; + else if(opt->get_expected_max() > 1) + out << "(" << opt->get_expected() << "x)"; + + return opt->get_required() ? out.str() : "[" + out.str() + "]"; +} +// [CLI11:formatter_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Option_inl.hpp b/packages/CLI11/include/CLI/impl/Option_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a97346235a417acad32b764a8efeb4f0ff1b6559 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Option_inl.hpp @@ -0,0 +1,653 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Option.hpp> + +// [CLI11:public_includes:set] +#include <algorithm> +#include <string> +#include <utility> +#include <vector> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:option_inl_hpp:verbatim] + +template <typename CRTP> template <typename T> void OptionBase<CRTP>::copy_to(T *other) const { + other->group(group_); + other->required(required_); + other->ignore_case(ignore_case_); + other->ignore_underscore(ignore_underscore_); + other->configurable(configurable_); + other->disable_flag_override(disable_flag_override_); + other->delimiter(delimiter_); + other->always_capture_default(always_capture_default_); + other->multi_option_policy(multi_option_policy_); +} + +CLI11_INLINE Option *Option::expected(int value) { + if(value < 0) { + expected_min_ = -value; + if(expected_max_ < expected_min_) { + expected_max_ = expected_min_; + } + allow_extra_args_ = true; + flag_like_ = false; + } else if(value == detail::expected_max_vector_size) { + expected_min_ = 1; + expected_max_ = detail::expected_max_vector_size; + allow_extra_args_ = true; + flag_like_ = false; + } else { + expected_min_ = value; + expected_max_ = value; + flag_like_ = (expected_min_ == 0); + } + return this; +} + +CLI11_INLINE Option *Option::expected(int value_min, int value_max) { + if(value_min < 0) { + value_min = -value_min; + } + + if(value_max < 0) { + value_max = detail::expected_max_vector_size; + } + if(value_max < value_min) { + expected_min_ = value_max; + expected_max_ = value_min; + } else { + expected_max_ = value_max; + expected_min_ = value_min; + } + + return this; +} + +CLI11_INLINE Option *Option::check(Validator validator, const std::string &validator_name) { + validator.non_modifying(); + validators_.push_back(std::move(validator)); + if(!validator_name.empty()) + validators_.back().name(validator_name); + return this; +} + +CLI11_INLINE Option *Option::check(std::function<std::string(const std::string &)> Validator, + std::string Validator_description, + std::string Validator_name) { + validators_.emplace_back(Validator, std::move(Validator_description), std::move(Validator_name)); + validators_.back().non_modifying(); + return this; +} + +CLI11_INLINE Option *Option::transform(Validator Validator, const std::string &Validator_name) { + validators_.insert(validators_.begin(), std::move(Validator)); + if(!Validator_name.empty()) + validators_.front().name(Validator_name); + return this; +} + +CLI11_INLINE Option *Option::transform(const std::function<std::string(std::string)> &func, + std::string transform_description, + std::string transform_name) { + validators_.insert(validators_.begin(), + Validator( + [func](std::string &val) { + val = func(val); + return std::string{}; + }, + std::move(transform_description), + std::move(transform_name))); + + return this; +} + +CLI11_INLINE Option *Option::each(const std::function<void(std::string)> &func) { + validators_.emplace_back( + [func](std::string &inout) { + func(inout); + return std::string{}; + }, + std::string{}); + return this; +} + +CLI11_INLINE Validator *Option::get_validator(const std::string &Validator_name) { + for(auto &Validator : validators_) { + if(Validator_name == Validator.get_name()) { + return &Validator; + } + } + if((Validator_name.empty()) && (!validators_.empty())) { + return &(validators_.front()); + } + throw OptionNotFound(std::string{"Validator "} + Validator_name + " Not Found"); +} + +CLI11_INLINE Validator *Option::get_validator(int index) { + // This is an signed int so that it is not equivalent to a pointer. + if(index >= 0 && index < static_cast<int>(validators_.size())) { + return &(validators_[static_cast<decltype(validators_)::size_type>(index)]); + } + throw OptionNotFound("Validator index is not valid"); +} + +CLI11_INLINE bool Option::remove_needs(Option *opt) { + auto iterator = std::find(std::begin(needs_), std::end(needs_), opt); + + if(iterator == std::end(needs_)) { + return false; + } + needs_.erase(iterator); + return true; +} + +CLI11_INLINE Option *Option::excludes(Option *opt) { + if(opt == this) { + throw(IncorrectConstruction("and option cannot exclude itself")); + } + excludes_.insert(opt); + + // Help text should be symmetric - excluding a should exclude b + opt->excludes_.insert(this); + + // Ignoring the insert return value, excluding twice is now allowed. + // (Mostly to allow both directions to be excluded by user, even though the library does it for you.) + + return this; +} + +CLI11_INLINE bool Option::remove_excludes(Option *opt) { + auto iterator = std::find(std::begin(excludes_), std::end(excludes_), opt); + + if(iterator == std::end(excludes_)) { + return false; + } + excludes_.erase(iterator); + return true; +} + +template <typename T> Option *Option::ignore_case(bool value) { + if(!ignore_case_ && value) { + ignore_case_ = value; + auto *parent = static_cast<T *>(parent_); + for(const Option_p &opt : parent->options_) { + if(opt.get() == this) { + continue; + } + const auto &omatch = opt->matching_name(*this); + if(!omatch.empty()) { + ignore_case_ = false; + throw OptionAlreadyAdded("adding ignore case caused a name conflict with " + omatch); + } + } + } else { + ignore_case_ = value; + } + return this; +} + +template <typename T> Option *Option::ignore_underscore(bool value) { + + if(!ignore_underscore_ && value) { + ignore_underscore_ = value; + auto *parent = static_cast<T *>(parent_); + for(const Option_p &opt : parent->options_) { + if(opt.get() == this) { + continue; + } + const auto &omatch = opt->matching_name(*this); + if(!omatch.empty()) { + ignore_underscore_ = false; + throw OptionAlreadyAdded("adding ignore underscore caused a name conflict with " + omatch); + } + } + } else { + ignore_underscore_ = value; + } + return this; +} + +CLI11_INLINE Option *Option::multi_option_policy(MultiOptionPolicy value) { + if(value != multi_option_policy_) { + if(multi_option_policy_ == MultiOptionPolicy::Throw && expected_max_ == detail::expected_max_vector_size && + expected_min_ > 1) { // this bizarre condition is to maintain backwards compatibility + // with the previous behavior of expected_ with vectors + expected_max_ = expected_min_; + } + multi_option_policy_ = value; + current_option_state_ = option_state::parsing; + } + return this; +} + +CLI11_NODISCARD CLI11_INLINE std::string Option::get_name(bool positional, bool all_options) const { + if(get_group().empty()) + return {}; // Hidden + + if(all_options) { + + std::vector<std::string> name_list; + + /// The all list will never include a positional unless asked or that's the only name. + if((positional && (!pname_.empty())) || (snames_.empty() && lnames_.empty())) { + name_list.push_back(pname_); + } + if((get_items_expected() == 0) && (!fnames_.empty())) { + for(const std::string &sname : snames_) { + name_list.push_back("-" + sname); + if(check_fname(sname)) { + name_list.back() += "{" + get_flag_value(sname, "") + "}"; + } + } + + for(const std::string &lname : lnames_) { + name_list.push_back("--" + lname); + if(check_fname(lname)) { + name_list.back() += "{" + get_flag_value(lname, "") + "}"; + } + } + } else { + for(const std::string &sname : snames_) + name_list.push_back("-" + sname); + + for(const std::string &lname : lnames_) + name_list.push_back("--" + lname); + } + + return detail::join(name_list); + } + + // This returns the positional name no matter what + if(positional) + return pname_; + + // Prefer long name + if(!lnames_.empty()) + return std::string(2, '-') + lnames_[0]; + + // Or short name if no long name + if(!snames_.empty()) + return std::string(1, '-') + snames_[0]; + + // If positional is the only name, it's okay to use that + return pname_; +} + +CLI11_INLINE void Option::run_callback() { + if(force_callback_ && results_.empty()) { + add_result(default_str_); + } + if(current_option_state_ == option_state::parsing) { + _validate_results(results_); + current_option_state_ = option_state::validated; + } + + if(current_option_state_ < option_state::reduced) { + _reduce_results(proc_results_, results_); + current_option_state_ = option_state::reduced; + } + if(current_option_state_ >= option_state::reduced) { + current_option_state_ = option_state::callback_run; + if(!(callback_)) { + return; + } + const results_t &send_results = proc_results_.empty() ? results_ : proc_results_; + bool local_result = callback_(send_results); + + if(!local_result) + throw ConversionError(get_name(), results_); + } +} + +CLI11_NODISCARD CLI11_INLINE const std::string &Option::matching_name(const Option &other) const { + static const std::string estring; + for(const std::string &sname : snames_) + if(other.check_sname(sname)) + return sname; + for(const std::string &lname : lnames_) + if(other.check_lname(lname)) + return lname; + + if(ignore_case_ || + ignore_underscore_) { // We need to do the inverse, in case we are ignore_case or ignore underscore + for(const std::string &sname : other.snames_) + if(check_sname(sname)) + return sname; + for(const std::string &lname : other.lnames_) + if(check_lname(lname)) + return lname; + } + return estring; +} + +CLI11_NODISCARD CLI11_INLINE bool Option::check_name(const std::string &name) const { + + if(name.length() > 2 && name[0] == '-' && name[1] == '-') + return check_lname(name.substr(2)); + if(name.length() > 1 && name.front() == '-') + return check_sname(name.substr(1)); + if(!pname_.empty()) { + std::string local_pname = pname_; + std::string local_name = name; + if(ignore_underscore_) { + local_pname = detail::remove_underscore(local_pname); + local_name = detail::remove_underscore(local_name); + } + if(ignore_case_) { + local_pname = detail::to_lower(local_pname); + local_name = detail::to_lower(local_name); + } + if(local_name == local_pname) { + return true; + } + } + + if(!envname_.empty()) { + // this needs to be the original since envname_ shouldn't match on case insensitivity + return (name == envname_); + } + return false; +} + +CLI11_NODISCARD CLI11_INLINE std::string Option::get_flag_value(const std::string &name, + std::string input_value) const { + static const std::string trueString{"true"}; + static const std::string falseString{"false"}; + static const std::string emptyString{"{}"}; + // check for disable flag override_ + if(disable_flag_override_) { + if(!((input_value.empty()) || (input_value == emptyString))) { + auto default_ind = detail::find_member(name, fnames_, ignore_case_, ignore_underscore_); + if(default_ind >= 0) { + // We can static cast this to std::size_t because it is more than 0 in this block + if(default_flag_values_[static_cast<std::size_t>(default_ind)].second != input_value) { + throw(ArgumentMismatch::FlagOverride(name)); + } + } else { + if(input_value != trueString) { + throw(ArgumentMismatch::FlagOverride(name)); + } + } + } + } + auto ind = detail::find_member(name, fnames_, ignore_case_, ignore_underscore_); + if((input_value.empty()) || (input_value == emptyString)) { + if(flag_like_) { + return (ind < 0) ? trueString : default_flag_values_[static_cast<std::size_t>(ind)].second; + } + return (ind < 0) ? default_str_ : default_flag_values_[static_cast<std::size_t>(ind)].second; + } + if(ind < 0) { + return input_value; + } + if(default_flag_values_[static_cast<std::size_t>(ind)].second == falseString) { + try { + auto val = detail::to_flag_value(input_value); + return (val == 1) ? falseString : (val == (-1) ? trueString : std::to_string(-val)); + } catch(const std::invalid_argument &) { + return input_value; + } + } else { + return input_value; + } +} + +CLI11_INLINE Option *Option::add_result(std::string s) { + _add_result(std::move(s), results_); + current_option_state_ = option_state::parsing; + return this; +} + +CLI11_INLINE Option *Option::add_result(std::string s, int &results_added) { + results_added = _add_result(std::move(s), results_); + current_option_state_ = option_state::parsing; + return this; +} + +CLI11_INLINE Option *Option::add_result(std::vector<std::string> s) { + current_option_state_ = option_state::parsing; + for(auto &str : s) { + _add_result(std::move(str), results_); + } + return this; +} + +CLI11_NODISCARD CLI11_INLINE results_t Option::reduced_results() const { + results_t res = proc_results_.empty() ? results_ : proc_results_; + if(current_option_state_ < option_state::reduced) { + if(current_option_state_ == option_state::parsing) { + res = results_; + _validate_results(res); + } + if(!res.empty()) { + results_t extra; + _reduce_results(extra, res); + if(!extra.empty()) { + res = std::move(extra); + } + } + } + return res; +} + +CLI11_INLINE Option *Option::type_size(int option_type_size) { + if(option_type_size < 0) { + // this section is included for backwards compatibility + type_size_max_ = -option_type_size; + type_size_min_ = -option_type_size; + expected_max_ = detail::expected_max_vector_size; + } else { + type_size_max_ = option_type_size; + if(type_size_max_ < detail::expected_max_vector_size) { + type_size_min_ = option_type_size; + } else { + inject_separator_ = true; + } + if(type_size_max_ == 0) + required_ = false; + } + return this; +} + +CLI11_INLINE Option *Option::type_size(int option_type_size_min, int option_type_size_max) { + if(option_type_size_min < 0 || option_type_size_max < 0) { + // this section is included for backwards compatibility + expected_max_ = detail::expected_max_vector_size; + option_type_size_min = (std::abs)(option_type_size_min); + option_type_size_max = (std::abs)(option_type_size_max); + } + + if(option_type_size_min > option_type_size_max) { + type_size_max_ = option_type_size_min; + type_size_min_ = option_type_size_max; + } else { + type_size_min_ = option_type_size_min; + type_size_max_ = option_type_size_max; + } + if(type_size_max_ == 0) { + required_ = false; + } + if(type_size_max_ >= detail::expected_max_vector_size) { + inject_separator_ = true; + } + return this; +} + +CLI11_NODISCARD CLI11_INLINE std::string Option::get_type_name() const { + std::string full_type_name = type_name_(); + if(!validators_.empty()) { + for(const auto &Validator : validators_) { + std::string vtype = Validator.get_description(); + if(!vtype.empty()) { + full_type_name += ":" + vtype; + } + } + } + return full_type_name; +} + +CLI11_INLINE void Option::_validate_results(results_t &res) const { + // Run the Validators (can change the string) + if(!validators_.empty()) { + if(type_size_max_ > 1) { // in this context index refers to the index in the type + int index = 0; + if(get_items_expected_max() < static_cast<int>(res.size()) && + multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { + // create a negative index for the earliest ones + index = get_items_expected_max() - static_cast<int>(res.size()); + } + + for(std::string &result : res) { + if(detail::is_separator(result) && type_size_max_ != type_size_min_ && index >= 0) { + index = 0; // reset index for variable size chunks + continue; + } + auto err_msg = _validate(result, (index >= 0) ? (index % type_size_max_) : index); + if(!err_msg.empty()) + throw ValidationError(get_name(), err_msg); + ++index; + } + } else { + int index = 0; + if(expected_max_ < static_cast<int>(res.size()) && + multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { + // create a negative index for the earliest ones + index = expected_max_ - static_cast<int>(res.size()); + } + for(std::string &result : res) { + auto err_msg = _validate(result, index); + ++index; + if(!err_msg.empty()) + throw ValidationError(get_name(), err_msg); + } + } + } +} + +CLI11_INLINE void Option::_reduce_results(results_t &out, const results_t &original) const { + + // max num items expected or length of vector, always at least 1 + // Only valid for a trimming policy + + out.clear(); + // Operation depends on the policy setting + switch(multi_option_policy_) { + case MultiOptionPolicy::TakeAll: + break; + case MultiOptionPolicy::TakeLast: { + // Allow multi-option sizes (including 0) + std::size_t trim_size = std::min<std::size_t>( + static_cast<std::size_t>(std::max<int>(get_items_expected_max(), 1)), original.size()); + if(original.size() != trim_size) { + out.assign(original.end() - static_cast<results_t::difference_type>(trim_size), original.end()); + } + } break; + case MultiOptionPolicy::TakeFirst: { + std::size_t trim_size = std::min<std::size_t>( + static_cast<std::size_t>(std::max<int>(get_items_expected_max(), 1)), original.size()); + if(original.size() != trim_size) { + out.assign(original.begin(), original.begin() + static_cast<results_t::difference_type>(trim_size)); + } + } break; + case MultiOptionPolicy::Join: + if(results_.size() > 1) { + out.push_back(detail::join(original, std::string(1, (delimiter_ == '\0') ? '\n' : delimiter_))); + } + break; + case MultiOptionPolicy::Sum: + out.push_back(detail::sum_string_vector(original)); + break; + case MultiOptionPolicy::Throw: + default: { + auto num_min = static_cast<std::size_t>(get_items_expected_min()); + auto num_max = static_cast<std::size_t>(get_items_expected_max()); + if(num_min == 0) { + num_min = 1; + } + if(num_max == 0) { + num_max = 1; + } + if(original.size() < num_min) { + throw ArgumentMismatch::AtLeast(get_name(), static_cast<int>(num_min), original.size()); + } + if(original.size() > num_max) { + throw ArgumentMismatch::AtMost(get_name(), static_cast<int>(num_max), original.size()); + } + break; + } + } + // this check is to allow an empty vector in certain circumstances but not if expected is not zero. + // {} is the indicator for an empty container + if(out.empty()) { + if(original.size() == 1 && original[0] == "{}" && get_items_expected_min() > 0) { + out.push_back("{}"); + out.push_back("%%"); + } + } else if(out.size() == 1 && out[0] == "{}" && get_items_expected_min() > 0) { + out.push_back("%%"); + } +} + +CLI11_INLINE std::string Option::_validate(std::string &result, int index) const { + std::string err_msg; + if(result.empty() && expected_min_ == 0) { + // an empty with nothing expected is allowed + return err_msg; + } + for(const auto &vali : validators_) { + auto v = vali.get_application_index(); + if(v == -1 || v == index) { + try { + err_msg = vali(result); + } catch(const ValidationError &err) { + err_msg = err.what(); + } + if(!err_msg.empty()) + break; + } + } + + return err_msg; +} + +CLI11_INLINE int Option::_add_result(std::string &&result, std::vector<std::string> &res) const { + int result_count = 0; + if(allow_extra_args_ && !result.empty() && result.front() == '[' && + result.back() == ']') { // this is now a vector string likely from the default or user entry + result.pop_back(); + + for(auto &var : CLI::detail::split(result.substr(1), ',')) { + if(!var.empty()) { + result_count += _add_result(std::move(var), res); + } + } + return result_count; + } + if(delimiter_ == '\0') { + res.push_back(std::move(result)); + ++result_count; + } else { + if((result.find_first_of(delimiter_) != std::string::npos)) { + for(const auto &var : CLI::detail::split(result, delimiter_)) { + if(!var.empty()) { + res.push_back(var); + ++result_count; + } + } + } else { + res.push_back(std::move(result)); + ++result_count; + } + } + return result_count; +} +// [CLI11:option_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Split_inl.hpp b/packages/CLI11/include/CLI/impl/Split_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..03478b209bf95afaf6a8aca43a10fdcc636560a4 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Split_inl.hpp @@ -0,0 +1,139 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Split.hpp> + +// [CLI11:public_includes:set] +#include <string> +#include <tuple> +#include <utility> +#include <vector> +// [CLI11:public_includes:end] + +#include <CLI/Error.hpp> +#include <CLI/StringTools.hpp> + +namespace CLI { +// [CLI11:split_inl_hpp:verbatim] + +namespace detail { + +CLI11_INLINE bool split_short(const std::string ¤t, std::string &name, std::string &rest) { + if(current.size() > 1 && current[0] == '-' && valid_first_char(current[1])) { + name = current.substr(1, 1); + rest = current.substr(2); + return true; + } + return false; +} + +CLI11_INLINE bool split_long(const std::string ¤t, std::string &name, std::string &value) { + if(current.size() > 2 && current.substr(0, 2) == "--" && valid_first_char(current[2])) { + auto loc = current.find_first_of('='); + if(loc != std::string::npos) { + name = current.substr(2, loc - 2); + value = current.substr(loc + 1); + } else { + name = current.substr(2); + value = ""; + } + return true; + } + return false; +} + +CLI11_INLINE bool split_windows_style(const std::string ¤t, std::string &name, std::string &value) { + if(current.size() > 1 && current[0] == '/' && valid_first_char(current[1])) { + auto loc = current.find_first_of(':'); + if(loc != std::string::npos) { + name = current.substr(1, loc - 1); + value = current.substr(loc + 1); + } else { + name = current.substr(1); + value = ""; + } + return true; + } + return false; +} + +CLI11_INLINE std::vector<std::string> split_names(std::string current) { + std::vector<std::string> output; + std::size_t val = 0; + while((val = current.find(',')) != std::string::npos) { + output.push_back(trim_copy(current.substr(0, val))); + current = current.substr(val + 1); + } + output.push_back(trim_copy(current)); + return output; +} + +CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str) { + std::vector<std::string> flags = split_names(str); + flags.erase(std::remove_if(flags.begin(), + flags.end(), + [](const std::string &name) { + return ((name.empty()) || (!(((name.find_first_of('{') != std::string::npos) && + (name.back() == '}')) || + (name[0] == '!')))); + }), + flags.end()); + std::vector<std::pair<std::string, std::string>> output; + output.reserve(flags.size()); + for(auto &flag : flags) { + auto def_start = flag.find_first_of('{'); + std::string defval = "false"; + if((def_start != std::string::npos) && (flag.back() == '}')) { + defval = flag.substr(def_start + 1); + defval.pop_back(); + flag.erase(def_start, std::string::npos); // NOLINT(readability-suspicious-call-argument) + } + flag.erase(0, flag.find_first_not_of("-!")); + output.emplace_back(flag, defval); + } + return output; +} + +CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string> +get_names(const std::vector<std::string> &input) { + + std::vector<std::string> short_names; + std::vector<std::string> long_names; + std::string pos_name; + + for(std::string name : input) { + if(name.length() == 0) { + continue; + } + if(name.length() > 1 && name[0] == '-' && name[1] != '-') { + if(name.length() == 2 && valid_first_char(name[1])) + short_names.emplace_back(1, name[1]); + else + throw BadNameString::OneCharName(name); + } else if(name.length() > 2 && name.substr(0, 2) == "--") { + name = name.substr(2); + if(valid_name_string(name)) + long_names.push_back(name); + else + throw BadNameString::BadLongName(name); + } else if(name == "-" || name == "--") { + throw BadNameString::DashesOnly(name); + } else { + if(pos_name.length() > 0) + throw BadNameString::MultiPositionalNames(name); + pos_name = name; + } + } + + return std::make_tuple(short_names, long_names, pos_name); +} + +} // namespace detail +// [CLI11:split_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/StringTools_inl.hpp b/packages/CLI11/include/CLI/impl/StringTools_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a7cdd818a5f0a9053bae2f3e59cc7c77fcfea5d --- /dev/null +++ b/packages/CLI11/include/CLI/impl/StringTools_inl.hpp @@ -0,0 +1,260 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/StringTools.hpp> + +// [CLI11:public_includes:set] +#include <string> +#include <vector> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:string_tools_inl_hpp:verbatim] + +namespace detail { +CLI11_INLINE std::vector<std::string> split(const std::string &s, char delim) { + std::vector<std::string> elems; + // Check to see if empty string, give consistent result + if(s.empty()) { + elems.emplace_back(); + } else { + std::stringstream ss; + ss.str(s); + std::string item; + while(std::getline(ss, item, delim)) { + elems.push_back(item); + } + } + return elems; +} + +CLI11_INLINE std::string <rim(std::string &str) { + auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace<char>(ch, std::locale()); }); + str.erase(str.begin(), it); + return str; +} + +CLI11_INLINE std::string <rim(std::string &str, const std::string &filter) { + auto it = std::find_if(str.begin(), str.end(), [&filter](char ch) { return filter.find(ch) == std::string::npos; }); + str.erase(str.begin(), it); + return str; +} + +CLI11_INLINE std::string &rtrim(std::string &str) { + auto it = std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace<char>(ch, std::locale()); }); + str.erase(it.base(), str.end()); + return str; +} + +CLI11_INLINE std::string &rtrim(std::string &str, const std::string &filter) { + auto it = + std::find_if(str.rbegin(), str.rend(), [&filter](char ch) { return filter.find(ch) == std::string::npos; }); + str.erase(it.base(), str.end()); + return str; +} + +CLI11_INLINE std::string &remove_quotes(std::string &str) { + if(str.length() > 1 && (str.front() == '"' || str.front() == '\'')) { + if(str.front() == str.back()) { + str.pop_back(); + str.erase(str.begin(), str.begin() + 1); + } + } + return str; +} + +CLI11_INLINE std::string fix_newlines(const std::string &leader, std::string input) { + std::string::size_type n = 0; + while(n != std::string::npos && n < input.size()) { + n = input.find('\n', n); + if(n != std::string::npos) { + input = input.substr(0, n + 1) + leader + input.substr(n + 1); + n += leader.size(); + } + } + return input; +} + +CLI11_INLINE std::ostream & +format_help(std::ostream &out, std::string name, const std::string &description, std::size_t wid) { + name = " " + name; + out << std::setw(static_cast<int>(wid)) << std::left << name; + if(!description.empty()) { + if(name.length() >= wid) + out << "\n" << std::setw(static_cast<int>(wid)) << ""; + for(const char c : description) { + out.put(c); + if(c == '\n') { + out << std::setw(static_cast<int>(wid)) << ""; + } + } + } + out << "\n"; + return out; +} + +CLI11_INLINE std::ostream &format_aliases(std::ostream &out, const std::vector<std::string> &aliases, std::size_t wid) { + if(!aliases.empty()) { + out << std::setw(static_cast<int>(wid)) << " aliases: "; + bool front = true; + for(const auto &alias : aliases) { + if(!front) { + out << ", "; + } else { + front = false; + } + out << detail::fix_newlines(" ", alias); + } + out << "\n"; + } + return out; +} + +CLI11_INLINE bool valid_name_string(const std::string &str) { + if(str.empty() || !valid_first_char(str[0])) { + return false; + } + auto e = str.end(); + for(auto c = str.begin() + 1; c != e; ++c) + if(!valid_later_char(*c)) + return false; + return true; +} + +CLI11_INLINE std::string find_and_replace(std::string str, std::string from, std::string to) { + + std::size_t start_pos = 0; + + while((start_pos = str.find(from, start_pos)) != std::string::npos) { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + + return str; +} + +CLI11_INLINE void remove_default_flag_values(std::string &flags) { + auto loc = flags.find_first_of('{', 2); + while(loc != std::string::npos) { + auto finish = flags.find_first_of("},", loc + 1); + if((finish != std::string::npos) && (flags[finish] == '}')) { + flags.erase(flags.begin() + static_cast<std::ptrdiff_t>(loc), + flags.begin() + static_cast<std::ptrdiff_t>(finish) + 1); + } + loc = flags.find_first_of('{', loc + 1); + } + flags.erase(std::remove(flags.begin(), flags.end(), '!'), flags.end()); +} + +CLI11_INLINE std::ptrdiff_t +find_member(std::string name, const std::vector<std::string> names, bool ignore_case, bool ignore_underscore) { + auto it = std::end(names); + if(ignore_case) { + if(ignore_underscore) { + name = detail::to_lower(detail::remove_underscore(name)); + it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { + return detail::to_lower(detail::remove_underscore(local_name)) == name; + }); + } else { + name = detail::to_lower(name); + it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { + return detail::to_lower(local_name) == name; + }); + } + + } else if(ignore_underscore) { + name = detail::remove_underscore(name); + it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { + return detail::remove_underscore(local_name) == name; + }); + } else { + it = std::find(std::begin(names), std::end(names), name); + } + + return (it != std::end(names)) ? (it - std::begin(names)) : (-1); +} + +CLI11_INLINE std::vector<std::string> split_up(std::string str, char delimiter) { + + const std::string delims("\'\"`"); + auto find_ws = [delimiter](char ch) { + return (delimiter == '\0') ? std::isspace<char>(ch, std::locale()) : (ch == delimiter); + }; + trim(str); + + std::vector<std::string> output; + bool embeddedQuote = false; + char keyChar = ' '; + while(!str.empty()) { + if(delims.find_first_of(str[0]) != std::string::npos) { + keyChar = str[0]; + auto end = str.find_first_of(keyChar, 1); + while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes + end = str.find_first_of(keyChar, end + 1); + embeddedQuote = true; + } + if(end != std::string::npos) { + output.push_back(str.substr(1, end - 1)); + if(end + 2 < str.size()) { + str = str.substr(end + 2); + } else { + str.clear(); + } + + } else { + output.push_back(str.substr(1)); + str = ""; + } + } else { + auto it = std::find_if(std::begin(str), std::end(str), find_ws); + if(it != std::end(str)) { + std::string value = std::string(str.begin(), it); + output.push_back(value); + str = std::string(it + 1, str.end()); + } else { + output.push_back(str); + str = ""; + } + } + // transform any embedded quotes into the regular character + if(embeddedQuote) { + output.back() = find_and_replace(output.back(), std::string("\\") + keyChar, std::string(1, keyChar)); + embeddedQuote = false; + } + trim(str); + } + return output; +} + +CLI11_INLINE std::size_t escape_detect(std::string &str, std::size_t offset) { + auto next = str[offset + 1]; + if((next == '\"') || (next == '\'') || (next == '`')) { + auto astart = str.find_last_of("-/ \"\'`", offset - 1); + if(astart != std::string::npos) { + if(str[astart] == ((str[offset] == '=') ? '-' : '/')) + str[offset] = ' '; // interpret this as a space so the split_up works properly + } + } + return offset + 1; +} + +CLI11_INLINE std::string &add_quotes_if_needed(std::string &str) { + if((str.front() != '"' && str.front() != '\'') || str.front() != str.back()) { + char quote = str.find('"') < str.find('\'') ? '\'' : '"'; + if(str.find(' ') != std::string::npos) { + str.insert(0, 1, quote); + str.append(1, quote); + } + } + return str; +} + +} // namespace detail +// [CLI11:string_tools_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Validators_inl.hpp b/packages/CLI11/include/CLI/impl/Validators_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f2fe5e55de7258ef29535d0b6339221c41572641 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Validators_inl.hpp @@ -0,0 +1,346 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +#include <CLI/Validators.hpp> + +#include <CLI/Macros.hpp> +#include <CLI/StringTools.hpp> +#include <CLI/TypeTools.hpp> + +// [CLI11:public_includes:set] +#include <map> +#include <string> +#include <utility> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:validators_inl_hpp:verbatim] + +CLI11_INLINE std::string Validator::operator()(std::string &str) const { + std::string retstring; + if(active_) { + if(non_modifying_) { + std::string value = str; + retstring = func_(value); + } else { + retstring = func_(str); + } + } + return retstring; +} + +CLI11_NODISCARD CLI11_INLINE Validator Validator::description(std::string validator_desc) const { + Validator newval(*this); + newval.desc_function_ = [validator_desc]() { return validator_desc; }; + return newval; +} + +CLI11_INLINE Validator Validator::operator&(const Validator &other) const { + Validator newval; + + newval._merge_description(*this, other, " AND "); + + // Give references (will make a copy in lambda function) + const std::function<std::string(std::string & filename)> &f1 = func_; + const std::function<std::string(std::string & filename)> &f2 = other.func_; + + newval.func_ = [f1, f2](std::string &input) { + std::string s1 = f1(input); + std::string s2 = f2(input); + if(!s1.empty() && !s2.empty()) + return std::string("(") + s1 + ") AND (" + s2 + ")"; + return s1 + s2; + }; + + newval.active_ = active_ && other.active_; + newval.application_index_ = application_index_; + return newval; +} + +CLI11_INLINE Validator Validator::operator|(const Validator &other) const { + Validator newval; + + newval._merge_description(*this, other, " OR "); + + // Give references (will make a copy in lambda function) + const std::function<std::string(std::string &)> &f1 = func_; + const std::function<std::string(std::string &)> &f2 = other.func_; + + newval.func_ = [f1, f2](std::string &input) { + std::string s1 = f1(input); + std::string s2 = f2(input); + if(s1.empty() || s2.empty()) + return std::string(); + + return std::string("(") + s1 + ") OR (" + s2 + ")"; + }; + newval.active_ = active_ && other.active_; + newval.application_index_ = application_index_; + return newval; +} + +CLI11_INLINE Validator Validator::operator!() const { + Validator newval; + const std::function<std::string()> &dfunc1 = desc_function_; + newval.desc_function_ = [dfunc1]() { + auto str = dfunc1(); + return (!str.empty()) ? std::string("NOT ") + str : std::string{}; + }; + // Give references (will make a copy in lambda function) + const std::function<std::string(std::string & res)> &f1 = func_; + + newval.func_ = [f1, dfunc1](std::string &test) -> std::string { + std::string s1 = f1(test); + if(s1.empty()) { + return std::string("check ") + dfunc1() + " succeeded improperly"; + } + return std::string{}; + }; + newval.active_ = active_; + newval.application_index_ = application_index_; + return newval; +} + +CLI11_INLINE void +Validator::_merge_description(const Validator &val1, const Validator &val2, const std::string &merger) { + + const std::function<std::string()> &dfunc1 = val1.desc_function_; + const std::function<std::string()> &dfunc2 = val2.desc_function_; + + desc_function_ = [=]() { + std::string f1 = dfunc1(); + std::string f2 = dfunc2(); + if((f1.empty()) || (f2.empty())) { + return f1 + f2; + } + return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')'; + }; +} + +namespace detail { + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +CLI11_INLINE path_type check_path(const char *file) noexcept { + std::error_code ec; + auto stat = std::filesystem::status(file, ec); + if(ec) { + return path_type::nonexistent; + } + switch(stat.type()) { + case std::filesystem::file_type::none: + case std::filesystem::file_type::not_found: + return path_type::nonexistent; + case std::filesystem::file_type::directory: + return path_type::directory; + case std::filesystem::file_type::symlink: + case std::filesystem::file_type::block: + case std::filesystem::file_type::character: + case std::filesystem::file_type::fifo: + case std::filesystem::file_type::socket: + case std::filesystem::file_type::regular: + case std::filesystem::file_type::unknown: + default: + return path_type::file; + } +} +#else +CLI11_INLINE path_type check_path(const char *file) noexcept { +#if defined(_MSC_VER) + struct __stat64 buffer; + if(_stat64(file, &buffer) == 0) { + return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file; + } +#else + struct stat buffer; + if(stat(file, &buffer) == 0) { + return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file; + } +#endif + return path_type::nonexistent; +} +#endif + +CLI11_INLINE ExistingFileValidator::ExistingFileValidator() : Validator("FILE") { + func_ = [](std::string &filename) { + auto path_result = check_path(filename.c_str()); + if(path_result == path_type::nonexistent) { + return "File does not exist: " + filename; + } + if(path_result == path_type::directory) { + return "File is actually a directory: " + filename; + } + return std::string(); + }; +} + +CLI11_INLINE ExistingDirectoryValidator::ExistingDirectoryValidator() : Validator("DIR") { + func_ = [](std::string &filename) { + auto path_result = check_path(filename.c_str()); + if(path_result == path_type::nonexistent) { + return "Directory does not exist: " + filename; + } + if(path_result == path_type::file) { + return "Directory is actually a file: " + filename; + } + return std::string(); + }; +} + +CLI11_INLINE ExistingPathValidator::ExistingPathValidator() : Validator("PATH(existing)") { + func_ = [](std::string &filename) { + auto path_result = check_path(filename.c_str()); + if(path_result == path_type::nonexistent) { + return "Path does not exist: " + filename; + } + return std::string(); + }; +} + +CLI11_INLINE NonexistentPathValidator::NonexistentPathValidator() : Validator("PATH(non-existing)") { + func_ = [](std::string &filename) { + auto path_result = check_path(filename.c_str()); + if(path_result != path_type::nonexistent) { + return "Path already exists: " + filename; + } + return std::string(); + }; +} + +CLI11_INLINE IPV4Validator::IPV4Validator() : Validator("IPV4") { + func_ = [](std::string &ip_addr) { + auto result = CLI::detail::split(ip_addr, '.'); + if(result.size() != 4) { + return std::string("Invalid IPV4 address must have four parts (") + ip_addr + ')'; + } + int num = 0; + for(const auto &var : result) { + bool retval = detail::lexical_cast(var, num); + if(!retval) { + return std::string("Failed parsing number (") + var + ')'; + } + if(num < 0 || num > 255) { + return std::string("Each IP number must be between 0 and 255 ") + var; + } + } + return std::string(); + }; +} + +} // namespace detail + +CLI11_INLINE FileOnDefaultPath::FileOnDefaultPath(std::string default_path, bool enableErrorReturn) + : Validator("FILE") { + func_ = [default_path, enableErrorReturn](std::string &filename) { + auto path_result = detail::check_path(filename.c_str()); + if(path_result == detail::path_type::nonexistent) { + std::string test_file_path = default_path; + if(default_path.back() != '/' && default_path.back() != '\\') { + // Add folder separator + test_file_path += '/'; + } + test_file_path.append(filename); + path_result = detail::check_path(test_file_path.c_str()); + if(path_result == detail::path_type::file) { + filename = test_file_path; + } else { + if(enableErrorReturn) { + return "File does not exist: " + filename; + } + } + } + return std::string{}; + }; +} + +CLI11_INLINE AsSizeValue::AsSizeValue(bool kb_is_1000) : AsNumberWithUnit(get_mapping(kb_is_1000)) { + if(kb_is_1000) { + description("SIZE [b, kb(=1000b), kib(=1024b), ...]"); + } else { + description("SIZE [b, kb(=1024b), ...]"); + } +} + +CLI11_INLINE std::map<std::string, AsSizeValue::result_t> AsSizeValue::init_mapping(bool kb_is_1000) { + std::map<std::string, result_t> m; + result_t k_factor = kb_is_1000 ? 1000 : 1024; + result_t ki_factor = 1024; + result_t k = 1; + result_t ki = 1; + m["b"] = 1; + for(std::string p : {"k", "m", "g", "t", "p", "e"}) { + k *= k_factor; + ki *= ki_factor; + m[p] = k; + m[p + "b"] = k; + m[p + "i"] = ki; + m[p + "ib"] = ki; + } + return m; +} + +CLI11_INLINE std::map<std::string, AsSizeValue::result_t> AsSizeValue::get_mapping(bool kb_is_1000) { + if(kb_is_1000) { + static auto m = init_mapping(true); + return m; + } + static auto m = init_mapping(false); + return m; +} + +namespace detail { + +CLI11_INLINE std::pair<std::string, std::string> split_program_name(std::string commandline) { + // try to determine the programName + std::pair<std::string, std::string> vals; + trim(commandline); + auto esp = commandline.find_first_of(' ', 1); + while(detail::check_path(commandline.substr(0, esp).c_str()) != path_type::file) { + esp = commandline.find_first_of(' ', esp + 1); + if(esp == std::string::npos) { + // if we have reached the end and haven't found a valid file just assume the first argument is the + // program name + if(commandline[0] == '"' || commandline[0] == '\'' || commandline[0] == '`') { + bool embeddedQuote = false; + auto keyChar = commandline[0]; + auto end = commandline.find_first_of(keyChar, 1); + while((end != std::string::npos) && (commandline[end - 1] == '\\')) { // deal with escaped quotes + end = commandline.find_first_of(keyChar, end + 1); + embeddedQuote = true; + } + if(end != std::string::npos) { + vals.first = commandline.substr(1, end - 1); + esp = end + 1; + if(embeddedQuote) { + vals.first = find_and_replace(vals.first, std::string("\\") + keyChar, std::string(1, keyChar)); + } + } else { + esp = commandline.find_first_of(' ', 1); + } + } else { + esp = commandline.find_first_of(' ', 1); + } + + break; + } + } + if(vals.first.empty()) { + vals.first = commandline.substr(0, esp); + rtrim(vals.first); + } + + // strip the program name + vals.second = (esp < commandline.length() - 1) ? commandline.substr(esp + 1) : std::string{}; + ltrim(vals.second); + return vals; +} + +} // namespace detail +/// @} + +// [CLI11:validators_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/meson.build b/packages/CLI11/meson.build index 8b36c2a777f4e16f8f693b2de44c4f74001705b7..c0de945e21ce48bfd9b0bb8dbe417134938853fb 100644 --- a/packages/CLI11/meson.build +++ b/packages/CLI11/meson.build @@ -1,11 +1,23 @@ project('CLI11', ['cpp'], - version : run_command(find_program('scripts/ExtractVersion.py')).stdout().strip(), - default_options : ['cpp_std=c++11'] + version : run_command(find_program('scripts/ExtractVersion.py'), check: true).stdout().strip(), + default_options : ['cpp_std=c++11', 'warning_level=3'] ) +cxx = meson.get_compiler('cpp') + CLI11_inc = include_directories(['include']) CLI11_dep = declare_dependency( include_directories : CLI11_inc, version : meson.project_version(), ) + +if get_option('tests') + warnings = ['-Wshadow', '-Wsign-conversion', '-Wswitch-enum'] + if cxx.get_id() == 'gcc' and cxx.version().version_compare('>=4.9') + warnings += '-Weffc++' + endif + add_project_arguments(cxx.get_supported_arguments(warnings), language: 'cpp') + + subdir('tests') +endif diff --git a/packages/CLI11/meson_options.txt b/packages/CLI11/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd4654d484f5f0a35839cf5459a5e7f773be4d23 --- /dev/null +++ b/packages/CLI11/meson_options.txt @@ -0,0 +1 @@ +option('tests', type: 'boolean', value: false, description: 'Build CLI11 tests') diff --git a/packages/CLI11/scripts/MakeSingleHeader.py b/packages/CLI11/scripts/MakeSingleHeader.py index 42e0ee7a9c590ae27614d5e77db2c9459170438b..4bc53dd1509d144e5255434cab7e8056a00d8c8d 100755 --- a/packages/CLI11/scripts/MakeSingleHeader.py +++ b/packages/CLI11/scripts/MakeSingleHeader.py @@ -4,7 +4,7 @@ from __future__ import print_function, unicode_literals import os import re -from argparse import ArgumentParser +import argparse from subprocess import Popen, PIPE import warnings @@ -115,6 +115,9 @@ def make_header(output, main_header, files, tag, namespace, macro=None, version= print("Converting macros", before, "->", after) single_header.replace(before, after) + new_namespace = namespace + "::" + single_header = re.sub(r"\bCLI::\b", new_namespace, single_header) + if output is not None: with open(output, "w") as f: f.write(single_header) @@ -125,8 +128,9 @@ def make_header(output, main_header, files, tag, namespace, macro=None, version= if __name__ == "__main__": - parser = ArgumentParser( - usage="Convert source to single header include. Can optionally add namespace and search-replace replacements (for macros)." + parser = argparse.ArgumentParser( + usage="Convert source to single header include. Can optionally add namespace and search-replace replacements (for macros).", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument("--output", default=None, help="Single header file output") parser.add_argument( @@ -134,7 +138,7 @@ if __name__ == "__main__": default="CLI11.hpp.in", help="The main include file that defines the other files", ) - parser.add_argument("files", nargs="*", help="The header files") + parser.add_argument("files", nargs="+", help="The header files") parser.add_argument("--namespace", default="CLI", help="Set the namespace") parser.add_argument("--tag", default="CLI11", help="Tag to look up") parser.add_argument( diff --git a/packages/CLI11/src/CMakeLists.txt b/packages/CLI11/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..341cae42c5233649106f11d55557af4d938d6b70 --- /dev/null +++ b/packages/CLI11/src/CMakeLists.txt @@ -0,0 +1,120 @@ +set(CLI11_headerLoc "${PROJECT_SOURCE_DIR}/include/CLI") + +set(CLI11_headers + ${CLI11_headerLoc}/App.hpp + ${CLI11_headerLoc}/CLI.hpp + ${CLI11_headerLoc}/Config.hpp + ${CLI11_headerLoc}/ConfigFwd.hpp + ${CLI11_headerLoc}/Error.hpp + ${CLI11_headerLoc}/Formatter.hpp + ${CLI11_headerLoc}/FormatterFwd.hpp + ${CLI11_headerLoc}/Macros.hpp + ${CLI11_headerLoc}/Option.hpp + ${CLI11_headerLoc}/Split.hpp + ${CLI11_headerLoc}/StringTools.hpp + ${CLI11_headerLoc}/Timer.hpp + ${CLI11_headerLoc}/TypeTools.hpp + ${CLI11_headerLoc}/Validators.hpp + ${CLI11_headerLoc}/Version.hpp) + +set(CLI11_implLoc "${PROJECT_SOURCE_DIR}/include/CLI/impl") + +set(CLI11_impl_headers + ${CLI11_implLoc}/App_inl.hpp + ${CLI11_implLoc}/Config_inl.hpp + ${CLI11_implLoc}/Formatter_inl.hpp + ${CLI11_implLoc}/Option_inl.hpp + ${CLI11_implLoc}/Split_inl.hpp + ${CLI11_implLoc}/StringTools_inl.hpp + ${CLI11_implLoc}/Validators_inl.hpp) + +if(CLI11_PRECOMPILED) + # Create static lib + file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp") + add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_impl_headers} ${CLI11_precompile_sources}) + target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE) + + set(PUBLIC_OR_INTERFACE PUBLIC) +else() + add_library(CLI11 INTERFACE) + if(CMAKE_VERSION VERSION_GREATER 3.19) + # This is only useful for visual studio and other IDE builds + target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_impl_headers}) + endif() + + set(PUBLIC_OR_INTERFACE INTERFACE) +endif() + +# Allow IDE's to group targets into folders +add_library(CLI11::CLI11 ALIAS CLI11) # for add_subdirectory calls + +# Duplicated because CMake adds the current source dir if you don't. +target_include_directories( + CLI11 ${PUBLIC_OR_INTERFACE} $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> + $<INSTALL_INTERFACE:include>) + +if(CMAKE_VERSION VERSION_LESS 3.8) + # This might not be a complete list + target_compile_features( + CLI11 + INTERFACE cxx_lambdas + cxx_nullptr + cxx_override + cxx_range_for + cxx_right_angle_brackets + cxx_strong_enums + cxx_constexpr + cxx_auto_type) +else() + target_compile_features(CLI11 INTERFACE cxx_std_11) +endif() + +if(CLI11_SINGLE_FILE) + # Single file test + if(CMAKE_VERSION VERSION_LESS 3.12) + find_package(PythonInterp REQUIRED) + add_executable(Python::Interpreter IMPORTED) + set_target_properties(Python::Interpreter PROPERTIES IMPORTED_LOCATION "${PYTHON_EXECUTABLE}" + VERSION "${PYTHON_VERSION_STRING}") + else() + find_package( + Python + COMPONENTS Interpreter + REQUIRED) + endif() + + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include") + add_custom_command( + OUTPUT "${PROJECT_BINARY_DIR}/include/CLI11.hpp" + COMMAND + Python::Interpreter "${PROJECT_SOURCE_DIR}/scripts/MakeSingleHeader.py" ${CLI11_headers} + ${CLI11_impl_headers} --main "${PROJECT_SOURCE_DIR}/CLI11.hpp.in" --output + "${PROJECT_BINARY_DIR}/include/CLI11.hpp" --version "${CLI11_VERSION}" + DEPENDS "${PROJECT_SOURCE_DIR}/include/CLI/CLI.hpp" ${CLI11_headers} ${CLI11_impl_headers}) + add_custom_target(CLI11-generate-single-file ALL + DEPENDS "${PROJECT_BINARY_DIR}/include/CLI11.hpp") + set_property(TARGET CLI11-generate-single-file PROPERTY FOLDER "Scripts") + if(CLI11_INSTALL) + install(FILES "${PROJECT_BINARY_DIR}/include/CLI11.hpp" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + endif() + add_library(CLI11_SINGLE INTERFACE) + target_link_libraries(CLI11_SINGLE INTERFACE CLI11) + add_dependencies(CLI11_SINGLE CLI11-generate-single-file) + target_compile_definitions(CLI11_SINGLE INTERFACE -DCLI11_SINGLE_FILE) + target_include_directories( + CLI11_SINGLE INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) +endif() + +if(CLI11_INSTALL) + + # Make an export target + install(TARGETS CLI11 EXPORT CLI11Targets) + if(NOT CLI11_SINGLE_FILE) + install(FILES ${CLI11_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI") + if(NOT CLI11_COMPILE) + install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl") + endif() + endif() +endif() diff --git a/packages/CLI11/src/Precompile.cpp b/packages/CLI11/src/Precompile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..81900ced37e7edf8a5f37bc37aeac659e1946944 --- /dev/null +++ b/packages/CLI11/src/Precompile.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include <CLI/impl/App_inl.hpp> +#include <CLI/impl/Config_inl.hpp> +#include <CLI/impl/Formatter_inl.hpp> +#include <CLI/impl/Option_inl.hpp> +#include <CLI/impl/Split_inl.hpp> +#include <CLI/impl/StringTools_inl.hpp> +#include <CLI/impl/Validators_inl.hpp> diff --git a/packages/CLI11/subprojects/catch2.wrap b/packages/CLI11/subprojects/catch2.wrap new file mode 100644 index 0000000000000000000000000000000000000000..ce0b2a992165a48341037fcde9d52d7782da1844 --- /dev/null +++ b/packages/CLI11/subprojects/catch2.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = Catch2-2.13.7 +source_url = https://github.com/catchorg/Catch2/archive/v2.13.7.zip +source_filename = Catch2-2.13.7.zip +source_hash = 3f3ccd90ad3a8fbb1beeb15e6db440ccdcbebe378dfd125d07a1f9a587a927e9 +patch_filename = catch2_2.13.7-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/catch2_2.13.7-1/get_patch +patch_hash = 2f7369645d747e5bd866317ac1dd4c3d04dc97d3aad4fc6b864bdf75d3b57158 + +[provide] +catch2 = catch2_dep diff --git a/packages/CLI11/tests/AppTest.cpp b/packages/CLI11/tests/AppTest.cpp index d425b414c08fcd287f07a9030810614f7b8292f5..994c890ca5a605fb58f657f5ff656b426bf398a1 100644 --- a/packages/CLI11/tests/AppTest.cpp +++ b/packages/CLI11/tests/AppTest.cpp @@ -1,10 +1,12 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // // SPDX-License-Identifier: BSD-3-Clause #include "app_helper.hpp" +#include <cmath> + #include <complex> #include <cstdint> #include <cstdlib> @@ -30,10 +32,10 @@ TEST_CASE_METHOD(TApp, "OneFlagShortValues", "[app]") { } TEST_CASE_METHOD(TApp, "OneFlagShortValuesAs", "[app]") { - auto flg = app.add_flag("-c{1},--count{2}"); + auto *flg = app.add_flag("-c{1},--count{2}"); args = {"-c"}; run(); - auto opt = app["-c"]; + const auto *opt = app["-c"]; CHECK(1 == opt->as<int>()); args = {"--count"}; run(); @@ -68,8 +70,8 @@ TEST_CASE_METHOD(TApp, "OneFlagShortWindows", "[app]") { TEST_CASE_METHOD(TApp, "WindowsLongShortMix1", "[app]") { app.allow_windows_style_options(); - auto a = app.add_flag("-c"); - auto b = app.add_flag("--c"); + auto *a = app.add_flag("-c"); + auto *b = app.add_flag("--c"); args = {"/c"}; run(); CHECK(a->count() == 1u); @@ -79,8 +81,8 @@ TEST_CASE_METHOD(TApp, "WindowsLongShortMix1", "[app]") { TEST_CASE_METHOD(TApp, "WindowsLongShortMix2", "[app]") { app.allow_windows_style_options(); - auto a = app.add_flag("--c"); - auto b = app.add_flag("-c"); + auto *a = app.add_flag("--c"); + auto *b = app.add_flag("-c"); args = {"/c"}; run(); CHECK(a->count() == 1u); @@ -160,7 +162,7 @@ TEST_CASE_METHOD(TApp, "RequireOptionsError", "[app]") { TEST_CASE_METHOD(TApp, "BoolFlagOverride", "[app]") { bool val{false}; - auto flg = app.add_flag("--this,--that", val); + auto *flg = app.add_flag("--this,--that", val); app.parse("--this"); CHECK(val); @@ -200,7 +202,7 @@ TEST_CASE_METHOD(TApp, "OneFlagRefValue", "[app]") { TEST_CASE_METHOD(TApp, "OneFlagRefValueFalse", "[app]") { int ref{0}; - auto flg = app.add_flag("-c,--count", ref); + auto *flg = app.add_flag("-c,--count", ref); args = {"--count=false"}; run(); CHECK(app.count("-c") == 1u); @@ -212,7 +214,7 @@ TEST_CASE_METHOD(TApp, "OneFlagRefValueFalse", "[app]") { run(); CHECK(app.count("-c") == 1u); CHECK(app.count("--count") == 1u); - CHECK(ref == -1); + CHECK(ref == 0); args = {"--count=happy"}; CHECK_THROWS_AS(run(), CLI::ConversionError); @@ -220,7 +222,7 @@ TEST_CASE_METHOD(TApp, "OneFlagRefValueFalse", "[app]") { TEST_CASE_METHOD(TApp, "FlagNegation", "[app]") { int ref{0}; - auto flg = app.add_flag("-c,--count,--ncount{false}", ref); + auto *flg = app.add_flag("-c,--count,--ncount{false}", ref); args = {"--count", "-c", "--ncount"}; CHECK(!flg->check_fname("count")); CHECK(flg->check_fname("ncount")); @@ -437,7 +439,7 @@ TEST_CASE_METHOD(TApp, "OneStringFlagLike", "[app]") { TEST_CASE_METHOD(TApp, "OneIntFlagLike", "[app]") { int val{0}; - auto opt = app.add_option("-i", val)->expected(0, 1); + auto *opt = app.add_option("-i", val)->expected(0, 1); args = {"-i"}; run(); CHECK(app.count("-i") == 1u); @@ -534,7 +536,7 @@ TEST_CASE_METHOD(TApp, "NumberFlags", "[app]") { TEST_CASE_METHOD(TApp, "DisableFlagOverrideTest", "[app]") { int val{0}; - auto opt = app.add_flag("--1{1},--2{2},--3{3},--4{4},--5{5},--6{6}, --7{7}, --8{8}, --9{9}", val); + auto *opt = app.add_flag("--1{1},--2{2},--3{3},--4{4},--5{5},--6{6}, --7{7}, --8{8}, --9{9}", val); CHECK(!opt->get_disable_flag_override()); opt->disable_flag_override(); args = {"--7=5"}; @@ -609,7 +611,7 @@ TEST_CASE_METHOD(TApp, "StrangeOptionNames", "[app]") { TEST_CASE_METHOD(TApp, "FlagLikeOption", "[app]") { bool val{false}; - auto opt = app.add_option("--flag", val)->type_size(0)->default_str("true"); + auto *opt = app.add_option("--flag", val)->type_size(0)->default_str("true"); args = {"--flag"}; run(); CHECK(app.count("--flag") == 1u); @@ -625,7 +627,7 @@ TEST_CASE_METHOD(TApp, "FlagLikeOption", "[app]") { TEST_CASE_METHOD(TApp, "FlagLikeIntOption", "[app]") { int val{-47}; - auto opt = app.add_option("--flag", val)->expected(0, 1); + auto *opt = app.add_option("--flag", val)->expected(0, 1); // normally some default value should be set, but this test is for some paths in the validators checks to skip // validation on empty string if nothing is expected opt->check(CLI::PositiveNumber); @@ -678,7 +680,7 @@ TEST_CASE_METHOD(TApp, "ShortOpts", "[app]") { TEST_CASE_METHOD(TApp, "TwoParamTemplateOpts", "[app]") { double funnyint{0.0}; - auto opt = app.add_option<double, unsigned int>("-y", funnyint); + auto *opt = app.add_option<double, unsigned int>("-y", funnyint); args = {"-y", "32"}; @@ -774,6 +776,42 @@ TEST_CASE_METHOD(TApp, "JoinOpt", "[app]") { CHECK("one\ntwo" == str); } +TEST_CASE_METHOD(TApp, "SumOpt", "[app]") { + + int val = 0; + app.add_option("--val", val)->multi_option_policy(CLI::MultiOptionPolicy::Sum); + + args = {"--val=1", "--val=4"}; + + run(); + + CHECK(5 == val); +} + +TEST_CASE_METHOD(TApp, "SumOptFloat", "[app]") { + + double val = NAN; + app.add_option("--val", val)->multi_option_policy(CLI::MultiOptionPolicy::Sum); + + args = {"--val=1.3", "--val=-0.7"}; + + run(); + + CHECK(0.6 == val); +} + +TEST_CASE_METHOD(TApp, "SumOptString", "[app]") { + + std::string val; + app.add_option("--val", val)->multi_option_policy(CLI::MultiOptionPolicy::Sum); + + args = {"--val=i", "--val=2"}; + + run(); + + CHECK("i2" == val); +} + TEST_CASE_METHOD(TApp, "JoinOpt2", "[app]") { std::string str; @@ -810,7 +848,7 @@ TEST_CASE_METHOD(TApp, "TakeLastOptMulti_alternative_path", "[app]") { TEST_CASE_METHOD(TApp, "TakeLastOptMultiCheck", "[app]") { std::vector<int> vals; - auto opt = app.add_option("--long", vals)->expected(-2)->take_last(); + auto *opt = app.add_option("--long", vals)->expected(-2)->take_last(); opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0)); opt->check((!CLI::PositiveNumber).application_index(1)); @@ -939,6 +977,35 @@ TEST_CASE_METHOD(TApp, "RequiredOptsDouble", "[app]") { CHECK(std::vector<std::string>({"one", "two"}) == strs); } +TEST_CASE_METHOD(TApp, "emptyVectorReturn", "[app]") { + + std::vector<std::string> strs; + std::vector<std::string> strs2; + auto *opt1 = app.add_option("--str", strs)->required()->expected(0, 2); + app.add_option("--str2", strs2); + args = {"--str"}; + + CHECK_NOTHROW(run()); + CHECK(std::vector<std::string>({""}) == strs); + args = {"--str", "one", "two"}; + + run(); + + CHECK(std::vector<std::string>({"one", "two"}) == strs); + + args = {"--str", "{}", "--str2", "{}"}; + + run(); + + CHECK(strs.empty()); + CHECK(std::vector<std::string>{"{}"} == strs2); + opt1->default_str("{}"); + args = {"--str"}; + + CHECK_NOTHROW(run()); + CHECK(strs.empty()); +} + TEST_CASE_METHOD(TApp, "RequiredOptsDoubleShort", "[app]") { std::vector<std::string> strs; @@ -1031,7 +1098,7 @@ TEST_CASE_METHOD(TApp, "RequiredPositionals", "[app]") { sources.clear(); run(); - CHECK(0u == sources.size()); + CHECK(sources.empty()); CHECK("a" == dest); } @@ -1065,7 +1132,7 @@ TEST_CASE_METHOD(TApp, "RequiredPositionalVector", "[app]") { // Tests positionals at end TEST_CASE_METHOD(TApp, "RequiredPositionalValidation", "[app]") { std::vector<std::string> sources; - int dest; // required + int dest = 0; // required std::string d2; app.add_option("src", sources); app.add_option("dest", dest)->required()->check(CLI::PositiveNumber); @@ -1149,10 +1216,10 @@ TEST_CASE_METHOD(TApp, "RequiredOptsUnlimited", "[app]") { app.allow_extras(false); std::vector<std::string> remain; - auto popt = app.add_option("positional", remain); + auto *popt = app.add_option("positional", remain); run(); CHECK(std::vector<std::string>({"one", "two"}) == strs); - CHECK(std::vector<std::string>() == remain); + CHECK(remain.empty()); args = {"--str", "one", "--", "two"}; @@ -1200,7 +1267,7 @@ TEST_CASE_METHOD(TApp, "RequiredOptsUnlimitedShort", "[app]") { app.add_option("positional", remain); run(); CHECK(std::vector<std::string>({"one", "two"}) == strs); - CHECK(std::vector<std::string>() == remain); + CHECK(remain.empty()); args = {"-s", "one", "--", "two"}; @@ -1427,7 +1494,7 @@ TEST_CASE_METHOD(TApp, "Positionals", "[app]") { TEST_CASE_METHOD(TApp, "ForcedPositional", "[app]") { std::vector<std::string> posit; - auto one = app.add_flag("--one"); + auto *one = app.add_flag("--one"); app.add_option("posit", posit); args = {"--one", "two", "three"}; @@ -1476,6 +1543,34 @@ TEST_CASE_METHOD(TApp, "BigPositional", "[app]") { CHECK(vec == args); } +TEST_CASE_METHOD(TApp, "VectorArgAndPositional", "[app]") { + std::vector<std::string> vec; + std::vector<int> ivec; + app.add_option("pos", vec); + app.add_option("--args", ivec)->check(CLI::Number); + app.validate_optional_arguments(); + args = {"one"}; + + run(); + CHECK(vec == args); + + args = {"--args", "1", "2"}; + + run(); + CHECK(ivec.size() == 2); + vec.clear(); + ivec.clear(); + + args = {"--args", "1", "2", "one", "two"}; + run(); + + CHECK(vec.size() == 2); + CHECK(ivec.size() == 2); + + app.validate_optional_arguments(false); + CHECK_THROWS(run()); +} + TEST_CASE_METHOD(TApp, "Reset", "[app]") { app.add_flag("--simple"); @@ -1504,7 +1599,7 @@ TEST_CASE_METHOD(TApp, "Reset", "[app]") { TEST_CASE_METHOD(TApp, "RemoveOption", "[app]") { app.add_flag("--one"); - auto opt = app.add_flag("--two"); + auto *opt = app.add_flag("--two"); CHECK(app.remove_option(opt)); CHECK(!app.remove_option(opt)); @@ -1515,8 +1610,8 @@ TEST_CASE_METHOD(TApp, "RemoveOption", "[app]") { } TEST_CASE_METHOD(TApp, "RemoveNeedsLinks", "[app]") { - auto one = app.add_flag("--one"); - auto two = app.add_flag("--two"); + auto *one = app.add_flag("--one"); + auto *two = app.add_flag("--two"); two->needs(one); one->needs(two); @@ -1529,8 +1624,8 @@ TEST_CASE_METHOD(TApp, "RemoveNeedsLinks", "[app]") { } TEST_CASE_METHOD(TApp, "RemoveExcludesLinks", "[app]") { - auto one = app.add_flag("--one"); - auto two = app.add_flag("--two"); + auto *one = app.add_flag("--one"); + auto *two = app.add_flag("--two"); two->excludes(one); one->excludes(two); @@ -1547,7 +1642,7 @@ TEST_CASE_METHOD(TApp, "FileNotExists", "[app]") { REQUIRE_NOTHROW(CLI::NonexistentPath(myfile)); std::string filename; - auto opt = app.add_option("--file", filename)->check(CLI::NonexistentPath, "path_check"); + auto *opt = app.add_option("--file", filename)->check(CLI::NonexistentPath, "path_check"); args = {"--file", myfile}; run(); @@ -1603,15 +1698,15 @@ TEST_CASE_METHOD(TApp, "NotFileExists", "[app]") { TEST_CASE_METHOD(TApp, "DefaultedResult", "[app]") { std::string sval = "NA"; int ival{0}; - auto opts = app.add_option("--string", sval)->capture_default_str(); - auto optv = app.add_option("--val", ival); + auto *opts = app.add_option("--string", sval)->capture_default_str(); + auto *optv = app.add_option("--val", ival); args = {}; run(); CHECK("NA" == sval); std::string nString; opts->results(nString); CHECK("NA" == nString); - int newIval; + int newIval = 0; // CHECK_THROWS_AS (optv->results(newIval), CLI::ConversionError); optv->default_str("442"); optv->results(newIval); @@ -1698,7 +1793,7 @@ TEST_CASE_METHOD(TApp, "NeedsMultiFlags", "[app]") { CLI::Option *opt1 = app.add_flag("--opt1"); CLI::Option *opt2 = app.add_flag("--opt2"); CLI::Option *opt3 = app.add_flag("--opt3"); - app.add_flag("--optall")->needs(opt1, opt2, opt3); + app.add_flag("--optall")->needs(opt1, opt2, opt3); // NOLINT(readability-suspicious-call-argument) run(); @@ -1858,6 +1953,23 @@ TEST_CASE_METHOD(TApp, "RangeDouble", "[app]") { run(); } +TEST_CASE_METHOD(TApp, "NonNegative", "[app]") { + + std::string res; + /// Note that this must be a double in Range, too + app.add_option("--one", res)->check(CLI::NonNegativeNumber); + + args = {"--one=crazy"}; + try { + // this should throw + run(); + CHECK(false); + } catch(const CLI::ValidationError &e) { + std::string emess = e.what(); + CHECK(emess.size() < 70U); + } +} + TEST_CASE_METHOD(TApp, "typeCheck", "[app]") { /// Note that this must be a double in Range, too @@ -2011,20 +2123,20 @@ TEST_CASE_METHOD(TApp, "FallthroughParentFail", "[app]") { } TEST_CASE_METHOD(TApp, "FallthroughParents", "[app]") { - auto sub = app.add_subcommand("test"); + auto *sub = app.add_subcommand("test"); CHECK(&app == CLI::detail::AppFriend::get_fallthrough_parent(sub)); - auto ssub = sub->add_subcommand("sub2"); + auto *ssub = sub->add_subcommand("sub2"); CHECK(sub == CLI::detail::AppFriend::get_fallthrough_parent(ssub)); - auto og1 = app.add_option_group("g1"); - auto og2 = og1->add_option_group("g2"); - auto og3 = og2->add_option_group("g3"); + auto *og1 = app.add_option_group("g1"); + auto *og2 = og1->add_option_group("g2"); + auto *og3 = og2->add_option_group("g3"); CHECK(&app == CLI::detail::AppFriend::get_fallthrough_parent(og3)); - auto ogb1 = sub->add_option_group("g1"); - auto ogb2 = ogb1->add_option_group("g2"); - auto ogb3 = ogb2->add_option_group("g3"); + auto *ogb1 = sub->add_option_group("g1"); + auto *ogb2 = ogb1->add_option_group("g2"); + auto *ogb3 = ogb2->add_option_group("g3"); CHECK(sub == CLI::detail::AppFriend::get_fallthrough_parent(ogb3)); ogb2->name("groupb"); @@ -2043,7 +2155,7 @@ TEST_CASE_METHOD(TApp, "OptionWithDefaults", "[app]") { // Added to test ->transform TEST_CASE_METHOD(TApp, "OrderedModifyingTransforms", "[app]") { std::vector<std::string> val; - auto m = app.add_option("-m", val); + auto *m = app.add_option("-m", val); m->transform([](std::string x) { return x + "1"; }); m->transform([](std::string x) { return x + "2"; }); @@ -2056,7 +2168,7 @@ TEST_CASE_METHOD(TApp, "OrderedModifyingTransforms", "[app]") { TEST_CASE_METHOD(TApp, "ThrowingTransform", "[app]") { std::string val; - auto m = app.add_option("-m,--mess", val); + auto *m = app.add_option("-m,--mess", val); m->transform([](std::string) -> std::string { throw CLI::ValidationError("My Message"); }); REQUIRE_NOTHROW(run()); @@ -2078,7 +2190,7 @@ TEST_CASE_METHOD(TApp, "EachItem", "[app]") { std::vector<std::string> results; std::vector<std::string> dummy; - auto opt = app.add_option("--vec", dummy); + auto *opt = app.add_option("--vec", dummy); opt->each([&results](std::string item) { results.push_back(item); }); @@ -2149,7 +2261,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParse", "[app]") { std::vector<int> vals{1, 2, 3}; args = {"--idx", "1,2,3"}; - auto opt = app.add_option("--idx", vals)->delimiter(','); + auto *opt = app.add_option("--idx", vals)->delimiter(','); run(); CHECK(std::vector<int>({1, 2, 3}) == vals); std::vector<int> vals2; @@ -2169,7 +2281,7 @@ TEST_CASE_METHOD(TApp, "DefaultUserSepParse", "[app]") { std::vector<std::string> vals; args = {"--idx", "1 2 3", "4 5 6"}; - auto opt = app.add_option("--idx", vals, ""); + auto *opt = app.add_option("--idx", vals, ""); run(); CHECK(std::vector<std::string>({"1 2 3", "4 5 6"}) == vals); opt->delimiter(','); @@ -2193,7 +2305,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParse2", "[app]") { std::vector<int> vals{1, 2, 3}; args = {"--idx", "1,2,"}; - auto opt = app.add_option("--idx", vals)->delimiter(','); + auto *opt = app.add_option("--idx", vals)->delimiter(','); run(); CHECK(std::vector<int>({1, 2}) == vals); @@ -2219,7 +2331,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParseToggle", "[app]") { std::vector<std::string> vals; args = {"--idx", "1,2,3"}; - auto opt = app.add_option("--idx", vals)->delimiter(','); + auto *opt = app.add_option("--idx", vals)->delimiter(','); run(); CHECK(std::vector<std::string>({"1", "2", "3"}) == vals); opt->delimiter('\0'); @@ -2238,7 +2350,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParse3", "[app]") { "1", "," "2"}; - auto opt = app.add_option("--idx", vals)->delimiter(','); + auto *opt = app.add_option("--idx", vals)->delimiter(','); run(); CHECK(std::vector<int>({1, 2}) == vals); app.remove_option(opt); @@ -2253,7 +2365,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParse4", "[app]") { std::vector<int> vals; args = {"--idx", "1, 2"}; - auto opt = app.add_option("--idx", vals)->delimiter(',')->capture_default_str(); + auto *opt = app.add_option("--idx", vals)->delimiter(',')->capture_default_str(); run(); CHECK(std::vector<int>({1, 2}) == vals); @@ -2269,7 +2381,7 @@ TEST_CASE_METHOD(TApp, "CustomUserSepParse5", "[app]") { std::vector<std::string> bar; args = {"this", "is", "a", "test"}; - auto opt = app.add_option("bar", bar, "bar"); + auto *opt = app.add_option("bar", bar, "bar"); run(); CHECK(std::vector<std::string>({"this", "is", "a", "test"}) == bar); @@ -2308,3 +2420,11 @@ TEST_CASE_METHOD(TApp, "logFormSingleDash", "[app]") { CHECK(veryverbose); CHECK(veryveryverbose); } + +TEST_CASE("C20_compile", "simple") { + CLI::App app{"test"}; + auto *flag = app.add_flag("--flag", "desc"); + + app.parse("--flag"); + CHECK_FALSE(flag->empty()); +} diff --git a/packages/CLI11/tests/BoostOptionTypeTest.cpp b/packages/CLI11/tests/BoostOptionTypeTest.cpp index 7ed096cd19f473cdb05ca1ec47ab586d93b272b4..c3cd81852a8124bb3bb1427a1a667d1f13176703 100644 --- a/packages/CLI11/tests/BoostOptionTypeTest.cpp +++ b/packages/CLI11/tests/BoostOptionTypeTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/CMakeLists.txt b/packages/CLI11/tests/CMakeLists.txt index 80c4f6a83ec93df312aaf0c19279141b02f9055e..7d89e128b713ac91de5b03d56db0cec355fcea7e 100644 --- a/packages/CLI11/tests/CMakeLists.txt +++ b/packages/CLI11/tests/CMakeLists.txt @@ -1,5 +1,3 @@ -list(APPEND CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/cmake") - if(CLI11_SANITIZERS) message(STATUS "Using arsenm/sanitizers-cmake") FetchContent_Declare( @@ -109,7 +107,7 @@ foreach(T IN LISTS CLI11_TESTS) if(CLI11_CUDA_TESTS) set_property(SOURCE ${T}.cpp PROPERTY LANGUAGE CUDA) endif() - add_executable(${T} ${T}.cpp ${CLI11_headers}) + add_executable(${T} ${T}.cpp) add_sanitizers(${T}) if(NOT CLI11_CUDA_TESTS) target_link_libraries(${T} PRIVATE CLI11_warnings) @@ -126,7 +124,7 @@ foreach(T IN LISTS CLI11_TESTS) endforeach() foreach(T IN LISTS CLI11_MULTIONLY_TESTS) - add_executable(${T} ${T}.cpp ${CLI11_headers}) + add_executable(${T} ${T}.cpp) add_sanitizers(${T}) target_link_libraries(${T} PUBLIC CLI11) add_catch_test(${T}) diff --git a/packages/CLI11/tests/ComplexTypeTest.cpp b/packages/CLI11/tests/ComplexTypeTest.cpp index 4806c544e8a5764f29e4ffe1745e2b694eeb4eb9..156798badc6bfbb30b01160e7b0fb88c780be8b3 100644 --- a/packages/CLI11/tests/ComplexTypeTest.cpp +++ b/packages/CLI11/tests/ComplexTypeTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -16,7 +16,7 @@ using cx = std::complex<double>; CLI::Option * add_option(CLI::App &app, std::string name, cx &variable, std::string description = "", bool defaulted = false) { CLI::callback_t fun = [&variable](CLI::results_t res) { - double x, y; + double x = 0, y = 0; bool worked = CLI::detail::lexical_cast(res[0], x) && CLI::detail::lexical_cast(res[1], y); if(worked) variable = cx(x, y); @@ -89,7 +89,7 @@ template <> bool lexical_cast<std::complex<double>>(const std::string &input, st std::smatch m; double x{0.0}, y{0.0}; - bool worked; + bool worked = false; std::regex_search(input, m, creg); if(m.size() == 9) { worked = CLI::detail::lexical_cast(m[1], x) && CLI::detail::lexical_cast(m[6], y); @@ -162,8 +162,8 @@ class complex_new { public: complex_new() = default; complex_new(double v1, double v2) : val1_{v1}, val2_{v2} {}; - double real() { return val1_; } - double imag() { return val2_; } + CLI11_NODISCARD double real() const { return val1_; } + CLI11_NODISCARD double imag() const { return val2_; } private: double val1_{0.0}; diff --git a/packages/CLI11/tests/ConfigFileTest.cpp b/packages/CLI11/tests/ConfigFileTest.cpp index 61c066eedaac5f0f2950b5a92101e681c20debaf..0b11ffefbd9a4076be7febce20cd43481e801248 100644 --- a/packages/CLI11/tests/ConfigFileTest.cpp +++ b/packages/CLI11/tests/ConfigFileTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -47,15 +47,15 @@ TEST_CASE("StringBased: convert_arg_for_ini", "[config]") { TEST_CASE("StringBased: IniJoin", "[config]") { std::vector<std::string> items = {"one", "two", "three four"}; - std::string result = "\"one\" \"two\" \"three four\""; + std::string result = R"("one" "two" "three four")"; CHECK(result == CLI::detail::ini_join(items, ' ', '\0', '\0')); - result = "[\"one\", \"two\", \"three four\"]"; + result = R"(["one", "two", "three four"])"; CHECK(result == CLI::detail::ini_join(items)); - result = "{\"one\"; \"two\"; \"three four\"}"; + result = R"({"one"; "two"; "three four"})"; CHECK(result == CLI::detail::ini_join(items, ';', '{', '}')); } @@ -260,7 +260,7 @@ TEST_CASE("StringBased: SpacesSections", "[config]") { // check function to make sure that open sections match close sections bool checkSections(const std::vector<CLI::ConfigItem> &output) { std::set<std::string> open; - for(auto &ci : output) { + for(const auto &ci : output) { if(ci.name == "++") { auto nm = ci.fullname(); nm.pop_back(); @@ -525,7 +525,7 @@ TEST_CASE_METHOD(TApp, "IniGetNoRemaining", "[config]") { int two{0}; app.add_option("--two", two); REQUIRE_NOTHROW(run()); - CHECK(0u == app.remaining().size()); + CHECK(app.remaining().empty()); } TEST_CASE_METHOD(TApp, "IniRequiredNoDefault", "[config]") { @@ -554,9 +554,9 @@ TEST_CASE_METHOD(TApp, "IniNotRequiredNoDefault", "[config]") { class EvilConfig : public CLI::Config { public: EvilConfig() = default; - virtual std::string to_config(const CLI::App *, bool, bool, std::string) const { throw CLI::FileError("evil"); } + std::string to_config(const CLI::App *, bool, bool, std::string) const override { throw CLI::FileError("evil"); } - virtual std::vector<CLI::ConfigItem> from_config(std::istream &) const { throw CLI::FileError("evil"); } + std::vector<CLI::ConfigItem> from_config(std::istream &) const override { throw CLI::FileError("evil"); } }; TEST_CASE_METHOD(TApp, "IniRequiredbadConfigurator", "[config]") { @@ -1014,16 +1014,32 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") { std::ofstream out{tmptoml}; out << "#this is a comment line\n"; out << "[default]\n"; + out << "zero1=[]\n"; + out << "zero2={}\n"; + out << "zero3={}\n"; + out << "nzero={}\n"; + out << "one=[\"1\"]\n"; out << "two=[\"2\",\"3\"]\n"; out << "three=[\"1\",\"2\",\"3\"]\n"; } - std::vector<std::string> two, three; + std::vector<std::string> nzero, zero1, zero2, zero3, one, two, three; + app.add_option("--zero1", zero1)->required()->expected(0, 99)->default_str("{}"); + app.add_option("--zero2", zero2)->required()->expected(0, 99)->default_val(std::vector<std::string>{}); + // if no default is specified the argument results in an empty string + app.add_option("--zero3", zero3)->required()->expected(0, 99); + app.add_option("--nzero", nzero)->required(); + app.add_option("--one", one)->required(); app.add_option("--two", two)->required(); app.add_option("--three", three)->required(); run(); + CHECK(zero1 == std::vector<std::string>({})); + CHECK(zero2 == std::vector<std::string>({})); + CHECK(zero3 == std::vector<std::string>({""})); + CHECK(nzero == std::vector<std::string>({"{}"})); + CHECK(one == std::vector<std::string>({"1"})); CHECK(two == std::vector<std::string>({"2", "3"})); CHECK(three == std::vector<std::string>({"1", "2", "3"})); } @@ -1038,16 +1054,25 @@ TEST_CASE_METHOD(TApp, "IniVectorCsep", "[config]") { std::ofstream out{tmpini}; out << "#this is a comment line\n"; out << "[default]\n"; + out << "zero1=[]\n"; + out << "zero2=[]\n"; + out << "one=[1]\n"; out << "two=[2,3]\n"; out << "three=1,2,3\n"; } - std::vector<int> two, three; + std::vector<int> zero1, zero2, one, two, three; + app.add_option("--zero1", zero1)->required()->expected(0, 99)->default_str("{}"); + app.add_option("--zero2", zero2)->required()->expected(0, 99)->default_val(std::vector<int>{}); + app.add_option("--one", one)->required(); app.add_option("--two", two)->expected(2)->required(); app.add_option("--three", three)->required(); run(); + CHECK(zero1 == std::vector<int>({})); + CHECK(zero2 == std::vector<int>({})); + CHECK(one == std::vector<int>({1})); CHECK(two == std::vector<int>({2, 3})); CHECK(three == std::vector<int>({1, 2, 3})); } @@ -1096,9 +1121,9 @@ TEST_CASE_METHOD(TApp, "IniLayered", "[config]") { int one{0}, two{0}, three{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); + auto *subcom = app.add_subcommand("subcom"); subcom->add_option("--val", two); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); run(); @@ -1128,9 +1153,9 @@ TEST_CASE_METHOD(TApp, "IniLayeredStream", "[config]") { int one{0}, two{0}, three{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); + auto *subcom = app.add_subcommand("subcom"); subcom->add_option("--val", two); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); std::ifstream in{tmpini}; @@ -1162,9 +1187,9 @@ TEST_CASE_METHOD(TApp, "IniLayeredDotSection", "[config]") { int one{0}, two{0}, three{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); + auto *subcom = app.add_subcommand("subcom"); subcom->add_option("--val", two); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); run(); @@ -1201,9 +1226,9 @@ TEST_CASE_METHOD(TApp, "IniLayeredCustomSectionSeparator", "[config]") { app.get_config_formatter_base()->parentSeparator('|'); int one{0}, two{0}, three{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); + auto *subcom = app.add_subcommand("subcom"); subcom->add_option("--val", two); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); run(); @@ -1216,6 +1241,30 @@ TEST_CASE_METHOD(TApp, "IniLayeredCustomSectionSeparator", "[config]") { CHECK(!*subcom); } +TEST_CASE_METHOD(TApp, "IniLayeredOptionGroupAlias", "[config]") { + + TempFile tmpini{"TestIniTmp.ini"}; + + app.set_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "[default]" << std::endl; + out << "val=1" << std::endl; + out << "[ogroup]" << std::endl; + out << "val2=2" << std::endl; + } + int one{0}, two{0}; + app.add_option("--val", one); + auto *subcom = app.add_option_group("ogroup")->alias("ogroup"); + subcom->add_option("--val2", two); + + run(); + + CHECK(one == 1); + CHECK(two == 2); +} + TEST_CASE_METHOD(TApp, "IniSubcommandConfigurable", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -1233,10 +1282,10 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurable", "[config]") { int one{0}, two{0}, three{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); + auto *subcom = app.add_subcommand("subcom"); subcom->configurable(); subcom->add_option("--val", two); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); run(); @@ -1267,15 +1316,15 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurablePreParse", "[config]") { int one{0}, two{0}, three{0}, four{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); - auto subcom2 = app.add_subcommand("subcom2"); + auto *subcom = app.add_subcommand("subcom"); + auto *subcom2 = app.add_subcommand("subcom2"); subcom->configurable(); std::vector<std::size_t> parse_c; subcom->preparse_callback([&parse_c](std::size_t cnt) { parse_c.push_back(cnt); }); subcom->add_option("--val", two); subcom2->add_option("--val", four); subcom2->preparse_callback([&parse_c](std::size_t cnt) { parse_c.push_back(cnt + 2623); }); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); subsubcom->add_option("--val", three); run(); @@ -1350,7 +1399,7 @@ TEST_CASE_METHOD(TApp, "jsonLikeParsing", "[config]") { std::ofstream out{tmpjson}; out << "{" << std::endl; out << "\"val\":1," << std::endl; - out << "\"val2\":\"test\"," << std::endl; + out << R"("val2":"test",)" << std::endl; out << "\"flag\":true" << std::endl; out << "}" << std::endl; } @@ -1433,15 +1482,15 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableParseComplete", "[config]") { int one{0}, two{0}, three{0}, four{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); - auto subcom2 = app.add_subcommand("subcom2"); + auto *subcom = app.add_subcommand("subcom"); + auto *subcom2 = app.add_subcommand("subcom2"); subcom->configurable(); std::vector<std::size_t> parse_c; subcom->parse_complete_callback([&parse_c]() { parse_c.push_back(58); }); subcom->add_option("--val", two); subcom2->add_option("--val", four); subcom2->parse_complete_callback([&parse_c]() { parse_c.push_back(2623); }); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); // configurable should be inherited subsubcom->parse_complete_callback([&parse_c]() { parse_c.push_back(68); }); subsubcom->add_option("--val", three); @@ -1480,8 +1529,8 @@ TEST_CASE_METHOD(TApp, "IniSubcommandMultipleSections", "[config]") { int one{0}, two{0}, three{0}, four{0}; app.add_option("--val", one); - auto subcom = app.add_subcommand("subcom"); - auto subcom2 = app.add_subcommand("subcom2"); + auto *subcom = app.add_subcommand("subcom"); + auto *subcom2 = app.add_subcommand("subcom2"); subcom->configurable(); std::vector<std::size_t> parse_c; subcom->parse_complete_callback([&parse_c]() { parse_c.push_back(58); }); @@ -1489,7 +1538,7 @@ TEST_CASE_METHOD(TApp, "IniSubcommandMultipleSections", "[config]") { subcom2->add_option("--val", four); subcom2->parse_complete_callback([&parse_c]() { parse_c.push_back(2623); }); subcom2->configurable(false); - auto subsubcom = subcom->add_subcommand("subsubcom"); + auto *subsubcom = subcom->add_subcommand("subsubcom"); // configurable should be inherited subsubcom->parse_complete_callback([&parse_c]() { parse_c.push_back(68); }); subsubcom->add_option("--val", three); @@ -1521,7 +1570,7 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacks", "[config]") { out << "[[foo]]" << std::endl; } - auto foo = app.add_subcommand("foo"); + auto *foo = app.add_subcommand("foo"); int count{0}; foo->callback([&count]() { ++count; }); foo->immediate_callback(); @@ -1532,6 +1581,25 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacks", "[config]") { CHECK(3 == count); } +TEST_CASE_METHOD(TApp, "SubcommandCallbackSingle", "[config]") { + + TempFile tmptoml{"Testtomlcallback.toml"}; + + app.set_config("--config", tmptoml); + + { + std::ofstream out{tmptoml}; + out << "[foo]" << std::endl; + } + int count{0}; + auto *foo = app.add_subcommand("foo"); + foo->configurable(); + foo->callback([&count]() { ++count; }); + + run(); + CHECK(1 == count); +} + TEST_CASE_METHOD(TApp, "IniFailure", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -1684,6 +1752,64 @@ TEST_CASE_METHOD(TApp, "IniShort", "[config]") { CHECK(3 == key); } +TEST_CASE_METHOD(TApp, "IniDefaultPath", "[config]") { + + TempFile tmpini{"../TestIniTmp.ini"}; + + int key{0}; + app.add_option("--flag,-f", key); + app.set_config("--config", "TestIniTmp.ini")->transform(CLI::FileOnDefaultPath("../")); + + { + std::ofstream out{tmpini}; + out << "f=3" << std::endl; + } + + REQUIRE_NOTHROW(run()); + CHECK(3 == key); +} + +TEST_CASE_METHOD(TApp, "IniMultipleDefaultPath", "[config]") { + + TempFile tmpini{"../TestIniTmp.ini"}; + + int key{0}; + app.add_option("--flag,-f", key); + auto *cfgOption = app.set_config("--config", "doesnotexist.ini") + ->transform(CLI::FileOnDefaultPath("../")) + ->transform(CLI::FileOnDefaultPath("../other", false)); + + { + std::ofstream out{tmpini}; + out << "f=3" << std::endl; + } + + args = {"--config", "TestIniTmp.ini"}; + REQUIRE_NOTHROW(run()); + CHECK(3 == key); + CHECK(cfgOption->as<std::string>() == "../TestIniTmp.ini"); +} + +TEST_CASE_METHOD(TApp, "IniMultipleDefaultPathAlternate", "[config]") { + + TempFile tmpini{"../TestIniTmp.ini"}; + + int key{0}; + app.add_option("--flag,-f", key); + auto *cfgOption = app.set_config("--config", "doesnotexist.ini") + ->transform(CLI::FileOnDefaultPath("../other") | CLI::FileOnDefaultPath("../")); + + { + std::ofstream out{tmpini}; + out << "f=3" << std::endl; + } + + args = {"--config", "TestIniTmp.ini"}; + REQUIRE_NOTHROW(run()); + CHECK(3 == key); + CHECK(cfgOption->as<std::string>() == "../TestIniTmp.ini"); +} + TEST_CASE_METHOD(TApp, "IniPositional", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -2035,7 +2161,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputMultiLineDescription", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputOptionGroupMultiLineDescription", "[config]") { std::string flag = "flag"; const std::string description = "Short flag description.\n"; - auto og = app.add_option_group("group"); + auto *og = app.add_option_group("group"); og->description("Option group description.\n" "That has multiple lines."); og->add_flag("--" + flag, description); @@ -2049,7 +2175,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputOptionGroupMultiLineDescription", "[config]") TEST_CASE_METHOD(TApp, "TomlOutputSubcommandMultiLineDescription", "[config]") { std::string flag = "flag"; const std::string description = "Short flag description.\n"; - auto subcom = app.add_subcommand("subcommand"); + auto *subcom = app.add_subcommand("subcommand"); subcom->configurable(); subcom->description("Subcommand description.\n" "That has multiple lines."); @@ -2069,7 +2195,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputOptionGroup", "[config]") { const std::string description2 = "Second description."; app.add_flag("--" + flag1, description1)->group("group1"); app.add_flag("--" + flag2, description2)->group("group2"); - auto og = app.add_option_group("group3", "g3 desc"); + auto *og = app.add_option_group("group3", "g3 desc"); og->add_option("--dval", val)->capture_default_str()->group(""); run(); @@ -2103,6 +2229,19 @@ TEST_CASE_METHOD(TApp, "TomlOutputVector", "[config]") { CHECK(str == "vector=[1, 2, 3]\n"); } +TEST_CASE_METHOD(TApp, "TomlOutputTuple", "[config]") { + + std::tuple<double, double, double, double> t; + app.add_option("--tuple", t); + app.config_formatter(std::make_shared<CLI::ConfigTOML>()); + args = {"--tuple", "1", "2", "3", "4"}; + + run(); + + std::string str = app.config_to_str(); + CHECK(str == "tuple=[1, 2, 3, 4]\n"); +} + TEST_CASE_METHOD(TApp, "ConfigOutputVectorCustom", "[config]") { std::vector<int> v; @@ -2134,7 +2273,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputFlag", "[config]") { CHECK_THAT(str, Contains("simple=3")); CHECK_THAT(str, !Contains("nothing")); CHECK_THAT(str, Contains("onething=true")); - CHECK_THAT(str, Contains("something=[true, true]")); + CHECK_THAT(str, Contains("something=2")); str = app.config_to_str(true); CHECK_THAT(str, Contains("nothing")); @@ -2170,7 +2309,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputDefault", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubcom", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); args = {"--simple", "other", "--newer"}; @@ -2184,7 +2323,7 @@ TEST_CASE_METHOD(TApp, "TomlOutputSubcom", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubcomConfigurable", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); args = {"--simple", "other", "--newer"}; @@ -2200,9 +2339,9 @@ TEST_CASE_METHOD(TApp, "TomlOutputSubcomConfigurable", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubsubcom", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); args = {"--simple", "other", "--newer", "sub2", "--newest"}; @@ -2217,10 +2356,10 @@ TEST_CASE_METHOD(TApp, "TomlOutputSubsubcom", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubsubcomConfigurable", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); args = {"--simple", "other", "--newer", "sub2", "--newest"}; @@ -2238,10 +2377,10 @@ TEST_CASE_METHOD(TApp, "TomlOutputSubsubcomConfigurable", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubcomNonConfigurable", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other", "other_descriptor")->configurable(); + auto *subcom = app.add_subcommand("other", "other_descriptor")->configurable(); subcom->add_flag("--newer"); - auto subcom2 = app.add_subcommand("sub2", "descriptor2"); + auto *subcom2 = app.add_subcommand("sub2", "descriptor2"); subcom2->add_flag("--newest")->configurable(false); args = {"--simple", "other", "--newer", "sub2", "--newest"}; @@ -2259,14 +2398,14 @@ TEST_CASE_METHOD(TApp, "TomlOutputSubcomNonConfigurable", "[config]") { TEST_CASE_METHOD(TApp, "TomlOutputSubsubcomConfigurableDeep", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); - auto sssscom = subsubcom->add_subcommand("sub-level2"); + auto *sssscom = subsubcom->add_subcommand("sub-level2"); subsubcom->add_flag("--still_newer"); - auto s5com = sssscom->add_subcommand("sub-level3"); + auto *s5com = sssscom->add_subcommand("sub-level3"); s5com->add_flag("--absolute_newest"); args = {"--simple", "other", "sub2", "sub-level2", "sub-level3", "--absolute_newest"}; @@ -2320,7 +2459,7 @@ TEST_CASE_METHOD(TApp, "StopReadingConfigOnClear", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; app.set_config("--config", tmpini); - auto ptr = app.set_config(); // Should *not* read config file + auto *ptr = app.set_config(); // Should *not* read config file CHECK(nullptr == ptr); { @@ -2479,7 +2618,7 @@ TEST_CASE_METHOD(TApp, "IniOutputMultiLineDescription", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputOptionGroupMultiLineDescription", "[config]") { std::string flag = "flag"; const std::string description = "Short flag description.\n"; - auto og = app.add_option_group("group"); + auto *og = app.add_option_group("group"); og->description("Option group description.\n" "That has multiple lines."); og->add_flag("--" + flag, description); @@ -2494,7 +2633,7 @@ TEST_CASE_METHOD(TApp, "IniOutputOptionGroupMultiLineDescription", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubcommandMultiLineDescription", "[config]") { std::string flag = "flag"; const std::string description = "Short flag description.\n"; - auto subcom = app.add_subcommand("subcommand"); + auto *subcom = app.add_subcommand("subcommand"); subcom->configurable(); subcom->description("Subcommand description.\n" "That has multiple lines."); @@ -2515,7 +2654,7 @@ TEST_CASE_METHOD(TApp, "IniOutputOptionGroup", "[config]") { const std::string description2 = "Second description."; app.add_flag("--" + flag1, description1)->group("group1"); app.add_flag("--" + flag2, description2)->group("group2"); - auto og = app.add_option_group("group3", "g3 desc"); + auto *og = app.add_option_group("group3", "g3 desc"); og->add_option("--dval", val)->capture_default_str()->group(""); app.config_formatter(std::make_shared<CLI::ConfigINI>()); run(); @@ -2565,7 +2704,7 @@ TEST_CASE_METHOD(TApp, "IniOutputFlag", "[config]") { CHECK_THAT(str, Contains("simple=3")); CHECK_THAT(str, !Contains("nothing")); CHECK_THAT(str, Contains("onething=true")); - CHECK_THAT(str, Contains("something=true true")); + CHECK_THAT(str, Contains("something=2")); str = app.config_to_str(true); CHECK_THAT(str, Contains("nothing")); @@ -2601,7 +2740,7 @@ TEST_CASE_METHOD(TApp, "IniOutputDefault", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubcom", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); args = {"--simple", "other", "--newer"}; @@ -2615,7 +2754,7 @@ TEST_CASE_METHOD(TApp, "IniOutputSubcom", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubcomCustomSep", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); app.get_config_formatter_base()->parentSeparator(':'); @@ -2630,7 +2769,7 @@ TEST_CASE_METHOD(TApp, "IniOutputSubcomCustomSep", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubcomConfigurable", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); args = {"--simple", "other", "--newer"}; @@ -2646,9 +2785,9 @@ TEST_CASE_METHOD(TApp, "IniOutputSubcomConfigurable", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubsubcom", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); args = {"--simple", "other", "--newer", "sub2", "--newest"}; @@ -2663,9 +2802,9 @@ TEST_CASE_METHOD(TApp, "IniOutputSubsubcom", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubsubcomCustomSep", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other"); + auto *subcom = app.add_subcommand("other"); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); app.get_config_formatter_base()->parentSeparator('|'); @@ -2681,10 +2820,10 @@ TEST_CASE_METHOD(TApp, "IniOutputSubsubcomCustomSep", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubsubcomConfigurable", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); args = {"--simple", "other", "--newer", "sub2", "--newest"}; @@ -2702,14 +2841,14 @@ TEST_CASE_METHOD(TApp, "IniOutputSubsubcomConfigurable", "[config]") { TEST_CASE_METHOD(TApp, "IniOutputSubsubcomConfigurableDeep", "[config]") { app.add_flag("--simple"); - auto subcom = app.add_subcommand("other")->configurable(); + auto *subcom = app.add_subcommand("other")->configurable(); subcom->add_flag("--newer"); - auto subsubcom = subcom->add_subcommand("sub2"); + auto *subsubcom = subcom->add_subcommand("sub2"); subsubcom->add_flag("--newest"); - auto sssscom = subsubcom->add_subcommand("sub-level2"); + auto *sssscom = subsubcom->add_subcommand("sub-level2"); subsubcom->add_flag("--still_newer"); - auto s5com = sssscom->add_subcommand("sub-level3"); + auto *s5com = sssscom->add_subcommand("sub-level3"); s5com->add_flag("--absolute_newest"); app.config_formatter(std::make_shared<CLI::ConfigINI>()); args = {"--simple", "other", "sub2", "sub-level2", "sub-level3", "--absolute_newest"}; diff --git a/packages/CLI11/tests/CreationTest.cpp b/packages/CLI11/tests/CreationTest.cpp index 47900570744aaa55a49555ef9a40054c4655d03e..b58e0aabe07325a37dbe9ba76e4b4507a9cd2bfd 100644 --- a/packages/CLI11/tests/CreationTest.cpp +++ b/packages/CLI11/tests/CreationTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -41,7 +41,7 @@ TEST_CASE_METHOD(TApp, "AddingExistingWithCase", "[creation]") { } TEST_CASE_METHOD(TApp, "AddingExistingWithCaseAfter", "[creation]") { - auto count = app.add_flag("-c,--count"); + auto *count = app.add_flag("-c,--count"); app.add_flag("--Cat,-C"); CHECK_THROWS_AS(count->ignore_case(), CLI::OptionAlreadyAdded); @@ -49,20 +49,20 @@ TEST_CASE_METHOD(TApp, "AddingExistingWithCaseAfter", "[creation]") { TEST_CASE_METHOD(TApp, "AddingExistingWithCaseAfter2", "[creation]") { app.add_flag("-c,--count"); - auto cat = app.add_flag("--Cat,-C"); + auto *cat = app.add_flag("--Cat,-C"); CHECK_THROWS_AS(cat->ignore_case(), CLI::OptionAlreadyAdded); } TEST_CASE_METHOD(TApp, "AddingExistingWithUnderscoreAfter", "[creation]") { - auto count = app.add_flag("--underscore"); + auto *count = app.add_flag("--underscore"); app.add_flag("--under_score"); CHECK_THROWS_AS(count->ignore_underscore(), CLI::OptionAlreadyAdded); } TEST_CASE_METHOD(TApp, "AddingExistingWithUnderscoreAfter2", "[creation]") { - auto count = app.add_flag("--under_score"); + auto *count = app.add_flag("--under_score"); app.add_flag("--underscore"); CHECK_THROWS_AS(count->ignore_underscore(), CLI::OptionAlreadyAdded); @@ -125,13 +125,13 @@ TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithUnderscoreFirst", "[creation]" TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithCaseInplace", "[creation]") { app.add_subcommand("first"); - auto first = app.add_subcommand("fIrst"); + auto *first = app.add_subcommand("fIrst"); CHECK_THROWS_AS(first->ignore_case(), CLI::OptionAlreadyAdded); } TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithCaseInplace2", "[creation]") { - auto first = app.add_subcommand("first"); + auto *first = app.add_subcommand("first"); app.add_subcommand("fIrst"); CHECK_THROWS_AS(first->ignore_case(), CLI::OptionAlreadyAdded); @@ -139,29 +139,29 @@ TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithCaseInplace2", "[creation]") { TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithUnderscoreInplace", "[creation]") { app.add_subcommand("first_option"); - auto first = app.add_subcommand("firstoption"); + auto *first = app.add_subcommand("firstoption"); CHECK_THROWS_AS(first->ignore_underscore(), CLI::OptionAlreadyAdded); } TEST_CASE_METHOD(TApp, "MultipleSubcomMatchingWithUnderscoreInplace2", "[creation]") { - auto first = app.add_subcommand("firstoption"); + auto *first = app.add_subcommand("firstoption"); app.add_subcommand("first_option"); CHECK_THROWS_AS(first->ignore_underscore(), CLI::OptionAlreadyAdded); } TEST_CASE_METHOD(TApp, "MultipleSubcomNoMatchingInplace2", "[creation]") { - auto first = app.add_subcommand("first"); - auto second = app.add_subcommand("second"); + auto *first = app.add_subcommand("first"); + auto *second = app.add_subcommand("second"); CHECK_NOTHROW(first->ignore_case()); CHECK_NOTHROW(second->ignore_case()); } TEST_CASE_METHOD(TApp, "MultipleSubcomNoMatchingInplaceUnderscore2", "[creation]") { - auto first = app.add_subcommand("first_option"); - auto second = app.add_subcommand("second_option"); + auto *first = app.add_subcommand("first_option"); + auto *second = app.add_subcommand("second_option"); CHECK_NOTHROW(first->ignore_underscore()); CHECK_NOTHROW(second->ignore_underscore()); @@ -183,25 +183,25 @@ TEST_CASE_METHOD(TApp, "IncorrectConstructionFlagPositional3", "[creation]") { } TEST_CASE_METHOD(TApp, "IncorrectConstructionNeedsCannotFind", "[creation]") { - auto cat = app.add_flag("--cat"); + auto *cat = app.add_flag("--cat"); CHECK_THROWS_AS(cat->needs("--nothing"), CLI::IncorrectConstruction); } TEST_CASE_METHOD(TApp, "IncorrectConstructionExcludesCannotFind", "[creation]") { - auto cat = app.add_flag("--cat"); + auto *cat = app.add_flag("--cat"); CHECK_THROWS_AS(cat->excludes("--nothing"), CLI::IncorrectConstruction); } TEST_CASE_METHOD(TApp, "IncorrectConstructionDuplicateNeeds", "[creation]") { - auto cat = app.add_flag("--cat"); - auto other = app.add_flag("--other"); + auto *cat = app.add_flag("--cat"); + auto *other = app.add_flag("--other"); REQUIRE_NOTHROW(cat->needs(other)); // duplicated needs is redundant but not an error CHECK_NOTHROW(cat->needs(other)); } TEST_CASE_METHOD(TApp, "IncorrectConstructionDuplicateNeedsTxt", "[creation]") { - auto cat = app.add_flag("--cat"); + auto *cat = app.add_flag("--cat"); app.add_flag("--other"); REQUIRE_NOTHROW(cat->needs("--other")); // duplicate needs is redundant but not an error @@ -210,28 +210,28 @@ TEST_CASE_METHOD(TApp, "IncorrectConstructionDuplicateNeedsTxt", "[creation]") { // Now allowed TEST_CASE_METHOD(TApp, "CorrectConstructionDuplicateExcludes", "[creation]") { - auto cat = app.add_flag("--cat"); - auto other = app.add_flag("--other"); + auto *cat = app.add_flag("--cat"); + auto *other = app.add_flag("--other"); REQUIRE_NOTHROW(cat->excludes(other)); REQUIRE_NOTHROW(other->excludes(cat)); } // Now allowed TEST_CASE_METHOD(TApp, "CorrectConstructionDuplicateExcludesTxt", "[creation]") { - auto cat = app.add_flag("--cat"); - auto other = app.add_flag("--other"); + auto *cat = app.add_flag("--cat"); + auto *other = app.add_flag("--other"); REQUIRE_NOTHROW(cat->excludes("--other")); REQUIRE_NOTHROW(other->excludes("--cat")); } TEST_CASE_METHOD(TApp, "CheckName", "[creation]") { - auto long1 = app.add_flag("--long1"); - auto long2 = app.add_flag("--Long2"); - auto short1 = app.add_flag("-a"); - auto short2 = app.add_flag("-B"); + auto *long1 = app.add_flag("--long1"); + auto *long2 = app.add_flag("--Long2"); + auto *short1 = app.add_flag("-a"); + auto *short2 = app.add_flag("-B"); int x{0}, y{0}; - auto pos1 = app.add_option("pos1", x); - auto pos2 = app.add_option("pOs2", y); + auto *pos1 = app.add_option("pos1", x); + auto *pos2 = app.add_option("pOs2", y); CHECK(long1->check_name("--long1")); CHECK(!long1->check_name("--lonG1")); @@ -253,13 +253,13 @@ TEST_CASE_METHOD(TApp, "CheckName", "[creation]") { } TEST_CASE_METHOD(TApp, "CheckNameNoCase", "[creation]") { - auto long1 = app.add_flag("--long1")->ignore_case(); - auto long2 = app.add_flag("--Long2")->ignore_case(); - auto short1 = app.add_flag("-a")->ignore_case(); - auto short2 = app.add_flag("-B")->ignore_case(); + auto *long1 = app.add_flag("--long1")->ignore_case(); + auto *long2 = app.add_flag("--Long2")->ignore_case(); + auto *short1 = app.add_flag("-a")->ignore_case(); + auto *short2 = app.add_flag("-B")->ignore_case(); int x{0}, y{0}; - auto pos1 = app.add_option("pos1", x)->ignore_case(); - auto pos2 = app.add_option("pOs2", y)->ignore_case(); + auto *pos1 = app.add_option("pos1", x)->ignore_case(); + auto *pos2 = app.add_option("pOs2", y)->ignore_case(); CHECK(long1->check_name("--long1")); CHECK(long1->check_name("--lonG1")); @@ -281,12 +281,12 @@ TEST_CASE_METHOD(TApp, "CheckNameNoCase", "[creation]") { } TEST_CASE_METHOD(TApp, "CheckNameNoUnderscore", "[creation]") { - auto long1 = app.add_flag("--longoption1")->ignore_underscore(); - auto long2 = app.add_flag("--long_option2")->ignore_underscore(); + auto *long1 = app.add_flag("--longoption1")->ignore_underscore(); + auto *long2 = app.add_flag("--long_option2")->ignore_underscore(); int x{0}, y{0}; - auto pos1 = app.add_option("pos_option_1", x)->ignore_underscore(); - auto pos2 = app.add_option("posoption2", y)->ignore_underscore(); + auto *pos1 = app.add_option("pos_option_1", x)->ignore_underscore(); + auto *pos2 = app.add_option("posoption2", y)->ignore_underscore(); CHECK(long1->check_name("--long_option1")); CHECK(long1->check_name("--longoption_1")); @@ -312,12 +312,12 @@ TEST_CASE_METHOD(TApp, "CheckNameNoUnderscore", "[creation]") { } TEST_CASE_METHOD(TApp, "CheckNameNoCaseNoUnderscore", "[creation]") { - auto long1 = app.add_flag("--LongoptioN1")->ignore_underscore()->ignore_case(); - auto long2 = app.add_flag("--long_Option2")->ignore_case()->ignore_underscore(); + auto *long1 = app.add_flag("--LongoptioN1")->ignore_underscore()->ignore_case(); + auto *long2 = app.add_flag("--long_Option2")->ignore_case()->ignore_underscore(); int x{0}, y{0}; - auto pos1 = app.add_option("pos_Option_1", x)->ignore_underscore()->ignore_case(); - auto pos2 = app.add_option("posOption2", y)->ignore_case()->ignore_underscore(); + auto *pos1 = app.add_option("pos_Option_1", x)->ignore_underscore()->ignore_case(); + auto *pos2 = app.add_option("posOption2", y)->ignore_case()->ignore_underscore(); CHECK(long1->check_name("--Long_Option1")); CHECK(long1->check_name("--lONgoption_1")); @@ -344,7 +344,7 @@ TEST_CASE_METHOD(TApp, "CheckNameNoCaseNoUnderscore", "[creation]") { TEST_CASE_METHOD(TApp, "PreSpaces", "[creation]") { int x{0}; - auto myapp = app.add_option(" -a, --long, other", x); + auto *myapp = app.add_option(" -a, --long, other", x); CHECK(myapp->check_lname("long")); CHECK(myapp->check_sname("a")); @@ -353,7 +353,7 @@ TEST_CASE_METHOD(TApp, "PreSpaces", "[creation]") { TEST_CASE_METHOD(TApp, "AllSpaces", "[creation]") { int x{0}; - auto myapp = app.add_option(" -a , --long , other ", x); + auto *myapp = app.add_option(" -a , --long , other ", x); CHECK(myapp->check_lname("long")); CHECK(myapp->check_sname("a")); @@ -365,26 +365,26 @@ TEST_CASE_METHOD(TApp, "OptionFromDefaults", "[creation]") { // Options should remember defaults int x{0}; - auto opt = app.add_option("--simple", x); + auto *opt = app.add_option("--simple", x); CHECK(opt->get_required()); // Flags cannot be required - auto flag = app.add_flag("--other"); + auto *flag = app.add_flag("--other"); CHECK(!flag->get_required()); app.option_defaults()->required(false); - auto opt2 = app.add_option("--simple2", x); + auto *opt2 = app.add_option("--simple2", x); CHECK(!opt2->get_required()); app.option_defaults()->required()->ignore_case(); - auto opt3 = app.add_option("--simple3", x); + auto *opt3 = app.add_option("--simple3", x); CHECK(opt3->get_required()); CHECK(opt3->get_ignore_case()); app.option_defaults()->required()->ignore_underscore(); - auto opt4 = app.add_option("--simple4", x); + auto *opt4 = app.add_option("--simple4", x); CHECK(opt4->get_required()); CHECK(opt4->get_ignore_underscore()); } @@ -408,7 +408,7 @@ TEST_CASE_METHOD(TApp, "OptionFromDefaultsSubcommands", "[creation]") { ->disable_flag_override() ->group("Something"); - auto app2 = app.add_subcommand("app2"); + auto *app2 = app.add_subcommand("app2"); CHECK(app2->option_defaults()->get_required()); CHECK(CLI::MultiOptionPolicy::TakeLast == app2->option_defaults()->get_multi_option_policy()); @@ -421,10 +421,10 @@ TEST_CASE_METHOD(TApp, "OptionFromDefaultsSubcommands", "[creation]") { TEST_CASE_METHOD(TApp, "GetNameCheck", "[creation]") { int x{0}; - auto a = app.add_flag("--that"); - auto b = app.add_flag("-x"); - auto c = app.add_option("pos", x); - auto d = app.add_option("one,-o,--other", x); + auto *a = app.add_flag("--that"); + auto *b = app.add_flag("-x"); + auto *c = app.add_option("pos", x); + auto *d = app.add_option("one,-o,--other", x); CHECK("--that" == a->get_name(false, true)); CHECK("-x" == b->get_name(false, true)); @@ -455,7 +455,7 @@ TEST_CASE_METHOD(TApp, "SubcommandDefaults", "[creation]") { CHECK(!app.get_configurable()); CHECK(!app.get_validate_positionals()); - CHECK("" == app.get_footer()); + CHECK(app.get_footer().empty()); CHECK("Subcommands" == app.get_group()); CHECK(0u == app.get_require_subcommand_min()); CHECK(0u == app.get_require_subcommand_max()); @@ -478,7 +478,7 @@ TEST_CASE_METHOD(TApp, "SubcommandDefaults", "[creation]") { app.group("Stuff"); app.require_subcommand(2, 3); - auto app2 = app.add_subcommand("app2"); + auto *app2 = app.add_subcommand("app2"); // Initial defaults CHECK(app2->get_allow_extras()); @@ -533,8 +533,8 @@ TEST_CASE_METHOD(TApp, "SubcommandMinMax", "[creation]") { TEST_CASE_METHOD(TApp, "GetOptionList", "[creation]") { int two{0}; - auto flag = app.add_flag("--one"); - auto opt = app.add_option("--two", two); + auto *flag = app.add_flag("--one"); + auto *opt = app.add_option("--two", two); const CLI::App &const_app = app; // const alias to force use of const-methods std::vector<const CLI::Option *> opt_list = const_app.get_options(); @@ -561,9 +561,9 @@ TEST_CASE("ValidatorTests: TestValidatorCreation", "[creation]") { CHECK(V.get_active()); CHECK("test" == V("test")); - CHECK(std::string{} == V("test5")); + CHECK(V("test5").empty()); - CHECK(std::string{} == V.get_description()); + CHECK(V.get_description().empty()); V.description("this is a description"); CHECK("this is a description" == V.get_description()); } @@ -717,7 +717,7 @@ class Unstreamable { public: Unstreamable() = default; - int get_x() const { return x_; } + CLI11_NODISCARD int get_x() const { return x_; } void set_x(int x) { x_ = x; } }; @@ -725,7 +725,7 @@ class Unstreamable { static_assert(!CLI::detail::is_istreamable<Unstreamable, std::istream>::value, "Unstreamable type is streamable"); std::istream &operator>>(std::istream &in, Unstreamable &value) { - int x; + int x = 0; in >> x; value.set_x(x); return in; diff --git a/packages/CLI11/tests/DeprecatedTest.cpp b/packages/CLI11/tests/DeprecatedTest.cpp index f763a89d4ab86209851789deff57702a955e03d3..8c45f24950e392d03b4eaf13b1afde1da3d1879a 100644 --- a/packages/CLI11/tests/DeprecatedTest.cpp +++ b/packages/CLI11/tests/DeprecatedTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/FormatterTest.cpp b/packages/CLI11/tests/FormatterTest.cpp index 1516945de96458ef905e1a301561152d3c49f8d4..7f68cf17659ec0d6e3591520298e6fd17395a7a7 100644 --- a/packages/CLI11/tests/FormatterTest.cpp +++ b/packages/CLI11/tests/FormatterTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/HelpTest.cpp b/packages/CLI11/tests/HelpTest.cpp index cb8c81ab810ec78563dacaf9ec19a98e70c5853f..eb0edd6a0ba8f8be54fc3402bacdcf601c3838ed 100644 --- a/packages/CLI11/tests/HelpTest.cpp +++ b/packages/CLI11/tests/HelpTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -105,7 +105,7 @@ TEST_CASE("THelp: deprecatedOptions", "[help]") { CLI::App app{"My prog"}; std::string x; - auto soption = app.add_option("--something", x, "My option here"); + auto *soption = app.add_option("--something", x, "My option here"); app.add_option("--something_else", x, "My option here"); std::string y; app.add_option("--another", y); @@ -159,7 +159,7 @@ TEST_CASE("THelp: retiredOptions", "[help]") { CLI::App app{"My prog"}; std::string x; - auto opt1 = app.add_option("--something", x, "My option here"); + auto *opt1 = app.add_option("--something", x, "My option here"); app.add_option("--something_else", x, "My option here"); std::string y; app.add_option("--another", y); @@ -213,7 +213,7 @@ TEST_CASE("THelp: retiredOptions3", "[help]") { TEST_CASE("THelp: HiddenGroup", "[help]") { CLI::App app{"My prog"}; // empty option group name should be hidden - auto hgroup = app.add_option_group(""); + auto *hgroup = app.add_option_group(""); std::string x; hgroup->add_option("something", x, "My option here"); std::string y; @@ -289,7 +289,8 @@ TEST_CASE("THelp: VectorOpts", "[help]") { std::string help = app.help(); - CHECK_THAT(help, Contains("INT=[1,2] ...")); + CHECK_THAT(help, Contains("[1,2]")); + CHECK_THAT(help, Contains(" ...")); } TEST_CASE("THelp: MultiPosOpts", "[help]") { @@ -394,18 +395,18 @@ TEST_CASE("THelp: ManualSetters", "[help]") { std::string help = app.help(); - CHECK_THAT(help, Contains("=12")); + CHECK_THAT(help, Contains("[12]")); CHECK_THAT(help, Contains("BIGGLES")); op1->default_val("14"); CHECK(14 == x); help = app.help(); - CHECK_THAT(help, Contains("=14")); + CHECK_THAT(help, Contains("[14]")); op1->default_val(12); CHECK(12 == x); help = app.help(); - CHECK_THAT(help, Contains("=12")); + CHECK_THAT(help, Contains("[12]")); CHECK(op1->get_run_callback_for_default()); op1->run_callback_for_default(false); @@ -415,7 +416,7 @@ TEST_CASE("THelp: ManualSetters", "[help]") { // x should not be modified in this case CHECK(12 == x); help = app.help(); - CHECK_THAT(help, Contains("=18")); + CHECK_THAT(help, Contains("[18]")); } TEST_CASE("THelp: ManualSetterOverFunction", "[help]") { @@ -432,7 +433,7 @@ TEST_CASE("THelp: ManualSetterOverFunction", "[help]") { CHECK(1 == x); std::string help = app.help(); - CHECK_THAT(help, Contains("=12")); + CHECK_THAT(help, Contains("[12]")); CHECK_THAT(help, Contains("BIGGLES")); CHECK_THAT(help, Contains("QUIGGLES")); CHECK_THAT(help, Contains("{1,2}")); @@ -441,7 +442,7 @@ TEST_CASE("THelp: ManualSetterOverFunction", "[help]") { TEST_CASE("THelp: Subcom", "[help]") { CLI::App app{"My prog"}; - auto sub1 = app.add_subcommand("sub1"); + auto *sub1 = app.add_subcommand("sub1"); app.add_subcommand("sub2"); std::string help = app.help(); @@ -455,8 +456,8 @@ TEST_CASE("THelp: Subcom", "[help]") { help = sub1->help(); CHECK_THAT(help, Contains("Usage: sub1")); - char x[] = "./myprogram"; - char y[] = "sub2"; + char x[] = "./myprogram"; // NOLINT(modernize-avoid-c-arrays) + char y[] = "sub2"; // NOLINT(modernize-avoid-c-arrays) std::vector<char *> args = {x, y}; app.parse(static_cast<int>(args.size()), args.data()); @@ -468,7 +469,7 @@ TEST_CASE("THelp: Subcom", "[help]") { TEST_CASE("THelp: Subcom_alias", "[help]") { CLI::App app{"My prog"}; - auto sub1 = app.add_subcommand("sub1", "Subcommand1 description test"); + auto *sub1 = app.add_subcommand("sub1", "Subcommand1 description test"); sub1->alias("sub_alias1"); sub1->alias("sub_alias2"); @@ -483,7 +484,7 @@ TEST_CASE("THelp: Subcom_alias", "[help]") { TEST_CASE("THelp: Subcom_alias_group", "[help]") { CLI::App app{"My prog"}; - auto sub1 = app.add_subcommand("", "Subcommand1 description test"); + auto *sub1 = app.add_subcommand("", "Subcommand1 description test"); sub1->alias("sub_alias1"); sub1->alias("sub_alias2"); @@ -498,7 +499,7 @@ TEST_CASE("THelp: Subcom_alias_group", "[help]") { TEST_CASE("THelp: MasterName", "[help]") { CLI::App app{"My prog", "MyRealName"}; - char x[] = "./myprogram"; + char x[] = "./myprogram"; // NOLINT(modernize-avoid-c-arrays) std::vector<char *> args = {x}; app.parse(static_cast<int>(args.size()), args.data()); @@ -518,7 +519,7 @@ TEST_CASE("THelp: IntDefaults", "[help]") { CHECK_THAT(help, Contains("--one")); CHECK_THAT(help, Contains("--set")); CHECK_THAT(help, Contains("1")); - CHECK_THAT(help, Contains("=2")); + CHECK_THAT(help, Contains("[2]")); CHECK_THAT(help, Contains("2,3,4")); } @@ -532,7 +533,7 @@ TEST_CASE("THelp: SetLower", "[help]") { std::string help = app.help(); CHECK_THAT(help, Contains("--set")); - CHECK_THAT(help, Contains("=One")); + CHECK_THAT(help, Contains("[One]")); CHECK_THAT(help, Contains("oNe")); CHECK_THAT(help, Contains("twO")); CHECK_THAT(help, Contains("THREE")); @@ -698,9 +699,9 @@ TEST_CASE("THelp: NiceName", "[help]") { CLI::App app; int x{0}; - auto long_name = app.add_option("-s,--long,-q,--other,that", x); - auto short_name = app.add_option("more,-x,-y", x); - auto positional = app.add_option("posit", x); + auto *long_name = app.add_option("-s,--long,-q,--other,that", x); + auto *short_name = app.add_option("more,-x,-y", x); + auto *positional = app.add_option("posit", x); CHECK("--long" == long_name->get_name()); CHECK("-x" == short_name->get_name()); @@ -767,25 +768,25 @@ struct CapturedHelp { TEST_CASE_METHOD(CapturedHelp, "Successful", "[help]") { CHECK(0 == run(CLI::Success())); - CHECK("" == out.str()); - CHECK("" == err.str()); + CHECK(out.str().empty()); + CHECK(err.str().empty()); } TEST_CASE_METHOD(CapturedHelp, "JustAnError", "[help]") { CHECK(42 == run(CLI::RuntimeError(42))); - CHECK("" == out.str()); - CHECK("" == err.str()); + CHECK(out.str().empty()); + CHECK(err.str().empty()); } TEST_CASE_METHOD(CapturedHelp, "CallForHelp", "[help]") { CHECK(0 == run(CLI::CallForHelp())); CHECK(app.help() == out.str()); - CHECK("" == err.str()); + CHECK(err.str().empty()); } TEST_CASE_METHOD(CapturedHelp, "CallForAllHelp", "[help]") { CHECK(0 == run(CLI::CallForAllHelp())); CHECK(app.help("", CLI::AppFormatMode::All) == out.str()); - CHECK("" == err.str()); + CHECK(err.str().empty()); } TEST_CASE_METHOD(CapturedHelp, "CallForAllHelpOutput", "[help]") { app.set_help_all_flag("--help-all", "Help all"); @@ -795,7 +796,7 @@ TEST_CASE_METHOD(CapturedHelp, "CallForAllHelpOutput", "[help]") { CHECK(0 == run(CLI::CallForAllHelp())); CHECK(app.help("", CLI::AppFormatMode::All) == out.str()); - CHECK("" == err.str()); + CHECK(err.str().empty()); CHECK_THAT(out.str(), Contains("one")); CHECK_THAT(out.str(), Contains("two")); CHECK_THAT(out.str(), Contains("--three")); @@ -818,12 +819,12 @@ TEST_CASE_METHOD(CapturedHelp, "NewFormattedHelp", "[help]") { app.formatter_fn([](const CLI::App *, std::string, CLI::AppFormatMode) { return "New Help"; }); CHECK(0 == run(CLI::CallForHelp())); CHECK("New Help" == out.str()); - CHECK("" == err.str()); + CHECK(err.str().empty()); } TEST_CASE_METHOD(CapturedHelp, "NormalError", "[help]") { CHECK(static_cast<int>(CLI::ExitCodes::ExtrasError) == run(CLI::ExtrasError({"Thing"}))); - CHECK("" == out.str()); + CHECK(out.str().empty()); CHECK_THAT(err.str(), Contains("for more information")); CHECK_THAT(err.str(), !Contains("ExtrasError")); CHECK_THAT(err.str(), Contains("Thing")); @@ -834,7 +835,7 @@ TEST_CASE_METHOD(CapturedHelp, "NormalError", "[help]") { TEST_CASE_METHOD(CapturedHelp, "DoubleError", "[help]") { app.set_help_all_flag("--help-all"); CHECK(static_cast<int>(CLI::ExitCodes::ExtrasError) == run(CLI::ExtrasError({"Thing"}))); - CHECK("" == out.str()); + CHECK(out.str().empty()); CHECK_THAT(err.str(), Contains("for more information")); CHECK_THAT(err.str(), Contains(" --help ")); CHECK_THAT(err.str(), Contains(" --help-all ")); @@ -848,7 +849,7 @@ TEST_CASE_METHOD(CapturedHelp, "AllOnlyError", "[help]") { app.set_help_all_flag("--help-all"); app.set_help_flag(); CHECK(static_cast<int>(CLI::ExitCodes::ExtrasError) == run(CLI::ExtrasError({"Thing"}))); - CHECK("" == out.str()); + CHECK(out.str().empty()); CHECK_THAT(err.str(), Contains("for more information")); CHECK_THAT(err.str(), !Contains(" --help ")); CHECK_THAT(err.str(), Contains(" --help-all ")); @@ -862,7 +863,7 @@ TEST_CASE_METHOD(CapturedHelp, "ReplacedError", "[help]") { app.failure_message(CLI::FailureMessage::help); CHECK(static_cast<int>(CLI::ExitCodes::ExtrasError) == run(CLI::ExtrasError({"Thing"}))); - CHECK("" == out.str()); + CHECK(out.str().empty()); CHECK_THAT(err.str(), !Contains("for more information")); CHECK_THAT(err.str(), Contains("ERROR: ExtrasError")); CHECK_THAT(err.str(), Contains("Thing")); @@ -876,7 +877,7 @@ TEST_CASE("THelp: CustomDoubleOption", "[help]") { CLI::App app; - auto opt = app.add_option("posit", [&custom_opt](CLI::results_t vals) { + auto *opt = app.add_option("posit", [&custom_opt](CLI::results_t vals) { custom_opt = {stol(vals.at(0)), stod(vals.at(1))}; return true; }); @@ -888,11 +889,19 @@ TEST_CASE("THelp: CustomDoubleOption", "[help]") { TEST_CASE("THelp: CheckEmptyTypeName", "[help]") { CLI::App app; - auto opt = app.add_flag("-f,--flag"); + auto *opt = app.add_flag("-f,--flag"); std::string name = opt->get_type_name(); CHECK(name.empty()); } +TEST_CASE("THelp: FlagDefaults", "[help]") { + CLI::App app; + + app.add_flag("-t,--not{false}")->default_str("false"); + auto str = app.help(); + CHECK_THAT(str, Contains("--not{false}")); +} + TEST_CASE("THelp: AccessDescription", "[help]") { CLI::App app{"My description goes here"}; @@ -912,7 +921,7 @@ TEST_CASE("THelp: AccessOptionDescription", "[help]") { CLI::App app{}; int x{0}; - auto opt = app.add_option("-a,--alpha", x, "My description goes here"); + auto *opt = app.add_option("-a,--alpha", x, "My description goes here"); CHECK("My description goes here" == opt->get_description()); } @@ -921,7 +930,7 @@ TEST_CASE("THelp: SetOptionDescriptionAfterCreation", "[help]") { CLI::App app{}; int x{0}; - auto opt = app.add_option("-a,--alpha", x); + auto *opt = app.add_option("-a,--alpha", x); opt->description("My description goes here"); CHECK("My description goes here" == opt->get_description()); @@ -932,7 +941,7 @@ TEST_CASE("THelp: CleanNeeds", "[help]") { CLI::App app; int x{0}; - auto a_name = app.add_option("-a,--alpha", x); + auto *a_name = app.add_option("-a,--alpha", x); app.add_option("-b,--boo", x)->needs(a_name); CHECK_THAT(app.help(), !Contains("Requires")); @@ -1162,7 +1171,9 @@ TEST_CASE("THelp: ChangingDefaults", "[help]") { x = {5, 6}; std::string help = app.help(); - CHECK_THAT(help, Contains("INT=[3,4] ...")); + CHECK_THAT(help, Contains("[[3,4]]")); + CHECK_THAT(help, Contains("...")); + CHECK_THAT(help, Contains("INT")); CHECK(x[0] == 5); } @@ -1179,7 +1190,8 @@ TEST_CASE("THelp: ChangingDefaultsWithAutoCapture", "[help]") { std::string help = app.help(); - CHECK_THAT(help, Contains("INT=[1,2] ...")); + CHECK_THAT(help, Contains("[[1,2]]")); + CHECK_THAT(help, Contains("...")); } TEST_CASE("THelp: FunctionDefaultString", "[help]") { @@ -1194,7 +1206,7 @@ TEST_CASE("THelp: FunctionDefaultString", "[help]") { std::string help = app.help(); - CHECK_THAT(help, Contains("INT=Powerful")); + CHECK_THAT(help, Contains("[Powerful]")); } TEST_CASE("TVersion: simple_flag", "[help]") { @@ -1248,7 +1260,7 @@ TEST_CASE("TVersion: parse_throw", "[help]") { CHECK_THROWS_AS(app.parse("--version"), CLI::CallForVersion); CHECK_THROWS_AS(app.parse("--version --arg2 5"), CLI::CallForVersion); - auto ptr = app.get_version_ptr(); + auto *ptr = app.get_version_ptr(); ptr->ignore_case(); try { @@ -1257,7 +1269,7 @@ TEST_CASE("TVersion: parse_throw", "[help]") { CHECK_THAT(CLI11_VERSION, Catch::Equals(v.what())); CHECK(0 == v.get_exit_code()); const auto &appc = app; - auto cptr = appc.get_version_ptr(); + const auto *cptr = appc.get_version_ptr(); CHECK(1U == cptr->count()); } } diff --git a/packages/CLI11/tests/HelpersTest.cpp b/packages/CLI11/tests/HelpersTest.cpp index 7a497aa1cb05c0af6b77e5668063f57f9525c9bf..798a6d13d5e06767946f76863dc32fa6edd942ba 100644 --- a/packages/CLI11/tests/HelpersTest.cpp +++ b/packages/CLI11/tests/HelpersTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,6 +6,8 @@ #include "app_helper.hpp" +#include <cmath> + #include <array> #include <atomic> #include <complex> @@ -27,7 +29,7 @@ std::ostream &operator<<(std::ostream &out, const Streamable &) { return out << TEST_CASE("TypeTools: Streaming", "[helpers]") { - CHECK("" == CLI::detail::to_string(NotStreamable{})); + CHECK(CLI::detail::to_string(NotStreamable{}).empty()); CHECK("Streamable" == CLI::detail::to_string(Streamable{})); @@ -148,7 +150,7 @@ TEST_CASE("Split: Single", "[helpers]") { TEST_CASE("Split: Empty", "[helpers]") { auto out = CLI::detail::split("", '.'); REQUIRE(out.size() == 1u); - CHECK(out.at(0) == ""); + CHECK(out.at(0).empty()); } TEST_CASE("String: InvalidName", "[helpers]") { @@ -298,19 +300,40 @@ TEST_CASE("Validators: FileNotExists", "[helpers]") { CHECK(CLI::NonexistentPath(myfile).empty()); } +TEST_CASE("Validators: FilePathModifier", "[helpers]") { + std::string myfile{"../TestFileNotUsed_1.txt"}; + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file + CHECK(ok); + std::string filename = "TestFileNotUsed_1.txt"; + CLI::FileOnDefaultPath defPath("../"); + CHECK(defPath(filename).empty()); + CHECK(filename == myfile); + std::string filename2 = "nonexistingfile.csv"; + CHECK_FALSE(defPath(filename2).empty()); + // check it didn't modify the string + CHECK(filename2 == "nonexistingfile.csv"); + CHECK(defPath(filename).empty()); + std::remove(myfile.c_str()); + CHECK_FALSE(defPath(myfile).empty()); + // now test the no error version + CLI::FileOnDefaultPath defPathNoFail("../", false); + CHECK(defPathNoFail(filename2).empty()); + CHECK(filename2 == "nonexistingfile.csv"); +} + TEST_CASE("Validators: FileIsDir", "[helpers]") { std::string mydir{"../tests"}; - CHECK("" != CLI::ExistingFile(mydir)); + CHECK(!CLI::ExistingFile(mydir).empty()); } TEST_CASE("Validators: DirectoryExists", "[helpers]") { std::string mydir{"../tests"}; - CHECK("" == CLI::ExistingDirectory(mydir)); + CHECK(CLI::ExistingDirectory(mydir).empty()); } TEST_CASE("Validators: DirectoryNotExists", "[helpers]") { std::string mydir{"nondirectory"}; - CHECK("" != CLI::ExistingDirectory(mydir)); + CHECK(!CLI::ExistingDirectory(mydir).empty()); } TEST_CASE("Validators: DirectoryIsFile", "[helpers]") { @@ -326,7 +349,7 @@ TEST_CASE("Validators: DirectoryIsFile", "[helpers]") { TEST_CASE("Validators: PathExistsDir", "[helpers]") { std::string mydir{"../tests"}; - CHECK("" == CLI::ExistingPath(mydir)); + CHECK(CLI::ExistingPath(mydir).empty()); } TEST_CASE("Validators: PathExistsFile", "[helpers]") { @@ -342,7 +365,7 @@ TEST_CASE("Validators: PathExistsFile", "[helpers]") { TEST_CASE("Validators: PathNotExistsDir", "[helpers]") { std::string mydir{"nonpath"}; - CHECK("" != CLI::ExistingPath(mydir)); + CHECK(!CLI::ExistingPath(mydir).empty()); } TEST_CASE("Validators: IPValidate1", "[helpers]") { @@ -520,68 +543,68 @@ TEST_CASE("CheckedMultiply: Int", "[helpers]") { REQUIRE(CLI::detail::checked_multiply(a, b)); REQUIRE(0 == a); - a = std::numeric_limits<int>::max(); + a = (std::numeric_limits<int>::max)(); b = 1; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::max() == a); + REQUIRE((std::numeric_limits<int>::max)() == a); - a = std::numeric_limits<int>::max(); + a = (std::numeric_limits<int>::max)(); b = 2; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::max() == a); + REQUIRE((std::numeric_limits<int>::max)() == a); - a = std::numeric_limits<int>::max(); + a = (std::numeric_limits<int>::max)(); b = -1; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(-std::numeric_limits<int>::max() == a); + REQUIRE(-(std::numeric_limits<int>::max)() == a); - a = std::numeric_limits<int>::max(); - b = std::numeric_limits<int>::max(); + a = (std::numeric_limits<int>::max)(); + b = (std::numeric_limits<int>::max)(); REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::max() == a); + REQUIRE((std::numeric_limits<int>::max)() == a); - a = std::numeric_limits<int>::min(); - b = std::numeric_limits<int>::max(); + a = (std::numeric_limits<int>::min)(); + b = (std::numeric_limits<int>::max)(); REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::min() == a); + REQUIRE((std::numeric_limits<int>::min)() == a); - a = std::numeric_limits<int>::min(); + a = (std::numeric_limits<int>::min)(); b = 1; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::min() == a); + REQUIRE((std::numeric_limits<int>::min)() == a); - a = std::numeric_limits<int>::min(); + a = (std::numeric_limits<int>::min)(); b = -1; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::min() == a); + REQUIRE((std::numeric_limits<int>::min)() == a); - b = std::numeric_limits<int>::min(); + b = (std::numeric_limits<int>::min)(); a = -1; REQUIRE(!CLI::detail::checked_multiply(a, b)); REQUIRE(-1 == a); - a = std::numeric_limits<int>::min() / 100; + a = (std::numeric_limits<int>::min)() / 100; b = 99; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::min() / 100 * 99 == a); + REQUIRE((std::numeric_limits<int>::min)() / 100 * 99 == a); - a = std::numeric_limits<int>::min() / 100; + a = (std::numeric_limits<int>::min)() / 100; b = -101; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<int>::min() / 100 == a); + REQUIRE((std::numeric_limits<int>::min)() / 100 == a); a = 2; - b = std::numeric_limits<int>::min() / 2; + b = (std::numeric_limits<int>::min)() / 2; REQUIRE(CLI::detail::checked_multiply(a, b)); - a = std::numeric_limits<int>::min() / 2; + a = (std::numeric_limits<int>::min)() / 2; b = 2; REQUIRE(CLI::detail::checked_multiply(a, b)); a = 4; - b = std::numeric_limits<int>::min() / 4; + b = (std::numeric_limits<int>::min)() / 4; REQUIRE(CLI::detail::checked_multiply(a, b)); a = 48; - b = std::numeric_limits<int>::min() / 48; + b = (std::numeric_limits<int>::min)() / 48; REQUIRE(CLI::detail::checked_multiply(a, b)); } @@ -601,25 +624,25 @@ TEST_CASE("CheckedMultiply: SizeT", "[helpers]") { REQUIRE(CLI::detail::checked_multiply(a, b)); REQUIRE(0u == a); - a = std::numeric_limits<std::size_t>::max(); + a = (std::numeric_limits<std::size_t>::max)(); b = 1u; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<std::size_t>::max() == a); + REQUIRE((std::numeric_limits<std::size_t>::max)() == a); - a = std::numeric_limits<std::size_t>::max(); + a = (std::numeric_limits<std::size_t>::max)(); b = 2u; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<std::size_t>::max() == a); + REQUIRE((std::numeric_limits<std::size_t>::max)() == a); - a = std::numeric_limits<std::size_t>::max(); - b = std::numeric_limits<std::size_t>::max(); + a = (std::numeric_limits<std::size_t>::max)(); + b = (std::numeric_limits<std::size_t>::max)(); REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<std::size_t>::max() == a); + REQUIRE((std::numeric_limits<std::size_t>::max)() == a); - a = std::numeric_limits<std::size_t>::max() / 100; + a = (std::numeric_limits<std::size_t>::max)() / 100; b = 99u; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<std::size_t>::max() / 100u * 99u == a); + REQUIRE((std::numeric_limits<std::size_t>::max)() / 100u * 99u == a); } TEST_CASE("CheckedMultiply: Float", "[helpers]") { @@ -643,30 +666,30 @@ TEST_CASE("CheckedMultiply: Float", "[helpers]") { REQUIRE(CLI::detail::checked_multiply(a, b)); REQUIRE(-INFINITY == Approx(a)); - a = std::numeric_limits<float>::max() / 100.0F; + a = (std::numeric_limits<float>::max)() / 100.0F; b = 1.0F; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<float>::max() / 100.0F == Approx(a)); + REQUIRE((std::numeric_limits<float>::max)() / 100.0F == Approx(a)); - a = std::numeric_limits<float>::max() / 100.0F; + a = (std::numeric_limits<float>::max)() / 100.0F; b = 99.0F; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<float>::max() / 100.0F * 99.0F == Approx(a)); + REQUIRE((std::numeric_limits<float>::max)() / 100.0F * 99.0F == Approx(a)); - a = std::numeric_limits<float>::max() / 100.0F; + a = (std::numeric_limits<float>::max)() / 100.0F; b = 101; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<float>::max() / 100.0F == Approx(a)); + REQUIRE((std::numeric_limits<float>::max)() / 100.0F == Approx(a)); - a = std::numeric_limits<float>::max() / 100.0F; + a = (std::numeric_limits<float>::max)() / 100.0F; b = -99; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<float>::max() / 100.0F * -99.0F == Approx(a)); + REQUIRE((std::numeric_limits<float>::max)() / 100.0F * -99.0F == Approx(a)); - a = std::numeric_limits<float>::max() / 100.0F; + a = (std::numeric_limits<float>::max)() / 100.0F; b = -101; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<float>::max() / 100.0F == Approx(a)); + REQUIRE((std::numeric_limits<float>::max)() / 100.0F == Approx(a)); } TEST_CASE("CheckedMultiply: Double", "[helpers]") { @@ -680,40 +703,40 @@ TEST_CASE("CheckedMultiply: Double", "[helpers]") { REQUIRE(CLI::detail::checked_multiply(a, b)); REQUIRE(0 == Approx(a)); - a = INFINITY; + a = std::numeric_limits<double>::infinity(); b = 20; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(INFINITY == Approx(a)); + REQUIRE(std::numeric_limits<double>::infinity() == Approx(a)); a = 2; - b = -INFINITY; + b = -std::numeric_limits<double>::infinity(); REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(-INFINITY == Approx(a)); + REQUIRE(-std::numeric_limits<double>::infinity() == Approx(a)); - a = std::numeric_limits<double>::max() / 100; + a = (std::numeric_limits<double>::max)() / 100; b = 1; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<double>::max() / 100 == Approx(a)); + REQUIRE((std::numeric_limits<double>::max)() / 100 == Approx(a)); - a = std::numeric_limits<double>::max() / 100; + a = (std::numeric_limits<double>::max)() / 100; b = 99; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<double>::max() / 100 * 99 == Approx(a)); + REQUIRE((std::numeric_limits<double>::max)() / 100 * 99 == Approx(a)); - a = std::numeric_limits<double>::max() / 100; + a = (std::numeric_limits<double>::max)() / 100; b = 101; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<double>::max() / 100 == Approx(a)); + REQUIRE((std::numeric_limits<double>::max)() / 100 == Approx(a)); - a = std::numeric_limits<double>::max() / 100; + a = (std::numeric_limits<double>::max)() / 100; b = -99; REQUIRE(CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<double>::max() / 100 * -99 == Approx(a)); + REQUIRE((std::numeric_limits<double>::max)() / 100 * -99 == Approx(a)); - a = std::numeric_limits<double>::max() / 100; + a = (std::numeric_limits<double>::max)() / 100; b = -101; REQUIRE(!CLI::detail::checked_multiply(a, b)); - REQUIRE(std::numeric_limits<double>::max() / 100 == Approx(a)); + REQUIRE((std::numeric_limits<double>::max)() / 100 == Approx(a)); } // Yes, this is testing an app_helper :) @@ -774,11 +797,11 @@ TEST_CASE("RegEx: Shorts", "[helpers]") { CHECK(CLI::detail::split_short("-a", name, value)); CHECK(name == "a"); - CHECK(value == ""); + CHECK(value.empty()); CHECK(CLI::detail::split_short("-B", name, value)); CHECK(name == "B"); - CHECK(value == ""); + CHECK(value.empty()); CHECK(CLI::detail::split_short("-cc", name, value)); CHECK(name == "c"); @@ -800,11 +823,11 @@ TEST_CASE("RegEx: Longs", "[helpers]") { CHECK(CLI::detail::split_long("--a", name, value)); CHECK(name == "a"); - CHECK(value == ""); + CHECK(value.empty()); CHECK(CLI::detail::split_long("--thing", name, value)); CHECK(name == "thing"); - CHECK(value == ""); + CHECK(value.empty()); CHECK(CLI::detail::split_long("--some=thing", name, value)); CHECK(name == "some"); @@ -825,7 +848,7 @@ TEST_CASE("RegEx: SplittingNew", "[helpers]") { CHECK_NOTHROW(std::tie(shorts, longs, pname) = CLI::detail::get_names({"--long", "-s", "-q", "--also-long"})); CHECK(longs == std::vector<std::string>({"long", "also-long"})); CHECK(shorts == std::vector<std::string>({"s", "q"})); - CHECK(pname == ""); + CHECK(pname.empty()); std::tie(shorts, longs, pname) = CLI::detail::get_names({"--long", "", "-s", "-q", "", "--also-long"}); CHECK(longs == std::vector<std::string>({"long", "also-long"})); @@ -1007,33 +1030,33 @@ TEST_CASE("Types: TypeName", "[helpers]") { } TEST_CASE("Types: OverflowSmall", "[helpers]") { - signed char x; - auto strmax = std::to_string(std::numeric_limits<signed char>::max() + 1); + signed char x = 0; + auto strmax = std::to_string((std::numeric_limits<signed char>::max)() + 1); CHECK_FALSE(CLI::detail::lexical_cast(strmax, x)); - unsigned char y; - strmax = std::to_string(std::numeric_limits<unsigned char>::max() + 1); + unsigned char y = 0; + strmax = std::to_string((std::numeric_limits<unsigned char>::max)() + 1); CHECK_FALSE(CLI::detail::lexical_cast(strmax, y)); } TEST_CASE("Types: LexicalCastInt", "[helpers]") { std::string signed_input = "-912"; - int x_signed; + int x_signed = 0; CHECK(CLI::detail::lexical_cast(signed_input, x_signed)); CHECK(x_signed == -912); std::string unsigned_input = "912"; - unsigned int x_unsigned; + unsigned int x_unsigned = 0; CHECK(CLI::detail::lexical_cast(unsigned_input, x_unsigned)); CHECK(x_unsigned == (unsigned int)912); CHECK_FALSE(CLI::detail::lexical_cast(signed_input, x_unsigned)); - unsigned char y; - std::string overflow_input = std::to_string(std::numeric_limits<uint64_t>::max()) + "0"; + unsigned char y = 0; + std::string overflow_input = std::to_string((std::numeric_limits<uint64_t>::max)()) + "0"; CHECK_FALSE(CLI::detail::lexical_cast(overflow_input, y)); - char y_signed; + char y_signed = 0; CHECK_FALSE(CLI::detail::lexical_cast(overflow_input, y_signed)); std::string bad_input = "hello"; @@ -1050,14 +1073,14 @@ TEST_CASE("Types: LexicalCastInt", "[helpers]") { TEST_CASE("Types: LexicalCastDouble", "[helpers]") { std::string input = "9.12"; - long double x; + long double x = NAN; CHECK(CLI::detail::lexical_cast(input, x)); CHECK((float)x == Approx((float)9.12)); std::string bad_input = "hello"; CHECK_FALSE(CLI::detail::lexical_cast(bad_input, x)); - std::string overflow_input = "1" + std::to_string(std::numeric_limits<long double>::max()); + std::string overflow_input = "1" + std::to_string((std::numeric_limits<long double>::max)()); CHECK(CLI::detail::lexical_cast(overflow_input, x)); CHECK_FALSE(std::isfinite(x)); @@ -1070,7 +1093,7 @@ TEST_CASE("Types: LexicalCastDouble", "[helpers]") { TEST_CASE("Types: LexicalCastBool", "[helpers]") { std::string input = "false"; - bool x; + bool x = false; CHECK(CLI::detail::lexical_cast(input, x)); CHECK_FALSE(x); @@ -1110,7 +1133,7 @@ TEST_CASE("Types: LexicalCastParsable", "[helpers]") { TEST_CASE("Types: LexicalCastEnum", "[helpers]") { enum t1 : signed char { v1 = 5, v3 = 7, v5 = -9 }; - t1 output; + t1 output = v1; CHECK(CLI::detail::lexical_cast("-9", output)); CHECK(v5 == output); diff --git a/packages/CLI11/tests/NewParseTest.cpp b/packages/CLI11/tests/NewParseTest.cpp index 30a0c9f41239ebc619dab762206437ce4b883096..a4ca09987afebfbfdcac84fdeb08f75f8aa532f7 100644 --- a/packages/CLI11/tests/NewParseTest.cpp +++ b/packages/CLI11/tests/NewParseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -8,6 +8,7 @@ #include <complex> #include <cstdint> +#include <utility> using Catch::Matchers::Contains; @@ -158,7 +159,7 @@ TEST_CASE_METHOD(TApp, "ComplexSingleImagOption", "[newparse]") { class spair { public: spair() = default; - spair(const std::string &s1, const std::string &s2) : first(s1), second(s2) {} + spair(std::string s1, std::string s2) : first(std::move(s1)), second(std::move(s2)) {} std::string first{}; std::string second{}; }; @@ -205,15 +206,16 @@ TEST_CASE_METHOD(TApp, "custom_string_converterFail", "[newparse]") { template <class X> class objWrapper { public: objWrapper() = default; - explicit objWrapper(X obj) : val_{obj} {}; + explicit objWrapper(X obj) : val_{std::move(obj)} {}; objWrapper(const objWrapper &ow) = default; template <class TT> objWrapper(const TT &obj) = delete; objWrapper &operator=(const objWrapper &) = default; - objWrapper &operator=(objWrapper &&) = default; + // noexcept not allowed below by GCC 4.8 + objWrapper &operator=(objWrapper &&) = default; // NOLINT(performance-noexcept-move-constructor) // delete all other assignment operators template <typename TT> void operator=(TT &&obj) = delete; - const X &value() const { return val_; } + CLI11_NODISCARD const X &value() const { return val_; } private: X val_{}; @@ -312,8 +314,8 @@ class dobjWrapper { explicit dobjWrapper(double obj) : dval_{obj} {}; explicit dobjWrapper(int obj) : ival_{obj} {}; - double dvalue() const { return dval_; } - int ivalue() const { return ival_; } + CLI11_NODISCARD double dvalue() const { return dval_; } + CLI11_NODISCARD int ivalue() const { return ival_; } private: double dval_{0.0}; @@ -357,7 +359,7 @@ template <class X> class AobjWrapper { // delete all other assignment operators template <typename TT> void operator=(TT &&obj) = delete; - const X &value() const { return val_; } + CLI11_NODISCARD const X &value() const { return val_; } private: X val_{}; @@ -389,13 +391,14 @@ TEST_CASE_METHOD(TApp, "uint16Wrapper", "[newparse]") { template <class T> class SimpleWrapper { public: - SimpleWrapper() : val_{} {}; - explicit SimpleWrapper(const T &initial) : val_{initial} {}; + SimpleWrapper() = default; + + explicit SimpleWrapper(T initial) : val_{std::move(initial)} {}; T &getRef() { return val_; } using value_type = T; private: - T val_; + T val_{}; }; TEST_CASE_METHOD(TApp, "wrapperInt", "[newparse]") { @@ -434,13 +437,13 @@ TEST_CASE_METHOD(TApp, "wrapperwrapperString", "[newparse]") { run(); auto v1 = wrap.getRef().getRef(); - auto v2 = "arg"; + const auto *v2 = "arg"; CHECK(v2 == v1); } TEST_CASE_METHOD(TApp, "wrapperwrapperVector", "[newparse]") { SimpleWrapper<SimpleWrapper<std::vector<int>>> wrap; - auto opt = app.add_option("--val", wrap); + auto *opt = app.add_option("--val", wrap); args = {"--val", "1", "2", "3", "4"}; run(); diff --git a/packages/CLI11/tests/OptionGroupTest.cpp b/packages/CLI11/tests/OptionGroupTest.cpp index ac6684f49407ff490a5878759ea8421449c3560d..bc3a9455ff71bcfaaa35edb8acfd18a238818edd 100644 --- a/packages/CLI11/tests/OptionGroupTest.cpp +++ b/packages/CLI11/tests/OptionGroupTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -11,8 +11,8 @@ using Catch::Matchers::Contains; using vs_t = std::vector<std::string>; TEST_CASE_METHOD(TApp, "BasicOptionGroup", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); - int res; + auto *ogroup = app.add_option_group("clusters"); + int res = 0; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); ogroup->add_option("--test3", res); @@ -34,7 +34,7 @@ TEST_CASE_METHOD(TApp, "OptionGroupInvalidNames", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupExact", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -58,7 +58,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupExact", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupExactTooMany", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -71,7 +71,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupExactTooMany", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMax", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -95,7 +95,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMax", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMaxDifferent", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -123,7 +123,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMaxDifferent", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMaxDifferentReversed", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -155,12 +155,12 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMaxDifferentReversed", "[optiongroup] } TEST_CASE_METHOD(TApp, "BasicOptionGroupMax", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); ogroup->add_option("--test3", res); - int val2; + int val2 = 0; app.add_option("--option", val2); ogroup->require_option(-2); args = {"--test1", "5"}; @@ -179,7 +179,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMax", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMax1", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -203,7 +203,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMax1", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMin", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -224,7 +224,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMin", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupExact2", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -248,7 +248,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupExact2", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "BasicOptionGroupMin2", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); ogroup->add_option("--test2", res); @@ -271,13 +271,13 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMin2", "[optiongroup]") { TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMoved", "[optiongroup]") { int res{0}; - auto opt1 = app.add_option("--test1", res); - auto opt2 = app.add_option("--test2", res); - auto opt3 = app.add_option("--test3", res); + auto *opt1 = app.add_option("--test1", res); + auto *opt2 = app.add_option("--test2", res); + auto *opt3 = app.add_option("--test3", res); int val2{0}; app.add_option("--option", val2); - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); ogroup->require_option(); ogroup->add_option(opt1); ogroup->add_option(opt2); @@ -300,13 +300,13 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMoved", "[optiongroup]") { TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMovedAsGroup", "[optiongroup]") { int res{0}; - auto opt1 = app.add_option("--test1", res); - auto opt2 = app.add_option("--test2", res); - auto opt3 = app.add_option("--test3", res); + auto *opt1 = app.add_option("--test1", res); + auto *opt2 = app.add_option("--test2", res); + auto *opt3 = app.add_option("--test3", res); int val2{0}; app.add_option("--option", val2); - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); ogroup->require_option(); ogroup->add_options(opt1, opt2, opt3); @@ -328,17 +328,17 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupMinMovedAsGroup", "[optiongroup]") { TEST_CASE_METHOD(TApp, "BasicOptionGroupAddFailures", "[optiongroup]") { int res{0}; - auto opt1 = app.add_option("--test1", res); + auto *opt1 = app.add_option("--test1", res); app.set_config("--config"); int val2{0}; app.add_option("--option", val2); - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); CHECK_THROWS_AS(ogroup->add_options(app.get_config_ptr()), CLI::OptionAlreadyAdded); CHECK_THROWS_AS(ogroup->add_options(app.get_help_ptr()), CLI::OptionAlreadyAdded); - auto sub = app.add_subcommand("sub", "subcommand"); - auto opt2 = sub->add_option("--option2", val2); + auto *sub = app.add_subcommand("sub", "subcommand"); + auto *opt2 = sub->add_option("--option2", val2); CHECK_THROWS_AS(ogroup->add_option(opt2), CLI::OptionNotFound); @@ -346,7 +346,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupAddFailures", "[optiongroup]") { ogroup->add_option(opt1); - auto opt3 = app.add_option("--test1", res); + auto *opt3 = app.add_option("--test1", res); CHECK_THROWS_AS(ogroup->add_option(opt3), CLI::OptionAlreadyAdded); } @@ -354,14 +354,14 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupAddFailures", "[optiongroup]") { TEST_CASE_METHOD(TApp, "BasicOptionGroupScrewedUpMove", "[optiongroup]") { int res{0}; - auto opt1 = app.add_option("--test1", res); - auto opt2 = app.add_option("--test2", res); + auto *opt1 = app.add_option("--test1", res); + auto *opt2 = app.add_option("--test2", res); int val2{0}; app.add_option("--option", val2); - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); ogroup->require_option(); - auto ogroup2 = ogroup->add_option_group("clusters2"); + auto *ogroup2 = ogroup->add_option_group("clusters2"); CHECK_THROWS_AS(ogroup2->add_options(opt1, opt2), CLI::OptionNotFound); CLI::Option_group EmptyGroup("description", "new group", nullptr); @@ -371,7 +371,7 @@ TEST_CASE_METHOD(TApp, "BasicOptionGroupScrewedUpMove", "[optiongroup]") { } TEST_CASE_METHOD(TApp, "InvalidOptions", "[optiongroup]") { - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); CLI::Option *opt = nullptr; CHECK_THROWS_AS(ogroup->excludes(opt), CLI::OptionNotFound); CLI::App *app_p = nullptr; @@ -382,7 +382,7 @@ TEST_CASE_METHOD(TApp, "InvalidOptions", "[optiongroup]") { TEST_CASE_METHOD(TApp, "OptionGroupInheritedOptionDefaults", "[optiongroup]") { app.option_defaults()->ignore_case(); - auto ogroup = app.add_option_group("clusters"); + auto *ogroup = app.add_option_group("clusters"); int res{0}; ogroup->add_option("--test1", res); @@ -421,7 +421,7 @@ struct ManyGroups : public TApp { g3->add_option("--val3", val3); } - void remove_required() { + void remove_required() { // NOLINT(readability-make-member-function-const) g1->get_option("--name1")->required(false); g2->get_option("--name2")->required(false); g3->get_option("--name3")->required(false); @@ -486,8 +486,8 @@ TEST_CASE_METHOD(ManyGroups, "NeedsGroup", "[optiongroup]") { // test adding an option group with existing subcommands to an app TEST_CASE_METHOD(TApp, "ExistingSubcommandMatch", "[optiongroup]") { auto sshared = std::make_shared<CLI::Option_group>("documenting the subcommand", "sub1g", nullptr); - auto s1 = sshared->add_subcommand("sub1"); - auto o1 = sshared->add_option_group("opt1"); + auto *s1 = sshared->add_subcommand("sub1"); + auto *o1 = sshared->add_option_group("opt1"); o1->add_subcommand("sub3")->alias("sub4"); app.add_subcommand("sub1"); @@ -597,9 +597,9 @@ TEST_CASE_METHOD(ManyGroups, "DisableFirst", "[optiongroup]") { TEST_CASE_METHOD(ManyGroups, "SameSubcommand", "[optiongroup]") { // only 1 group can be used if remove_required not used remove_required(); - auto sub1 = g1->add_subcommand("sub1")->disabled(); - auto sub2 = g2->add_subcommand("sub1")->disabled(); - auto sub3 = g3->add_subcommand("sub1"); + auto *sub1 = g1->add_subcommand("sub1")->disabled(); + auto *sub2 = g2->add_subcommand("sub1")->disabled(); + auto *sub3 = g3->add_subcommand("sub1"); // so when the subcommands are disabled they can have the same name sub1->disabled(false); sub2->disabled(false); @@ -679,7 +679,7 @@ TEST_CASE_METHOD(ManyGroups, "Inheritance", "[optiongroup]") { remove_required(); g1->ignore_case(); g1->ignore_underscore(); - auto t2 = g1->add_subcommand("t2"); + auto *t2 = g1->add_subcommand("t2"); args = {"T2", "t_2"}; CHECK(t2->get_ignore_underscore()); CHECK(t2->get_ignore_case()); @@ -689,7 +689,7 @@ TEST_CASE_METHOD(ManyGroups, "Inheritance", "[optiongroup]") { TEST_CASE_METHOD(ManyGroups, "Moving", "[optiongroup]") { remove_required(); - auto mg = app.add_option_group("maing"); + auto *mg = app.add_option_group("maing"); mg->add_subcommand(g1); mg->add_subcommand(g2); @@ -767,11 +767,11 @@ TEST_CASE_METHOD(ManyGroupsPreTrigger, "PreTriggerTestsPositionals", "[optiongro TEST_CASE_METHOD(ManyGroupsPreTrigger, "PreTriggerTestsSubcommand", "[optiongroup]") { - auto sub1 = g1->add_subcommand("sub1")->fallthrough(); + auto *sub1 = g1->add_subcommand("sub1")->fallthrough(); g2->add_subcommand("sub2")->fallthrough(); g3->add_subcommand("sub3")->fallthrough(); - std::size_t subtrigger; + std::size_t subtrigger = 0; sub1->preparse_callback([&subtrigger](std::size_t count) { subtrigger = count; }); args = {"sub1"}; run(); diff --git a/packages/CLI11/tests/OptionTypeTest.cpp b/packages/CLI11/tests/OptionTypeTest.cpp index 19b69746c825871713be3e0d5f14be005ba236ee..b48ba6d5bb85252c5f2593420783bca7aee9c790 100644 --- a/packages/CLI11/tests/OptionTypeTest.cpp +++ b/packages/CLI11/tests/OptionTypeTest.cpp @@ -1,11 +1,13 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // // SPDX-License-Identifier: BSD-3-Clause #include "app_helper.hpp" + #include <atomic> +#include <cmath> #include <complex> #include <cstdint> #include <cstdlib> @@ -17,8 +19,11 @@ #include <set> #include <unordered_map> #include <unordered_set> +#include <utility> #include <vector> +using Catch::literals::operator"" _a; + TEST_CASE_METHOD(TApp, "OneStringAgain", "[optiontype]") { std::string str; app.add_option("-s,--string", str); @@ -44,13 +49,13 @@ TEST_CASE_METHOD(TApp, "doubleFunction", "[optiontype]") { app.add_option_function<double>("--val", [&res](double val) { res = std::abs(val + 54); }); args = {"--val", "-354.356"}; run(); - CHECK(300.356 == res); + CHECK(300.356_a == res); // get the original value as entered as an integer - CHECK(-354.356f == app["--val"]->as<float>()); + CHECK(-354.356_a == app["--val"]->as<float>()); } TEST_CASE_METHOD(TApp, "doubleFunctionFail", "[optiontype]") { - double res; + double res = NAN; app.add_option_function<double>("--val", [&res](double val) { res = std::abs(val + 54); }); args = {"--val", "not_double"}; CHECK_THROWS_AS(run(), CLI::ConversionError); @@ -65,8 +70,8 @@ TEST_CASE_METHOD(TApp, "doubleVectorFunction", "[optiontype]") { args = {"--val", "5", "--val", "6", "--val", "7"}; run(); CHECK(3u == res.size()); - CHECK(10.0 == res[0]); - CHECK(12.0 == res[2]); + CHECK(10.0_a == res[0]); + CHECK(12.0_a == res[2]); } TEST_CASE_METHOD(TApp, "doubleVectorFunctionFail", "[optiontype]") { @@ -86,7 +91,7 @@ TEST_CASE_METHOD(TApp, "doubleVectorFunctionFail", "[optiontype]") { TEST_CASE_METHOD(TApp, "doubleVectorFunctionRunCallbackOnDefault", "[optiontype]") { std::vector<double> res; - auto opt = app.add_option_function<std::vector<double>>("--val", [&res](const std::vector<double> &val) { + auto *opt = app.add_option_function<std::vector<double>>("--val", [&res](const std::vector<double> &val) { res = val; std::transform(res.begin(), res.end(), res.begin(), [](double v) { return v + 5.0; }); }); @@ -146,7 +151,7 @@ TEST_CASE_METHOD(TApp, "atomic_bool_flags", "[optiontype]") { std::atomic<int> iflag{0}; app.add_flag("-b", bflag); - app.add_flag("-i,--int", iflag); + app.add_flag("-i,--int", iflag)->multi_option_policy(CLI::MultiOptionPolicy::Sum); args = {"-b", "-i"}; run(); @@ -195,7 +200,7 @@ TEST_CASE_METHOD(TApp, "BoolOption", "[optiontype]") { TEST_CASE_METHOD(TApp, "atomic_int_option", "[optiontype]") { std::atomic<int> i{0}; - auto aopt = app.add_option("-i,--int", i); + auto *aopt = app.add_option("-i,--int", i); args = {"-i4"}; run(); CHECK(app.count("--int") == 1u); @@ -240,7 +245,7 @@ TEST_CASE_METHOD(TApp, "CharOption", "[optiontype]") { TEST_CASE_METHOD(TApp, "vectorDefaults", "[optiontype]") { std::vector<int> vals{4, 5}; - auto opt = app.add_option("--long", vals)->capture_default_str(); + auto *opt = app.add_option("--long", vals)->capture_default_str(); args = {"--long", "[1,2,3]"}; @@ -286,7 +291,7 @@ TEST_CASE_METHOD(TApp, "CallbackBoolFlags", "[optiontype]") { auto func = [&value]() { value = true; }; - auto cback = app.add_flag_callback("--val", func); + auto *cback = app.add_flag_callback("--val", func); args = {"--val"}; run(); CHECK(value); @@ -339,7 +344,7 @@ TEST_CASE_METHOD(TApp, "pair_check_take_first", "[optiontype]") { CHECK(CLI::ExistingFile(myfile).empty()); std::pair<std::string, int> findex; - auto opt = app.add_option("--file", findex)->check(CLI::ExistingFile)->check(CLI::PositiveNumber); + auto *opt = app.add_option("--file", findex)->check(CLI::ExistingFile)->check(CLI::PositiveNumber); CHECK_THROWS_AS(opt->get_validator(3), CLI::OptionNotFound); opt->get_validator(0)->application_index(0); opt->get_validator(1)->application_index(1); @@ -422,7 +427,7 @@ TEST_CASE_METHOD(TApp, "VectorUnlimString", "[optiontype]") { // From https://github.com/CLIUtils/CLI11/issues/420 TEST_CASE_METHOD(TApp, "stringLikeTests", "[optiontype]") { struct nType { - explicit nType(const std::string &a_value) : m_value{a_value} {} + explicit nType(std::string a_value) : m_value{std::move(a_value)} {} explicit operator std::string() const { return std::string{"op str"}; } @@ -492,7 +497,7 @@ TEST_CASE_METHOD(TApp, "CustomDoubleOption", "[optiontype]") { std::pair<int, double> custom_opt; - auto opt = app.add_option("posit", [&custom_opt](CLI::results_t vals) { + auto *opt = app.add_option("posit", [&custom_opt](CLI::results_t vals) { custom_opt = {stol(vals.at(0)), stod(vals.at(1))}; return true; }); @@ -519,12 +524,32 @@ TEST_CASE_METHOD(TApp, "CustomDoubleOptionAlt", "[optiontype]") { CHECK(1.5 == Approx(custom_opt.second)); } +// now with tuple support this is possible +TEST_CASE_METHOD(TApp, "floatPair", "[optiontype]") { + + std::pair<float, float> custom_opt; + + auto *opt = app.add_option("--fp", custom_opt)->delimiter(','); + opt->default_str("3.4,2.7"); + + args = {"--fp", "12", "1.5"}; + + run(); + CHECK(12.0f == Approx(custom_opt.first)); + CHECK(1.5f == Approx(custom_opt.second)); + args = {}; + opt->force_callback(); + run(); + CHECK(3.4f == Approx(custom_opt.first)); + CHECK(2.7f == Approx(custom_opt.second)); +} + // now with independent type sizes and expected this is possible TEST_CASE_METHOD(TApp, "vectorPair", "[optiontype]") { std::vector<std::pair<int, std::string>> custom_opt; - auto opt = app.add_option("--dict", custom_opt); + auto *opt = app.add_option("--dict", custom_opt); args = {"--dict", "1", "str1", "--dict", "3", "str3"}; @@ -554,11 +579,32 @@ TEST_CASE_METHOD(TApp, "vectorPairFail", "[optiontype]") { CHECK_THROWS_AS(run(), CLI::ConversionError); } +TEST_CASE_METHOD(TApp, "vectorPairFail2", "[optiontype]") { + + std::vector<std::pair<int, int>> custom_opt; + + auto *opt = app.add_option("--pairs", custom_opt); + + args = {"--pairs", "1", "2", "3", "4"}; + + run(); + CHECK(custom_opt.size() == 2U); + + args = {"--pairs", "1", "2", "3"}; + + CHECK_THROWS_AS(run(), CLI::ArgumentMismatch); + // now change the type size to explicitly allow 1 or 2 + opt->type_size(1, 2); + + run(); + CHECK(custom_opt.size() == 2U); +} + TEST_CASE_METHOD(TApp, "vectorPairTypeRange", "[optiontype]") { std::vector<std::pair<int, std::string>> custom_opt; - auto opt = app.add_option("--dict", custom_opt); + auto *opt = app.add_option("--dict", custom_opt); opt->type_size(2, 1); // just test switched arguments CHECK(1 == opt->get_type_size_min()); @@ -594,7 +640,7 @@ TEST_CASE_METHOD(TApp, "vectorTuple", "[optiontype]") { std::vector<std::tuple<int, std::string, double>> custom_opt; - auto opt = app.add_option("--dict", custom_opt); + auto *opt = app.add_option("--dict", custom_opt); args = {"--dict", "1", "str1", "4.3", "--dict", "3", "str3", "2.7"}; @@ -624,7 +670,7 @@ TEST_CASE_METHOD(TApp, "vectorVector", "[optiontype]") { std::vector<std::vector<int>> custom_opt; - auto opt = app.add_option("--dict", custom_opt); + auto *opt = app.add_option("--dict", custom_opt); args = {"--dict", "1", "2", "4", "--dict", "3", "1"}; @@ -660,7 +706,7 @@ TEST_CASE_METHOD(TApp, "vectorVectorFixedSize", "[optiontype]") { std::vector<std::vector<int>> custom_opt; - auto opt = app.add_option("--dict", custom_opt)->type_size(4); + auto *opt = app.add_option("--dict", custom_opt)->type_size(4); args = {"--dict", "1", "2", "4", "3", "--dict", "3", "1", "2", "8"}; @@ -864,7 +910,7 @@ TEST_CASE_METHOD(TApp, "unknownContainerWrapper", "[optiontype]") { class vopt { public: vopt() = default; - explicit vopt(const std::vector<double> &vdub) : val_{vdub} {}; + explicit vopt(std::vector<double> vdub) : val_{std::move(vdub)} {}; std::vector<double> val_{}; }; @@ -944,6 +990,23 @@ TEST_CASE_METHOD(TApp, "OnParseCall", "[optiontype]") { CHECK(3 == cnt); } +TEST_CASE_METHOD(TApp, "OnParseCallPositional", "[optiontype]") { + + int cnt{0}; + + auto *opt = app.add_option("pos", + [&cnt](const CLI::results_t &) { + ++cnt; + return true; + }) + ->trigger_on_parse() + ->allow_extra_args(); + args = {"1", "2", "3"}; + CHECK(opt->get_trigger_on_parse()); + run(); + CHECK(3 == cnt); +} + TEST_CASE_METHOD(TApp, "OnParseCallVector", "[optiontype]") { std::vector<std::string> vec; diff --git a/packages/CLI11/tests/OptionalTest.cpp b/packages/CLI11/tests/OptionalTest.cpp index 5ea20be9dbd8beab8ebfed186ac88434a05da55a..4094c44b6c4687bcc928bd06d24187fb3082509a 100644 --- a/packages/CLI11/tests/OptionalTest.cpp +++ b/packages/CLI11/tests/OptionalTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -130,6 +130,27 @@ TEST_CASE_METHOD(TApp, "StdOptionalUint", "[optional]") { CLI::detail::object_category::wrapper_value); } +TEST_CASE_METHOD(TApp, "StdOptionalbool", "[optional]") { + std::optional<bool> opt{}; + CHECK(!opt); + app.add_flag("--opt,!--no-opt", opt); + CHECK(!opt); + run(); + CHECK(!opt); + + args = {"--opt"}; + run(); + CHECK(opt); + CHECK(*opt); + + args = {"--no-opt"}; + run(); + CHECK(opt); + CHECK_FALSE(*opt); + static_assert(CLI::detail::classify_object<std::optional<bool>>::value == + CLI::detail::object_category::wrapper_value); +} + #ifdef _MSC_VER #pragma warning(default : 4244) #endif @@ -239,16 +260,19 @@ TEST_CASE_METHOD(TApp, "BoostOptionalEnumTest", "[optional]") { auto dstring = optptr->get_default_str(); CHECK(dstring.empty()); run(); - CHECK(!opt); + auto checkOpt = static_cast<bool>(opt); + CHECK_FALSE(checkOpt); args = {"-v", "3"}; run(); - CHECK(opt); + checkOpt = static_cast<bool>(opt); + CHECK(checkOpt); CHECK(*opt == eval::val3); opt = {}; args = {"--val", "1"}; run(); - CHECK(opt); + checkOpt = static_cast<bool>(opt); + CHECK(checkOpt); CHECK(*opt == eval::val1); } diff --git a/packages/CLI11/tests/SetTest.cpp b/packages/CLI11/tests/SetTest.cpp index 5d225ff63ff1fa8692dbdd240da50fdd505d0104..8184350dc92dcbc68bccae95cba20ac294ea9534 100644 --- a/packages/CLI11/tests/SetTest.cpp +++ b/packages/CLI11/tests/SetTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,6 +6,7 @@ #include "app_helper.hpp" #include <map> +#include <memory> static_assert(CLI::is_shared_ptr<std::shared_ptr<int>>::value == true, "is_shared_ptr should work on shared pointers"); static_assert(CLI::is_shared_ptr<int *>::value == false, "is_shared_ptr should work on pointers"); @@ -34,7 +35,7 @@ static_assert(CLI::detail::pair_adaptor<std::vector<std::pair<int, int>>>::value TEST_CASE_METHOD(TApp, "SimpleMaps", "[set]") { int value{0}; std::map<std::string, int> map = {{"one", 1}, {"two", 2}}; - auto opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); + auto *opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -78,9 +79,9 @@ TEST_CASE_METHOD(TApp, "StringStringMapNoModify", "[set]") { enum SimpleEnum { SE_one = 1, SE_two = 2 }; TEST_CASE_METHOD(TApp, "EnumMap", "[set]") { - SimpleEnum value; + SimpleEnum value; // NOLINT(cppcoreguidelines-init-variables) std::map<std::string, SimpleEnum> map = {{"one", SE_one}, {"two", SE_two}}; - auto opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); + auto *opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -92,9 +93,9 @@ TEST_CASE_METHOD(TApp, "EnumMap", "[set]") { enum class SimpleEnumC { one = 1, two = 2 }; TEST_CASE_METHOD(TApp, "EnumCMap", "[set]") { - SimpleEnumC value; + SimpleEnumC value; // NOLINT(cppcoreguidelines-init-variables) std::map<std::string, SimpleEnumC> map = {{"one", SimpleEnumC::one}, {"two", SimpleEnumC::two}}; - auto opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); + auto *opt = app.add_option("-s,--set", value)->transform(CLI::Transformer(map)); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -111,7 +112,7 @@ TEST_CASE_METHOD(TApp, "structMap", "[set]") { }; std::string struct_name; std::map<std::string, struct tstruct> map = {{"sone", {4, 32.4, "foo"}}, {"stwo", {5, 99.7, "bar"}}}; - auto opt = app.add_option("-s,--set", struct_name)->check(CLI::IsMember(map)); + auto *opt = app.add_option("-s,--set", struct_name)->check(CLI::IsMember(map)); args = {"-s", "sone"}; run(); CHECK(app.count("-s") == 1u); @@ -131,8 +132,8 @@ TEST_CASE_METHOD(TApp, "structMapChange", "[set]") { }; std::string struct_name; std::map<std::string, struct tstruct> map = {{"sone", {4, 32.4, "foo"}}, {"stwo", {5, 99.7, "bar"}}}; - auto opt = app.add_option("-s,--set", struct_name) - ->transform(CLI::IsMember(map, CLI::ignore_case, CLI::ignore_underscore, CLI::ignore_space)); + auto *opt = app.add_option("-s,--set", struct_name) + ->transform(CLI::IsMember(map, CLI::ignore_case, CLI::ignore_underscore, CLI::ignore_space)); args = {"-s", "s one"}; run(); CHECK(app.count("-s") == 1u); @@ -159,8 +160,8 @@ TEST_CASE_METHOD(TApp, "structMapNoChange", "[set]") { }; std::string struct_name; std::map<std::string, struct tstruct> map = {{"sone", {4, 32.4, "foo"}}, {"stwo", {5, 99.7, "bar"}}}; - auto opt = app.add_option("-s,--set", struct_name) - ->check(CLI::IsMember(map, CLI::ignore_case, CLI::ignore_underscore, CLI::ignore_space)); + auto *opt = app.add_option("-s,--set", struct_name) + ->check(CLI::IsMember(map, CLI::ignore_case, CLI::ignore_underscore, CLI::ignore_space)); args = {"-s", "SONE"}; run(); CHECK(app.count("-s") == 1u); @@ -184,9 +185,9 @@ TEST_CASE_METHOD(TApp, "NonCopyableMap", "[set]") { std::string map_name; std::map<std::string, std::unique_ptr<double>> map; - map["e1"] = std::unique_ptr<double>(new double(5.7)); - map["e3"] = std::unique_ptr<double>(new double(23.8)); - auto opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(&map)); + map["e1"].reset(new double(5.7)); + map["e3"].reset(new double(23.8)); + auto *opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(&map)); args = {"-s", "e1"}; run(); CHECK(app.count("-s") == 1u); @@ -202,9 +203,9 @@ TEST_CASE_METHOD(TApp, "NonCopyableMapWithFunction", "[set]") { std::string map_name; std::map<std::string, std::unique_ptr<double>> map; - map["e1"] = std::unique_ptr<double>(new double(5.7)); - map["e3"] = std::unique_ptr<double>(new double(23.8)); - auto opt = app.add_option("-s,--set", map_name)->transform(CLI::IsMember(&map, CLI::ignore_underscore)); + map["e1"].reset(new double(5.7)); + map["e3"].reset(new double(23.8)); + auto *opt = app.add_option("-s,--set", map_name)->transform(CLI::IsMember(&map, CLI::ignore_underscore)); args = {"-s", "e_1"}; run(); CHECK(app.count("-s") == 1u); @@ -220,9 +221,9 @@ TEST_CASE_METHOD(TApp, "NonCopyableMapNonStringMap", "[set]") { std::string map_name; std::map<int, std::unique_ptr<double>> map; - map[4] = std::unique_ptr<double>(new double(5.7)); - map[17] = std::unique_ptr<double>(new double(23.8)); - auto opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(&map)); + map[4].reset(new double(5.7)); + map[17].reset(new double(23.8)); + auto *opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(&map)); args = {"-s", "4"}; run(); CHECK(app.count("-s") == 1u); @@ -240,7 +241,7 @@ TEST_CASE_METHOD(TApp, "CopyableMapMove", "[set]") { std::map<int, double> map; map[4] = 5.7; map[17] = 23.8; - auto opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(std::move(map))); + auto *opt = app.add_option("-s,--set", map_name)->check(CLI::IsMember(std::move(map))); args = {"-s", "4"}; run(); CHECK(app.count("-s") == 1u); @@ -254,7 +255,7 @@ TEST_CASE_METHOD(TApp, "CopyableMapMove", "[set]") { TEST_CASE_METHOD(TApp, "SimpleSets", "[set]") { std::string value; - auto opt = app.add_option("-s,--set", value)->check(CLI::IsMember{std::set<std::string>({"one", "two", "three"})}); + auto *opt = app.add_option("-s,--set", value)->check(CLI::IsMember{std::set<std::string>({"one", "two", "three"})}); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -264,9 +265,9 @@ TEST_CASE_METHOD(TApp, "SimpleSets", "[set]") { } TEST_CASE_METHOD(TApp, "SimpleSetsPtrs", "[set]") { - auto set = std::shared_ptr<std::set<std::string>>(new std::set<std::string>{"one", "two", "three"}); + auto set = std::make_shared<std::set<std::string>>(std::set<std::string>{"one", "two", "three"}); std::string value; - auto opt = app.add_option("-s,--set", value)->check(CLI::IsMember{set}); + auto *opt = app.add_option("-s,--set", value)->check(CLI::IsMember{set}); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -286,7 +287,7 @@ TEST_CASE_METHOD(TApp, "SimpleSetsPtrs", "[set]") { TEST_CASE_METHOD(TApp, "SimiShortcutSets", "[set]") { std::string value; - auto opt = app.add_option("--set", value)->check(CLI::IsMember({"one", "two", "three"})); + auto *opt = app.add_option("--set", value)->check(CLI::IsMember({"one", "two", "three"})); args = {"--set", "one"}; run(); CHECK(app.count("--set") == 1u); @@ -294,7 +295,7 @@ TEST_CASE_METHOD(TApp, "SimiShortcutSets", "[set]") { CHECK("one" == value); std::string value2; - auto opt2 = app.add_option("--set2", value2)->transform(CLI::IsMember({"One", "two", "three"}, CLI::ignore_case)); + auto *opt2 = app.add_option("--set2", value2)->transform(CLI::IsMember({"One", "two", "three"}, CLI::ignore_case)); args = {"--set2", "onE"}; run(); CHECK(app.count("--set2") == 1u); @@ -302,8 +303,8 @@ TEST_CASE_METHOD(TApp, "SimiShortcutSets", "[set]") { CHECK("One" == value2); std::string value3; - auto opt3 = app.add_option("--set3", value3) - ->transform(CLI::IsMember({"O_ne", "two", "three"}, CLI::ignore_case, CLI::ignore_underscore)); + auto *opt3 = app.add_option("--set3", value3) + ->transform(CLI::IsMember({"O_ne", "two", "three"}, CLI::ignore_case, CLI::ignore_underscore)); args = {"--set3", "onE"}; run(); CHECK(app.count("--set3") == 1u); @@ -312,10 +313,10 @@ TEST_CASE_METHOD(TApp, "SimiShortcutSets", "[set]") { } TEST_CASE_METHOD(TApp, "SetFromCharStarArrayVector", "[set]") { - constexpr const char *names[3]{"one", "two", "three"}; + constexpr const char *names[3]{"one", "two", "three"}; // NOLINT(modernize-avoid-c-arrays) std::string value; - auto opt = app.add_option("-s,--set", value) - ->check(CLI::IsMember{std::vector<std::string>(std::begin(names), std::end(names))}); + auto *opt = app.add_option("-s,--set", value) + ->check(CLI::IsMember{std::vector<std::string>(std::begin(names), std::end(names))}); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -327,7 +328,7 @@ TEST_CASE_METHOD(TApp, "SetFromCharStarArrayVector", "[set]") { TEST_CASE_METHOD(TApp, "OtherTypeSets", "[set]") { int value{0}; std::vector<int> set = {2, 3, 4}; - auto opt = app.add_option("--set", value)->check(CLI::IsMember(set)); + auto *opt = app.add_option("--set", value)->check(CLI::IsMember(set)); args = {"--set", "3"}; run(); CHECK(app.count("--set") == 1u); @@ -338,7 +339,7 @@ TEST_CASE_METHOD(TApp, "OtherTypeSets", "[set]") { CHECK_THROWS_AS(run(), CLI::ValidationError); std::vector<int> set2 = {-2, 3, 4}; - auto opt2 = app.add_option("--set2", value)->transform(CLI::IsMember(set2, [](int x) { return std::abs(x); })); + auto *opt2 = app.add_option("--set2", value)->transform(CLI::IsMember(set2, [](int x) { return std::abs(x); })); args = {"--set2", "-3"}; run(); CHECK(app.count("--set2") == 1u); @@ -360,7 +361,7 @@ TEST_CASE_METHOD(TApp, "OtherTypeSets", "[set]") { TEST_CASE_METHOD(TApp, "NumericalSets", "[set]") { int value{0}; - auto opt = app.add_option("-s,--set", value)->check(CLI::IsMember{std::set<int>({1, 2, 3})}); + auto *opt = app.add_option("-s,--set", value)->check(CLI::IsMember{std::set<int>({1, 2, 3})}); args = {"-s", "1"}; run(); CHECK(app.count("-s") == 1u); @@ -494,7 +495,7 @@ TEST_CASE_METHOD(TApp, "FailSet", "[set]") { TEST_CASE_METHOD(TApp, "FailMutableSet", "[set]") { int choice{0}; - auto vals = std::shared_ptr<std::set<int>>(new std::set<int>({1, 2, 3})); + auto vals = std::make_shared<std::set<int>>(std::set<int>{1, 2, 3}); app.add_option("-q,--quick", choice)->check(CLI::IsMember(vals)); app.add_option("-s,--slow", choice)->capture_default_str()->check(CLI::IsMember(vals)); @@ -554,7 +555,7 @@ TEST_CASE_METHOD(TApp, "InSetIgnoreCaseMutableValue", "[set]") { TEST_CASE_METHOD(TApp, "InSetIgnoreCasePointer", "[set]") { - std::set<std::string> *options = new std::set<std::string>{"one", "Two", "THREE"}; + auto *options = new std::set<std::string>{"one", "Two", "THREE"}; std::string choice; app.add_option("-q,--quick", choice)->transform(CLI::IsMember(*options, CLI::ignore_case)); @@ -584,7 +585,7 @@ TEST_CASE_METHOD(TApp, "InSetIgnoreCasePointer", "[set]") { TEST_CASE_METHOD(TApp, "NotInSetIgnoreCasePointer", "[set]") { - std::set<std::string> *options = new std::set<std::string>{"one", "Two", "THREE"}; + auto *options = new std::set<std::string>{"one", "Two", "THREE"}; std::string choice; app.add_option("-q,--quick", choice)->check(!CLI::IsMember(*options, CLI::ignore_case)); diff --git a/packages/CLI11/tests/SimpleTest.cpp b/packages/CLI11/tests/SimpleTest.cpp index 3051a46d4c1c7924f357688da59a9e372ac8ba70..84ec6f0c409d50fae2af0e07f759f2687fc8dce0 100644 --- a/packages/CLI11/tests/SimpleTest.cpp +++ b/packages/CLI11/tests/SimpleTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/StringParseTest.cpp b/packages/CLI11/tests/StringParseTest.cpp index a9842481139218f4ef47e9f6cda8dedc6ba5e50f..6a889e45c7b297b0ece75e465584544b9b0581c0 100644 --- a/packages/CLI11/tests/StringParseTest.cpp +++ b/packages/CLI11/tests/StringParseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -24,7 +24,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheck", "[stringparse]") { } app.parse(std::string("./") + std::string(tmpexe) + - " --string=\"this is my quoted string\" -t 'qstring 2' -m=`\"quoted string\"`", + R"( --string="this is my quoted string" -t 'qstring 2' -m=`"quoted string"`)", true); CHECK("this is my quoted string" == str); CHECK("qstring 2" == str2); @@ -46,7 +46,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheckWithSpace", "[stringparse]") { } app.parse(std::string("./") + std::string(tmpexe) + - " --string=\"this is my quoted string\" -t 'qstring 2' -m=`\"quoted string\"`", + R"( --string="this is my quoted string" -t 'qstring 2' -m=`"quoted string"`)", true); CHECK("this is my quoted string" == str); CHECK("qstring 2" == str2); @@ -70,7 +70,7 @@ TEST_CASE_METHOD(TApp, "ExistingExeCheckWithLotsOfSpace", "[stringparse]") { } app.parse(std::string("./") + std::string(tmpexe) + - " --string=\"this is my quoted string\" -t 'qstring 2' -m=`\"quoted string\"`", + R"( --string="this is my quoted string" -t 'qstring 2' -m=`"quoted string"`)", true); CHECK("this is my quoted string" == str); CHECK("qstring 2" == str2); @@ -89,6 +89,15 @@ TEST_CASE_METHOD(TApp, "ProgNameWithSpace", "[stringparse]") { CHECK(app.get_name() == "Foo Bar"); } +// From GitHub issue #739 https://github.com/CLIUtils/CLI11/issues/739 +TEST_CASE_METHOD(TApp, "ProgNameOnly", "[stringparse]") { + + app.add_flag("--foo"); + CHECK_NOTHROW(app.parse("\"C:\\example.exe\"", true)); + + CHECK(app.get_name() == "C:\\example.exe"); +} + TEST_CASE_METHOD(TApp, "ProgNameWithSpaceEmbeddedQuote", "[stringparse]") { app.add_flag("--foo"); diff --git a/packages/CLI11/tests/SubcommandTest.cpp b/packages/CLI11/tests/SubcommandTest.cpp index e1ffded6b9371c13d68e7f9c800c87fadd89e207..a01b8863d76ec2a33fc55f3430cffa6153e5e62d 100644 --- a/packages/CLI11/tests/SubcommandTest.cpp +++ b/packages/CLI11/tests/SubcommandTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -11,8 +11,8 @@ using Catch::Matchers::Contains; using vs_t = std::vector<std::string>; TEST_CASE_METHOD(TApp, "BasicSubcommands", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); - auto sub2 = app.add_subcommand("sub2"); + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); CHECK(&app == sub1->get_parent()); @@ -21,7 +21,7 @@ TEST_CASE_METHOD(TApp, "BasicSubcommands", "[subcom]") { CHECK_THROWS_AS(app.get_subcommand("sub3"), CLI::OptionNotFound); run(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); args = {"sub1"}; run(); @@ -29,7 +29,7 @@ TEST_CASE_METHOD(TApp, "BasicSubcommands", "[subcom]") { CHECK(app.get_subcommands().size() == 1u); app.clear(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); args = {"sub2"}; run(); @@ -57,8 +57,8 @@ TEST_CASE_METHOD(TApp, "BasicSubcommands", "[subcom]") { TEST_CASE_METHOD(TApp, "MultiSubFallthrough", "[subcom]") { // No explicit fallthrough - auto sub1 = app.add_subcommand("sub1"); - auto sub2 = app.add_subcommand("sub2"); + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); args = {"sub1", "sub2"}; run(); @@ -96,7 +96,7 @@ TEST_CASE_METHOD(TApp, "MultiSubFallthrough", "[subcom]") { } TEST_CASE_METHOD(TApp, "CrazyNameSubcommand", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); + auto *sub1 = app.add_subcommand("sub1"); // name can be set to whatever CHECK_NOTHROW(sub1->name("crazy name with spaces")); args = {"crazy name with spaces"}; @@ -110,8 +110,8 @@ TEST_CASE_METHOD(TApp, "RequiredAndSubcommands", "[subcom]") { std::string baz; app.add_option("baz", baz, "Baz Description")->required()->capture_default_str(); - auto foo = app.add_subcommand("foo"); - auto bar = app.add_subcommand("bar"); + auto *foo = app.add_subcommand("foo"); + auto *bar = app.add_subcommand("bar"); args = {"bar", "foo"}; REQUIRE_NOTHROW(run()); @@ -138,7 +138,7 @@ TEST_CASE_METHOD(TApp, "RequiredAndSubcomFallthrough", "[subcom]") { std::string baz; app.add_option("baz", baz)->required(); app.add_subcommand("foo"); - auto bar = app.add_subcommand("bar"); + auto *bar = app.add_subcommand("bar"); app.fallthrough(); args = {"other", "bar"}; @@ -153,16 +153,16 @@ TEST_CASE_METHOD(TApp, "RequiredAndSubcomFallthrough", "[subcom]") { TEST_CASE_METHOD(TApp, "FooFooProblem", "[subcom]") { std::string baz_str, other_str; - auto baz = app.add_option("baz", baz_str); - auto foo = app.add_subcommand("foo"); - auto other = foo->add_option("other", other_str); + auto *baz = app.add_option("baz", baz_str); + auto *foo = app.add_subcommand("foo"); + auto *other = foo->add_option("other", other_str); args = {"foo", "foo"}; run(); CHECK(*foo); CHECK(!*baz); CHECK(*other); - CHECK("" == baz_str); + CHECK(baz_str.empty()); CHECK("foo" == other_str); baz_str = ""; @@ -173,12 +173,12 @@ TEST_CASE_METHOD(TApp, "FooFooProblem", "[subcom]") { CHECK(*baz); CHECK(!*other); CHECK("foo" == baz_str); - CHECK("" == other_str); + CHECK(other_str.empty()); } TEST_CASE_METHOD(TApp, "DuplicateSubcommands", "[subcom]") { - auto foo = app.add_subcommand("foo"); + auto *foo = app.add_subcommand("foo"); args = {"foo", "foo"}; run(); @@ -193,7 +193,7 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommands", "[subcom]") { TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacks", "[subcom]") { - auto foo = app.add_subcommand("foo"); + auto *foo = app.add_subcommand("foo"); int count{0}; foo->callback([&count]() { ++count; }); foo->immediate_callback(); @@ -209,7 +209,7 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacks", "[subcom]") { TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacksValues", "[subcom]") { - auto foo = app.add_subcommand("foo"); + auto *foo = app.add_subcommand("foo"); int val{0}; foo->add_option("--val", val); std::vector<int> vals; @@ -230,9 +230,9 @@ TEST_CASE_METHOD(TApp, "DuplicateSubcommandCallbacksValues", "[subcom]") { } TEST_CASE_METHOD(TApp, "Callbacks", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); + auto *sub1 = app.add_subcommand("sub1"); sub1->callback([]() { throw CLI::Success(); }); - auto sub2 = app.add_subcommand("sub2"); + auto *sub2 = app.add_subcommand("sub2"); bool val{false}; sub2->callback([&val]() { val = true; }); @@ -245,15 +245,15 @@ TEST_CASE_METHOD(TApp, "Callbacks", "[subcom]") { TEST_CASE_METHOD(TApp, "CallbackOrder", "[subcom]") { std::vector<std::string> cb; - app.parse_complete_callback([&cb]() { cb.push_back("ac1"); }); - app.final_callback([&cb]() { cb.push_back("ac2"); }); - auto sub1 = + app.parse_complete_callback([&cb]() { cb.emplace_back("ac1"); }); + app.final_callback([&cb]() { cb.emplace_back("ac2"); }); + auto *sub1 = app.add_subcommand("sub1") - ->parse_complete_callback([&cb]() { cb.push_back("c1"); }) + ->parse_complete_callback([&cb]() { cb.emplace_back("c1"); }) ->preparse_callback([&cb](std::size_t v1) { cb.push_back(std::string("pc1-") + std::to_string(v1)); }); - auto sub2 = + auto *sub2 = app.add_subcommand("sub2") - ->final_callback([&cb]() { cb.push_back("c2"); }) + ->final_callback([&cb]() { cb.emplace_back("c2"); }) ->preparse_callback([&cb](std::size_t v1) { cb.push_back(std::string("pc2-") + std::to_string(v1)); }); app.preparse_callback([&cb](std::size_t v1) { cb.push_back(std::string("pa-") + std::to_string(v1)); }); @@ -291,9 +291,9 @@ TEST_CASE_METHOD(TApp, "CallbackOrder", "[subcom]") { TEST_CASE_METHOD(TApp, "CallbackOrder2", "[subcom]") { std::vector<std::string> cb; - app.add_subcommand("sub1")->parse_complete_callback([&cb]() { cb.push_back("sub1"); }); - app.add_subcommand("sub2")->parse_complete_callback([&cb]() { cb.push_back("sub2"); }); - app.add_subcommand("sub3")->parse_complete_callback([&cb]() { cb.push_back("sub3"); }); + app.add_subcommand("sub1")->parse_complete_callback([&cb]() { cb.emplace_back("sub1"); }); + app.add_subcommand("sub2")->parse_complete_callback([&cb]() { cb.emplace_back("sub2"); }); + app.add_subcommand("sub3")->parse_complete_callback([&cb]() { cb.emplace_back("sub3"); }); args = {"sub1", "sub2", "sub3", "sub1", "sub1", "sub2", "sub1"}; run(); @@ -311,9 +311,9 @@ TEST_CASE_METHOD(TApp, "CallbackOrder2_withFallthrough", "[subcom]") { std::vector<std::string> cb; - app.add_subcommand("sub1")->parse_complete_callback([&cb]() { cb.push_back("sub1"); })->fallthrough(); - app.add_subcommand("sub2")->parse_complete_callback([&cb]() { cb.push_back("sub2"); }); - app.add_subcommand("sub3")->parse_complete_callback([&cb]() { cb.push_back("sub3"); }); + app.add_subcommand("sub1")->parse_complete_callback([&cb]() { cb.emplace_back("sub1"); })->fallthrough(); + app.add_subcommand("sub2")->parse_complete_callback([&cb]() { cb.emplace_back("sub2"); }); + app.add_subcommand("sub3")->parse_complete_callback([&cb]() { cb.emplace_back("sub3"); }); args = {"sub1", "sub2", "sub3", "sub1", "sub1", "sub2", "sub1"}; run(); @@ -328,9 +328,9 @@ TEST_CASE_METHOD(TApp, "CallbackOrder2_withFallthrough", "[subcom]") { } TEST_CASE_METHOD(TApp, "RuntimeErrorInCallback", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); + auto *sub1 = app.add_subcommand("sub1"); sub1->callback([]() { throw CLI::RuntimeError(); }); - auto sub2 = app.add_subcommand("sub2"); + auto *sub2 = app.add_subcommand("sub2"); sub2->callback([]() { throw CLI::RuntimeError(2); }); args = {"sub1"}; @@ -403,7 +403,7 @@ TEST_CASE_METHOD(TApp, "NoFallThroughPositionalsWithTerminator", "[subcom]") { TEST_CASE_METHOD(TApp, "NamelessSubComPositionals", "[subcom]") { - auto sub = app.add_subcommand(); + auto *sub = app.add_subcommand(); int val{1}; sub->add_option("val", val); @@ -414,8 +414,8 @@ TEST_CASE_METHOD(TApp, "NamelessSubComPositionals", "[subcom]") { TEST_CASE_METHOD(TApp, "NamelessSubWithSub", "[subcom]") { - auto sub = app.add_subcommand(); - auto subsub = sub->add_subcommand("val"); + auto *sub = app.add_subcommand(); + auto *subsub = sub->add_subcommand("val"); args = {"val"}; run(); @@ -425,12 +425,12 @@ TEST_CASE_METHOD(TApp, "NamelessSubWithSub", "[subcom]") { TEST_CASE_METHOD(TApp, "NamelessSubWithMultipleSub", "[subcom]") { - auto sub1 = app.add_subcommand(); - auto sub2 = app.add_subcommand(); - auto sub1sub1 = sub1->add_subcommand("val1"); - auto sub1sub2 = sub1->add_subcommand("val2"); - auto sub2sub1 = sub2->add_subcommand("val3"); - auto sub2sub2 = sub2->add_subcommand("val4"); + auto *sub1 = app.add_subcommand(); + auto *sub2 = app.add_subcommand(); + auto *sub1sub1 = sub1->add_subcommand("val1"); + auto *sub1sub2 = sub1->add_subcommand("val2"); + auto *sub2sub1 = sub2->add_subcommand("val3"); + auto *sub2sub2 = sub2->add_subcommand("val4"); args = {"val1"}; run(); CHECK(sub1sub1->parsed()); @@ -461,12 +461,12 @@ TEST_CASE_METHOD(TApp, "NamelessSubWithMultipleSub", "[subcom]") { TEST_CASE_METHOD(TApp, "Nameless4LayerDeep", "[subcom]") { - auto sub = app.add_subcommand(); - auto ssub = sub->add_subcommand(); - auto sssub = ssub->add_subcommand(); + auto *sub = app.add_subcommand(); + auto *ssub = sub->add_subcommand(); + auto *sssub = ssub->add_subcommand(); - auto ssssub = sssub->add_subcommand(); - auto sssssub = ssssub->add_subcommand("val"); + auto *ssssub = sssub->add_subcommand(); + auto *sssssub = ssssub->add_subcommand("val"); args = {"val"}; run(); @@ -477,13 +477,13 @@ TEST_CASE_METHOD(TApp, "Nameless4LayerDeep", "[subcom]") { /// Put subcommands in some crazy pattern and make everything still works TEST_CASE_METHOD(TApp, "Nameless4LayerDeepMulti", "[subcom]") { - auto sub1 = app.add_subcommand(); - auto sub2 = app.add_subcommand(); - auto ssub1 = sub1->add_subcommand(); - auto ssub2 = sub2->add_subcommand(); + auto *sub1 = app.add_subcommand(); + auto *sub2 = app.add_subcommand(); + auto *ssub1 = sub1->add_subcommand(); + auto *ssub2 = sub2->add_subcommand(); - auto sssub1 = ssub1->add_subcommand(); - auto sssub2 = ssub2->add_subcommand(); + auto *sssub1 = ssub1->add_subcommand(); + auto *sssub2 = ssub2->add_subcommand(); sssub1->add_subcommand("val1"); ssub2->add_subcommand("val2"); sub2->add_subcommand("val3"); @@ -568,7 +568,7 @@ TEST_CASE_METHOD(TApp, "EvilParseFallthrough", "[subcom]") { int val1{0}, val2{0}; app.add_option("--val1", val1); - auto sub = app.add_subcommand("sub"); + auto *sub = app.add_subcommand("sub"); sub->add_option("val2", val2); args = {"sub", "--val1", "1", "2"}; @@ -584,7 +584,7 @@ TEST_CASE_METHOD(TApp, "CallbackOrdering", "[subcom]") { int val{1}, sub_val{0}; app.add_option("--val", val); - auto sub = app.add_subcommand("sub"); + auto *sub = app.add_subcommand("sub"); sub->callback([&val, &sub_val]() { sub_val = val; }); args = {"sub", "--val=2"}; @@ -603,7 +603,7 @@ TEST_CASE_METHOD(TApp, "CallbackOrderingImmediate", "[subcom]") { int val{1}, sub_val{0}; app.add_option("--val", val); - auto sub = app.add_subcommand("sub")->immediate_callback(); + auto *sub = app.add_subcommand("sub")->immediate_callback(); sub->callback([&val, &sub_val]() { sub_val = val; }); args = {"sub", "--val=2"}; @@ -621,7 +621,7 @@ TEST_CASE_METHOD(TApp, "CallbackOrderingImmediateMain", "[subcom]") { app.fallthrough(); int val{0}, sub_val{0}; - auto sub = app.add_subcommand("sub"); + auto *sub = app.add_subcommand("sub"); sub->callback([&val, &sub_val]() { sub_val = val; val = 2; @@ -652,7 +652,7 @@ TEST_CASE_METHOD(TApp, "CallbackOrderingImmediateModeOrder", "[subcom]") { std::vector<int> v; app.callback([&v]() { v.push_back(1); })->immediate_callback(true); - auto sub = app.add_subcommand("hello")->callback([&v]() { v.push_back(2); })->immediate_callback(false); + auto *sub = app.add_subcommand("hello")->callback([&v]() { v.push_back(2); })->immediate_callback(false); args = {"hello"}; run(); // immediate_callback inherited @@ -682,21 +682,21 @@ TEST_CASE_METHOD(TApp, "RequiredSubCom", "[subcom]") { TEST_CASE_METHOD(TApp, "SubComExtras", "[subcom]") { app.allow_extras(); - auto sub = app.add_subcommand("sub"); + auto *sub = app.add_subcommand("sub"); args = {"extra", "sub"}; run(); CHECK(std::vector<std::string>({"extra"}) == app.remaining()); - CHECK(std::vector<std::string>() == sub->remaining()); + CHECK(sub->remaining().empty()); args = {"extra1", "extra2", "sub"}; run(); CHECK(std::vector<std::string>({"extra1", "extra2"}) == app.remaining()); - CHECK(std::vector<std::string>() == sub->remaining()); + CHECK(sub->remaining().empty()); args = {"sub", "extra1", "extra2"}; run(); - CHECK(std::vector<std::string>() == app.remaining()); + CHECK(app.remaining().empty()); CHECK(std::vector<std::string>({"extra1", "extra2"}) == sub->remaining()); args = {"extra1", "extra2", "sub", "extra3", "extra4"}; @@ -723,8 +723,8 @@ TEST_CASE_METHOD(TApp, "Required1SubCom", "[subcom]") { TEST_CASE_METHOD(TApp, "BadSubcommandSearch", "[subcom]") { - auto one = app.add_subcommand("one"); - auto two = one->add_subcommand("two"); + auto *one = app.add_subcommand("one"); + auto *two = one->add_subcommand("two"); CHECK_THROWS_AS(app.get_subcommand(two), CLI::OptionNotFound); CHECK_THROWS_AS(app.get_subcommand_ptr(two), CLI::OptionNotFound); @@ -770,7 +770,7 @@ TEST_CASE_METHOD(TApp, "PrefixSeparation", "[subcom]") { } TEST_CASE_METHOD(TApp, "PrefixSubcom", "[subcom]") { - auto subc = app.add_subcommand("subc"); + auto *subc = app.add_subcommand("subc"); subc->prefix_command(); app.add_flag("--simple"); @@ -785,7 +785,7 @@ TEST_CASE_METHOD(TApp, "PrefixSubcom", "[subcom]") { TEST_CASE_METHOD(TApp, "InheritHelpAllFlag", "[subcom]") { app.set_help_all_flag("--help-all"); - auto subc = app.add_subcommand("subc"); + auto *subc = app.add_subcommand("subc"); auto help_opt_list = subc->get_options([](const CLI::Option *opt) { return opt->get_name() == "--help-all"; }); CHECK(1u == help_opt_list.size()); } @@ -908,11 +908,11 @@ TEST_CASE_METHOD(SubcommandProgram, "Subcommand CaseCheck", "[subcom]") { TEST_CASE_METHOD(TApp, "SubcomInheritCaseCheck", "[subcom]") { app.ignore_case(); - auto sub1 = app.add_subcommand("sub1"); - auto sub2 = app.add_subcommand("sub2"); + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); run(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); CHECK(app.get_subcommands({}).size() == 2u); CHECK(app.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub1"; }).size() == 1u); @@ -922,7 +922,7 @@ TEST_CASE_METHOD(TApp, "SubcomInheritCaseCheck", "[subcom]") { CHECK(app.get_subcommands().size() == 1u); app.clear(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); args = {"sUb2"}; run(); @@ -945,11 +945,11 @@ TEST_CASE_METHOD(SubcommandProgram, "Subcommand UnderscoreCheck", "[subcom]") { TEST_CASE_METHOD(TApp, "SubcomInheritUnderscoreCheck", "[subcom]") { app.ignore_underscore(); - auto sub1 = app.add_subcommand("sub_option1"); - auto sub2 = app.add_subcommand("sub_option2"); + auto *sub1 = app.add_subcommand("sub_option1"); + auto *sub2 = app.add_subcommand("sub_option2"); run(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); CHECK(app.get_subcommands({}).size() == 2u); CHECK(app.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub_option1"; }).size() == 1u); @@ -959,7 +959,7 @@ TEST_CASE_METHOD(TApp, "SubcomInheritUnderscoreCheck", "[subcom]") { CHECK(app.get_subcommands().size() == 1u); app.clear(); - CHECK(app.get_subcommands().size() == 0u); + CHECK(app.get_subcommands().empty()); args = {"_suboption2"}; run(); @@ -1160,23 +1160,23 @@ TEST_CASE_METHOD(ManySubcommands, "RemoveSub", "[subcom]") { } TEST_CASE_METHOD(ManySubcommands, "RemoveSubFail", "[subcom]") { - auto sub_sub = sub1->add_subcommand("subsub"); + auto *sub_sub = sub1->add_subcommand("subsub"); CHECK(!app.remove_subcommand(sub_sub)); CHECK(sub1->remove_subcommand(sub_sub)); CHECK(!app.remove_subcommand(nullptr)); } TEST_CASE_METHOD(ManySubcommands, "manyIndexQuery", "[subcom]") { - auto s1 = app.get_subcommand(0); - auto s2 = app.get_subcommand(1); - auto s3 = app.get_subcommand(2); - auto s4 = app.get_subcommand(3); + auto *s1 = app.get_subcommand(0); + auto *s2 = app.get_subcommand(1); + auto *s3 = app.get_subcommand(2); + auto *s4 = app.get_subcommand(3); CHECK(sub1 == s1); CHECK(sub2 == s2); CHECK(sub3 == s3); CHECK(sub4 == s4); CHECK_THROWS_AS(app.get_subcommand(4), CLI::OptionNotFound); - auto s0 = app.get_subcommand(); + auto *s0 = app.get_subcommand(); CHECK(sub1 == s0); } @@ -1220,17 +1220,17 @@ TEST_CASE_METHOD(ManySubcommands, "Required2Fuzzy", "[subcom]") { TEST_CASE_METHOD(ManySubcommands, "Unlimited", "[subcom]") { run(); - CHECK(vs_t() == app.remaining(true)); + CHECK(app.remaining(true).empty()); app.require_subcommand(); run(); - CHECK(vs_t() == app.remaining(true)); + CHECK(app.remaining(true).empty()); app.require_subcommand(2, 0); // 2 or more run(); - CHECK(vs_t() == app.remaining(true)); + CHECK(app.remaining(true).empty()); } TEST_CASE_METHOD(ManySubcommands, "HelpFlags", "[subcom]") { @@ -1296,7 +1296,7 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandExclusion", "[subcom]") { TEST_CASE_METHOD(ManySubcommands, "SubcommandOptionExclusion", "[subcom]") { - auto excluder_flag = app.add_flag("--exclude"); + auto *excluder_flag = app.add_flag("--exclude"); sub1->excludes(excluder_flag)->fallthrough(); sub2->excludes(excluder_flag)->fallthrough(); sub3->fallthrough(); @@ -1347,7 +1347,7 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandNeeds", "[subcom]") { TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptions", "[subcom]") { - auto opt = app.add_flag("--subactive"); + auto *opt = app.add_flag("--subactive"); sub1->needs(opt); sub1->fallthrough(); args = {"sub1", "--subactive"}; @@ -1359,7 +1359,7 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptions", "[subcom]") { args = {"--subactive"}; CHECK_NOTHROW(run()); - auto opt2 = app.add_flag("--subactive2"); + auto *opt2 = app.add_flag("--subactive2"); sub1->needs(opt2); args = {"sub1", "--subactive"}; @@ -1375,7 +1375,7 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptions", "[subcom]") { TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptionsCallbackOrdering", "[subcom]") { int count{0}; - auto opt = app.add_flag("--subactive"); + auto *opt = app.add_flag("--subactive"); app.add_flag("--flag1"); sub1->needs(opt); sub1->fallthrough(); @@ -1396,8 +1396,8 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptionsCallbackOrdering", "[su TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsFail", "[subcom]") { - auto opt = app.add_flag("--subactive"); - auto opt2 = app.add_flag("--dummy"); + auto *opt = app.add_flag("--subactive"); + auto *opt2 = app.add_flag("--dummy"); sub1->needs(opt); CHECK_THROWS_AS(sub1->needs((CLI::Option *)nullptr), CLI::OptionNotFound); CHECK_THROWS_AS(sub1->needs((CLI::App *)nullptr), CLI::OptionNotFound); @@ -1491,20 +1491,20 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandSilence", "[subcom]") { TEST_CASE_METHOD(TApp, "UnnamedSub", "[subcom]") { double val{0.0}; - auto sub = app.add_subcommand("", "empty name"); - auto opt = sub->add_option("-v,--value", val); + auto *sub = app.add_subcommand("", "empty name"); + auto *opt = sub->add_option("-v,--value", val); args = {"-v", "4.56"}; run(); CHECK(4.56 == val); // make sure unnamed sub options can be found from the main app - auto opt2 = app.get_option("-v"); + auto *opt2 = app.get_option("-v"); CHECK(opt2 == opt); CHECK_THROWS_AS(app.get_option("--vvvv"), CLI::OptionNotFound); // now test in the constant context const auto &appC = app; - auto opt3 = appC.get_option("-v"); + const auto *opt3 = appC.get_option("-v"); CHECK("--value" == opt3->get_name()); CHECK_THROWS_AS(appC.get_option("--vvvv"), CLI::OptionNotFound); } @@ -1512,9 +1512,9 @@ TEST_CASE_METHOD(TApp, "UnnamedSub", "[subcom]") { TEST_CASE_METHOD(TApp, "UnnamedSubMix", "[subcom]") { double val{0.0}, val2{0.0}, val3{0.0}; app.add_option("-t", val2); - auto sub1 = app.add_subcommand("", "empty name"); + auto *sub1 = app.add_subcommand("", "empty name"); sub1->add_option("-v,--value", val); - auto sub2 = app.add_subcommand("", "empty name2"); + auto *sub2 = app.add_subcommand("", "empty name2"); sub2->add_option("-m,--mix", val3); args = {"-m", "4.56", "-t", "5.93", "-v", "-3"}; @@ -1528,7 +1528,7 @@ TEST_CASE_METHOD(TApp, "UnnamedSubMix", "[subcom]") { TEST_CASE_METHOD(TApp, "UnnamedSubMixExtras", "[subcom]") { double val{0.0}, val2{0.0}; app.add_option("-t", val2); - auto sub = app.add_subcommand("", "empty name"); + auto *sub = app.add_subcommand("", "empty name"); sub->add_option("-v,--value", val); args = {"-m", "4.56", "-t", "5.93", "-v", "-3"}; app.allow_extras(); @@ -1542,7 +1542,7 @@ TEST_CASE_METHOD(TApp, "UnnamedSubMixExtras", "[subcom]") { TEST_CASE_METHOD(TApp, "UnnamedSubNoExtras", "[subcom]") { double val{0.0}, val2{0.0}; app.add_option("-t", val2); - auto sub = app.add_subcommand(); + auto *sub = app.add_subcommand(); sub->add_option("-v,--value", val); args = {"-t", "5.93", "-v", "-3"}; run(); @@ -1554,7 +1554,7 @@ TEST_CASE_METHOD(TApp, "UnnamedSubNoExtras", "[subcom]") { TEST_CASE_METHOD(TApp, "SubcommandAlias", "[subcom]") { double val{0.0}; - auto sub = app.add_subcommand("sub1"); + auto *sub = app.add_subcommand("sub1"); sub->alias("sub2"); sub->alias("sub3"); sub->add_option("-v,--value", val); @@ -1570,7 +1570,7 @@ TEST_CASE_METHOD(TApp, "SubcommandAlias", "[subcom]") { run(); CHECK(7 == val); - auto &al = sub->get_aliases(); + const auto &al = sub->get_aliases(); REQUIRE(2U <= al.size()); CHECK("sub2" == al[0]); @@ -1582,7 +1582,7 @@ TEST_CASE_METHOD(TApp, "SubcommandAlias", "[subcom]") { TEST_CASE_METHOD(TApp, "SubcommandAliasIgnoreCaseUnderscore", "[subcom]") { double val{0.0}; - auto sub = app.add_subcommand("sub1"); + auto *sub = app.add_subcommand("sub1"); sub->alias("sub2"); sub->alias("sub3"); sub->ignore_case(); @@ -1625,7 +1625,7 @@ TEST_CASE_METHOD(TApp, "SubcommandAliasIgnoreCaseUnderscore", "[subcom]") { TEST_CASE_METHOD(TApp, "OptionGroupAlias", "[subcom]") { double val{0.0}; - auto sub = app.add_option_group("sub1"); + auto *sub = app.add_option_group("sub1"); sub->alias("sub2"); sub->alias("sub3"); sub->add_option("-v,--value", val); @@ -1647,7 +1647,7 @@ TEST_CASE_METHOD(TApp, "OptionGroupAlias", "[subcom]") { TEST_CASE_METHOD(TApp, "OptionGroupAliasWithSpaces", "[subcom]") { double val{0.0}; - auto sub = app.add_option_group("sub1"); + auto *sub = app.add_option_group("sub1"); sub->alias("sub2 bb"); sub->alias("sub3/b"); sub->add_option("-v,--value", val); @@ -1668,7 +1668,7 @@ TEST_CASE_METHOD(TApp, "OptionGroupAliasWithSpaces", "[subcom]") { } TEST_CASE_METHOD(TApp, "subcommand_help", "[subcom]") { - auto sub1 = app.add_subcommand("help")->silent(); + auto *sub1 = app.add_subcommand("help")->silent(); bool flag{false}; app.add_flag("--one", flag, "FLAGGER"); sub1->parse_complete_callback([]() { throw CLI::CallForHelp(); }); @@ -1685,8 +1685,8 @@ TEST_CASE_METHOD(TApp, "subcommand_help", "[subcom]") { } TEST_CASE_METHOD(TApp, "AliasErrors", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); - auto sub2 = app.add_subcommand("sub2"); + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); CHECK_THROWS_AS(sub2->alias("this is a not\n a valid alias"), CLI::IncorrectConstruction); CHECK_NOTHROW(sub2->alias("-alias")); // this is allowed but would be unusable on command line parsers @@ -1743,9 +1743,9 @@ TEST_CASE_METHOD(TApp, "ExistingSubcommandMatch", "[subcom]") { } TEST_CASE_METHOD(TApp, "AliasErrorsInOptionGroup", "[subcom]") { - auto sub1 = app.add_subcommand("sub1"); - auto g2 = app.add_option_group("g1"); - auto sub2 = g2->add_subcommand("sub2"); + auto *sub1 = app.add_subcommand("sub1"); + auto *g2 = app.add_option_group("g1"); + auto *sub2 = g2->add_subcommand("sub2"); // cannot alias to an existing subcommand even if it is in an option group CHECK_THROWS_AS(sub2->alias("sub1"), CLI::OptionAlreadyAdded); @@ -1765,7 +1765,7 @@ TEST_CASE("SharedSubTests: SharedSubcommand", "[subcom]") { CLI::App app1{"test program1"}; app1.add_option("-t", val2); - auto sub = app1.add_subcommand("", "empty name"); + auto *sub = app1.add_subcommand("", "empty name"); sub->add_option("-v,--value", val); sub->add_option("-g", val4); CLI::App app2{"test program2"}; @@ -1795,7 +1795,7 @@ TEST_CASE("SharedSubTests: SharedSubIndependent", "[subcom]") { CLI::App_p app1 = std::make_shared<CLI::App>("test program1"); app1->allow_extras(); app1->add_option("-t", val2); - auto sub = app1->add_subcommand("", "empty name"); + auto *sub = app1->add_subcommand("", "empty name"); sub->add_option("-v,--value", val); sub->add_option("-g", val4); @@ -1823,7 +1823,7 @@ TEST_CASE("SharedSubTests: SharedSubIndependentReuse", "[subcom]") { CLI::App_p app1 = std::make_shared<CLI::App>("test program1"); app1->allow_extras(); app1->add_option("-t", val2); - auto sub = app1->add_subcommand("", "empty name"); + auto *sub = app1->add_subcommand("", "empty name"); sub->add_option("-v,--value", val); sub->add_option("-g", val4); @@ -1884,14 +1884,14 @@ TEST_CASE_METHOD(ManySubcommands, "defaultEnabledSubcommand", "[subcom]") { sub2->enabled_by_default(); run(); auto rem = app.remaining(); - CHECK(0u == rem.size()); + CHECK(rem.empty()); CHECK(sub2->get_enabled_by_default()); sub2->disabled(); CHECK(sub2->get_disabled()); run(); // this should disable it again even though it was disabled rem = app.remaining(); - CHECK(0u == rem.size()); + CHECK(rem.empty()); CHECK(sub2->get_enabled_by_default()); CHECK(!sub2->get_disabled()); } @@ -1955,3 +1955,16 @@ TEST_CASE_METHOD(TApp, "MultiFinalCallbackCounts", "[subcom]") { CHECK(subsub_final == 1); } } + +// From gitter issue +TEST_CASE_METHOD(TApp, "SubcommandInOptionGroupCallbackCount", "[subcom]") { + + int subcount{0}; + auto *group1 = app.add_option_group("FirstGroup"); + + group1->add_subcommand("g1c1")->callback([&subcount]() { ++subcount; }); + + args = {"g1c1"}; + run(); + CHECK(subcount == 1); +} diff --git a/packages/CLI11/tests/TimerTest.cpp b/packages/CLI11/tests/TimerTest.cpp index 11e6e12177815c0d18e228aedd3736927b47d79e..a3d8c1d9ee9b9af7919e152b480e4668690cc260 100644 --- a/packages/CLI11/tests/TimerTest.cpp +++ b/packages/CLI11/tests/TimerTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/TransformTest.cpp b/packages/CLI11/tests/TransformTest.cpp index 76a1eff83012ae33b2b3c20ea37102796acf9b55..5ace484ecce831b21013bf02b64d2d7dc42f5687 100644 --- a/packages/CLI11/tests/TransformTest.cpp +++ b/packages/CLI11/tests/TransformTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,6 +6,8 @@ #include "app_helper.hpp" +#include <cmath> + #include <array> #include <chrono> #include <cstdint> @@ -22,7 +24,7 @@ TEST_CASE_METHOD(TApp, "SimpleTransform", "[transform]") { int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", std::string("1")}})); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", std::string("1")}})); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -32,7 +34,7 @@ TEST_CASE_METHOD(TApp, "SimpleTransform", "[transform]") { TEST_CASE_METHOD(TApp, "SimpleTransformInitList", "[transform]") { int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", "1"}})); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", "1"}})); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -42,7 +44,7 @@ TEST_CASE_METHOD(TApp, "SimpleTransformInitList", "[transform]") { TEST_CASE_METHOD(TApp, "SimpleNumericalTransform", "[transform]") { int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(CLI::TransformPairs<int>{{"one", 1}})); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(CLI::TransformPairs<int>{{"one", 1}})); args = {"-s", "one"}; run(); CHECK(app.count("-s") == 1u); @@ -53,9 +55,9 @@ TEST_CASE_METHOD(TApp, "SimpleNumericalTransform", "[transform]") { TEST_CASE_METHOD(TApp, "EnumTransform", "[transform]") { enum class test_cli : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; test_cli value{test_cli::val2}; - auto opt = app.add_option("-s", value) - ->transform(CLI::Transformer(CLI::TransformPairs<test_cli>{ - {"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}})); + auto *opt = app.add_option("-s", value) + ->transform(CLI::Transformer(CLI::TransformPairs<test_cli>{ + {"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}})); args = {"-s", "val1"}; run(); CHECK(app.count("-s") == 1u); @@ -82,9 +84,9 @@ TEST_CASE_METHOD(TApp, "EnumTransform", "[transform]") { TEST_CASE_METHOD(TApp, "EnumCheckedTransform", "[transform]") { enum class test_cli : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; test_cli value{test_cli::val1}; - auto opt = app.add_option("-s", value) - ->transform(CLI::CheckedTransformer(CLI::TransformPairs<test_cli>{ - {"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}})); + auto *opt = app.add_option("-s", value) + ->transform(CLI::CheckedTransformer(CLI::TransformPairs<test_cli>{ + {"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}})); args = {"-s", "val1"}; run(); CHECK(app.count("-s") == 1u); @@ -149,7 +151,7 @@ TEST_CASE_METHOD(TApp, "EnumCheckedDefaultTransformCallback", "[transform]") { TEST_CASE_METHOD(TApp, "SimpleTransformFn", "[transform]") { int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", "1"}}, CLI::ignore_case)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer({{"one", "1"}}, CLI::ignore_case)); args = {"-s", "ONE"}; run(); CHECK(app.count("-s") == 1u); @@ -172,7 +174,7 @@ TEST_CASE_METHOD(TApp, "StringViewTransformFn", "[transform]") { TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFn", "[transform]") { int value{0}; - auto opt = + auto *opt = app.add_option("-s", value) ->transform(CLI::Transformer(std::vector<std::pair<std::string, int>>{{"one", 1}}, CLI::ignore_case)); args = {"-s", "ONe"}; @@ -185,7 +187,7 @@ TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFn", "[transform]") { TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFnVector", "[transform]") { std::vector<std::pair<std::string, int>> conversions{{"one", 1}, {"two", 2}}; int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(conversions, CLI::ignore_case)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(conversions, CLI::ignore_case)); args = {"-s", "ONe"}; run(); CHECK(app.count("-s") == 1u); @@ -199,7 +201,7 @@ TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFnArray", "[transform]") { conversions[1] = std::make_pair(std::string("two"), 2); int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(conversions, CLI::ignore_case)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(conversions, CLI::ignore_case)); args = {"-s", "ONe"}; run(); CHECK(app.count("-s") == 1u); @@ -215,7 +217,7 @@ TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFnconstexprArray", "[transform]" constexpr std::array<std::pair<const char *, int>, 2> conversions_c{{p1, p2}}; int value{0}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(&conversions_c, CLI::ignore_case)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(&conversions_c, CLI::ignore_case)); args = {"-s", "ONe"}; run(); CHECK(app.count("-s") == 1u); @@ -233,12 +235,12 @@ TEST_CASE_METHOD(TApp, "SimpleNumericalTransformFnconstexprArray", "[transform]" TEST_CASE_METHOD(TApp, "EnumTransformFn", "[transform]") { enum class test_cli : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; test_cli value{test_cli::val2}; - auto opt = app.add_option("-s", value) - ->transform(CLI::Transformer(CLI::TransformPairs<test_cli>{{"val1", test_cli::val1}, - {"val2", test_cli::val2}, - {"val3", test_cli::val3}}, - CLI::ignore_case, - CLI::ignore_underscore)); + auto *opt = app.add_option("-s", value) + ->transform(CLI::Transformer(CLI::TransformPairs<test_cli>{{"val1", test_cli::val1}, + {"val2", test_cli::val2}, + {"val3", test_cli::val3}}, + CLI::ignore_case, + CLI::ignore_underscore)); args = {"-s", "val_1"}; run(); CHECK(app.count("-s") == 1u); @@ -261,7 +263,7 @@ TEST_CASE_METHOD(TApp, "EnumTransformFnMap", "[transform]") { enum class test_cli : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; std::map<std::string, test_cli> map{{"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}}; test_cli value{test_cli::val3}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); args = {"-s", "val_1"}; run(); CHECK(app.count("-s") == 1u); @@ -284,7 +286,8 @@ TEST_CASE_METHOD(TApp, "EnumTransformFnPtrMap", "[transform]") { enum class test_cli : std::int16_t { val1 = 3, val2 = 4, val3 = 17, val4 = 37 }; std::map<std::string, test_cli> map{{"val1", test_cli::val1}, {"val2", test_cli::val2}, {"val3", test_cli::val3}}; test_cli value{test_cli::val2}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(&map, CLI::ignore_case, CLI::ignore_underscore)); + auto *opt = + app.add_option("-s", value)->transform(CLI::Transformer(&map, CLI::ignore_case, CLI::ignore_underscore)); args = {"-s", "val_1"}; run(); CHECK(app.count("-s") == 1u); @@ -316,7 +319,7 @@ TEST_CASE_METHOD(TApp, "EnumTransformFnSharedPtrMap", "[transform]") { mp["val3"] = test_cli::val3; test_cli value{test_cli::val2}; - auto opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); + auto *opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); args = {"-s", "val_1"}; run(); CHECK(app.count("-s") == 1u); @@ -343,7 +346,7 @@ TEST_CASE_METHOD(TApp, "EnumTransformFnSharedPtrMap", "[transform]") { TEST_CASE_METHOD(TApp, "TransformCascade", "[transform]") { std::string output; - auto opt = app.add_option("-s", output); + auto *opt = app.add_option("-s", output); opt->transform(CLI::Transformer({{"abc", "abcd"}, {"bbc", "bbcd"}, {"cbc", "cbcd"}}, CLI::ignore_case)); opt->transform( CLI::Transformer({{"ab", "abc"}, {"bc", "bbc"}, {"cb", "cbc"}}, CLI::ignore_case, CLI::ignore_underscore)); @@ -370,7 +373,7 @@ TEST_CASE_METHOD(TApp, "TransformCascade", "[transform]") { TEST_CASE_METHOD(TApp, "TransformCascadeDeactivate", "[transform]") { std::string output; - auto opt = app.add_option("-s", output); + auto *opt = app.add_option("-s", output); opt->transform( CLI::Transformer({{"abc", "abcd"}, {"bbc", "bbcd"}, {"cbc", "cbcd"}}, CLI::ignore_case).name("tform1")); opt->transform( @@ -390,7 +393,7 @@ TEST_CASE_METHOD(TApp, "TransformCascadeDeactivate", "[transform]") { args = {"-s", "C_B"}; CHECK_THROWS_AS(run(), CLI::ValidationError); - auto validator = opt->get_validator("tform2"); + auto *validator = opt->get_validator("tform2"); CHECK(!validator->get_active()); CHECK("tform2" == validator->get_name()); validator->active(); @@ -475,28 +478,28 @@ TEST_CASE_METHOD(TApp, "IntTransformNonMerge", "[transform]") { CHECK(help.find("15->5") != std::string::npos); CHECK(help.find("25->5") != std::string::npos); - auto validator = app.get_option("-s")->get_validator(); + auto *validator = app.get_option("-s")->get_validator(); help = validator->get_description(); CHECK(help.find("15->5") != std::string::npos); CHECK(help.find("25->5") != std::string::npos); - auto validator2 = app.get_option("-s")->get_validator("merge"); + auto *validator2 = app.get_option("-s")->get_validator("merge"); CHECK(validator == validator2); } TEST_CASE_METHOD(TApp, "IntTransformMergeWithCustomValidator", "[transform]") { std::string value; - auto opt = app.add_option("-s", value) - ->transform(CLI::Transformer(std::map<int, int>{{15, 5}, {18, 6}, {21, 7}}) | - CLI::Validator( - [](std::string &element) { - if(element == "frog") { - element = "hops"; - } - return std::string{}; - }, - std::string{}), - "check"); + auto *opt = app.add_option("-s", value) + ->transform(CLI::Transformer(std::map<int, int>{{15, 5}, {18, 6}, {21, 7}}) | + CLI::Validator( + [](std::string &element) { + if(element == "frog") { + element = "hops"; + } + return std::string{}; + }, + std::string{}), + "check"); args = {"-s", "15"}; run(); CHECK("5" == value); @@ -518,7 +521,7 @@ TEST_CASE_METHOD(TApp, "IntTransformMergeWithCustomValidator", "[transform]") { CHECK(help.find("15->5") != std::string::npos); CHECK(help.find("OR") == std::string::npos); - auto validator = opt->get_validator("check"); + auto *validator = opt->get_validator("check"); CHECK("check" == validator->get_name()); validator->active(false); help = app.help(); @@ -526,7 +529,7 @@ TEST_CASE_METHOD(TApp, "IntTransformMergeWithCustomValidator", "[transform]") { } TEST_CASE_METHOD(TApp, "BoundTests", "[transform]") { - double value; + double value = NAN; app.add_option("-s", value)->transform(CLI::Bound(3.4, 5.9)); args = {"-s", "15"}; run(); @@ -636,9 +639,8 @@ TEST_CASE_METHOD(TApp, "NumberWithUnitMandatoryUnit", "[transform]") { int value{0}; app.add_option("-n", value) - ->transform(CLI::AsNumberWithUnit(mapping, - CLI::AsNumberWithUnit::Options(CLI::AsNumberWithUnit::UNIT_REQUIRED | - CLI::AsNumberWithUnit::CASE_SENSITIVE))); + ->transform(CLI::AsNumberWithUnit( + mapping, CLI::AsNumberWithUnit::UNIT_REQUIRED | CLI::AsNumberWithUnit::CASE_SENSITIVE)); args = {"-n", "42a"}; run(); @@ -657,9 +659,8 @@ TEST_CASE_METHOD(TApp, "NumberWithUnitMandatoryUnit2", "[transform]") { int value{0}; app.add_option("-n", value) - ->transform(CLI::AsNumberWithUnit(mapping, - CLI::AsNumberWithUnit::Options(CLI::AsNumberWithUnit::UNIT_REQUIRED | - CLI::AsNumberWithUnit::CASE_INSENSITIVE))); + ->transform(CLI::AsNumberWithUnit( + mapping, CLI::AsNumberWithUnit::UNIT_REQUIRED | CLI::AsNumberWithUnit::CASE_INSENSITIVE)); args = {"-n", "42A"}; run(); @@ -708,7 +709,7 @@ TEST_CASE_METHOD(TApp, "NumberWithUnitBadInput", "[transform]") { TEST_CASE_METHOD(TApp, "NumberWithUnitIntOverflow", "[transform]") { std::map<std::string, int> mapping{{"a", 1000000}, {"b", 100}, {"c", 101}}; - std::int32_t value; + std::int32_t value = 0; app.add_option("-n", value)->transform(CLI::AsNumberWithUnit(mapping)); args = {"-n", "1000 a"}; diff --git a/packages/CLI11/tests/TrueFalseTest.cpp b/packages/CLI11/tests/TrueFalseTest.cpp index c3b556c3fdd89c252474e03fd8f4f0f6a120ebc3..d7d2f2cd0bfc599bbcb625d1eec49bd99f5b4dee 100644 --- a/packages/CLI11/tests/TrueFalseTest.cpp +++ b/packages/CLI11/tests/TrueFalseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/WindowsTest.cpp b/packages/CLI11/tests/WindowsTest.cpp index 5a75908c20f95f9d4089cbcae72b68caa6338416..0527cfb082fedc498ab0903a431b743218ef6d4c 100644 --- a/packages/CLI11/tests/WindowsTest.cpp +++ b/packages/CLI11/tests/WindowsTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/app_helper.hpp b/packages/CLI11/tests/app_helper.hpp index 91991682544dc465c44c989fe1a4e0e4dd2c56e9..f8d7e7221b395777f60088308c2bfaf11cef86b5 100644 --- a/packages/CLI11/tests/app_helper.hpp +++ b/packages/CLI11/tests/app_helper.hpp @@ -46,8 +46,8 @@ class TempFile { std::remove(_name.c_str()); // Doesn't matter if returns 0 or not } - operator const std::string &() const { return _name; } - const char *c_str() const { return _name.c_str(); } + operator const std::string &() const { return _name; } // NOLINT(google-explicit-constructor) + CLI11_NODISCARD const char *c_str() const { return _name.c_str(); } }; inline void put_env(std::string name, std::string value) { diff --git a/packages/CLI11/tests/catch.hpp b/packages/CLI11/tests/catch.hpp index 2aaeae76e3c58c517e0212ef0a31d0fe79db7dea..da41d685d1ec30e5d278595dca96403831713524 100644 --- a/packages/CLI11/tests/catch.hpp +++ b/packages/CLI11/tests/catch.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/informational.cpp b/packages/CLI11/tests/informational.cpp index f0fc70ba1778262d1b6888075382181e919c246f..9df227fab8f053eefa765e81a53befd9f0023181 100644 --- a/packages/CLI11/tests/informational.cpp +++ b/packages/CLI11/tests/informational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/link_test_1.cpp b/packages/CLI11/tests/link_test_1.cpp index 447afbf4e94a62cb3980b6e5bf5f178d6852f6a6..1cbec7b772c602177f1cf5941282fcc4b68ed943 100644 --- a/packages/CLI11/tests/link_test_1.cpp +++ b/packages/CLI11/tests/link_test_1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/link_test_2.cpp b/packages/CLI11/tests/link_test_2.cpp index abce5493b75cf4619f08d41daa83c2e997b5647d..9dcc3db230db2eb78fba82f3218f2a45a2279ae9 100644 --- a/packages/CLI11/tests/link_test_2.cpp +++ b/packages/CLI11/tests/link_test_2.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/main.cpp b/packages/CLI11/tests/main.cpp index f5fbebd81dad107729cb1e239e846f3a05d610f9..20bb46d615f52eb8a62dc836e8e6292926ff364f 100644 --- a/packages/CLI11/tests/main.cpp +++ b/packages/CLI11/tests/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/meson.build b/packages/CLI11/tests/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..27e221619f3c7bf733e4755fcac3a142a4021aa0 --- /dev/null +++ b/packages/CLI11/tests/meson.build @@ -0,0 +1,78 @@ +catch2 = dependency('catch2') + +testmain = static_library( + 'catch_main', + 'main.cpp', 'catch.hpp', + dependencies: catch2, +) +testdep = declare_dependency( + link_with: testmain, + dependencies: [catch2, CLI11_dep] +) + +link_test_lib = library( + 'link_test_1', + 'link_test_1.cpp', + dependencies: CLI11_dep, +) + +if cxx.get_id() == 'msvc' + nodeprecated = ['/wd4996'] +else + nodeprecated = ['-Wno-deprecated-declarations'] +endif + +boost = dependency('boost', required: false) +if boost.found() + boost_dep = declare_dependency( + dependencies: boost, + compile_args: '-DCLI11_BOOST_OPTIONAL', + ) +else + boost_dep = declare_dependency() +endif + +testnames = [ + ['HelpersTest', {}], + ['ConfigFileTest', {}], + ['OptionTypeTest', {}], + ['SimpleTest', {}], + ['AppTest', {}], + ['SetTest', {}], + ['TransformTest', {}], + ['CreationTest', {}], + ['SubcommandTest', {}], + ['HelpTest', {}], + ['FormatterTest', {}], + ['NewParseTest', {}], + ['OptionalTest', {'dependencies': boost_dep}], + ['DeprecatedTest', {'cpp_args': nodeprecated}], + ['StringParseTest', {}], + ['ComplexTypeTest', {}], + ['TrueFalseTest', {}], + ['OptionGroupTest', {}], + # multi-only + ['TimerTest', {}], + # link_test + ['link_test_2', {'link_with': link_test_lib}], +] + +if host_machine.system() == 'windows' + testnames += [['WindowsTest', {}]] +endif + +if boost.found() + testnames += [['BoostOptionTypeTest', {'dependencies': boost_dep}]] +endif + +foreach n: testnames + name = n[0] + kwargs = n[1] + t = executable(name, name + '.cpp', + cpp_args: kwargs.get('cpp_args', []), + build_by_default: false, + dependencies: [testdep] + kwargs.get('dependencies', []), + link_with: kwargs.get('link_with', []) + ) + test(name, t) +endforeach diff --git a/packages/CLI11/tests/mesonTest/subprojects/CLI11 b/packages/CLI11/tests/mesonTest/subprojects/CLI11 deleted file mode 120000 index a8a4f8c2127bf74725cf14800dde7ea8aeec5c5c..0000000000000000000000000000000000000000 --- a/packages/CLI11/tests/mesonTest/subprojects/CLI11 +++ /dev/null @@ -1 +0,0 @@ -../../.. \ No newline at end of file diff --git a/packages/Catch2/.bazelrc b/packages/Catch2/.bazelrc new file mode 100644 index 0000000000000000000000000000000000000000..55f17a67d6143ba16b89d5ae9ddb155fe1ca65d9 --- /dev/null +++ b/packages/Catch2/.bazelrc @@ -0,0 +1,4 @@ +build:gcc9 --cxxopt=-std=c++2a +build:clang13 --cxxopt=-std=c++17 +build:vs2019 --cxxopt=/std:c++17 +build:vs2022 --cxxopt=/std:c++17 \ No newline at end of file diff --git a/packages/Catch2/.github/FUNDING.yml b/packages/Catch2/.github/FUNDING.yml index 4d8a0e95ae59d78c522dd3422ed050c5946c8f3e..9122aa8ae334f434a3f6e508d06df5c8aa9ccded 100644 --- a/packages/Catch2/.github/FUNDING.yml +++ b/packages/Catch2/.github/FUNDING.yml @@ -1 +1,2 @@ +github: "horenmar" custom: "https://www.paypal.me/horenmar" diff --git a/packages/Catch2/.github/workflows/linux-other-builds.yml b/packages/Catch2/.github/workflows/linux-other-builds.yml index 61ebf3d7e2dc542b0e96ecacce6789c3d4a1f6a4..31dcb92195bd6b61d7adef2a5b3274d4ac434476 100644 --- a/packages/Catch2/.github/workflows/linux-other-builds.yml +++ b/packages/Catch2/.github/workflows/linux-other-builds.yml @@ -51,6 +51,23 @@ jobs: other_pkgs: clang-10 cmake_configurations: -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON + # Configure tests with Clang-10 + - cxx: clang++-10 + build_description: CMake configuration tests + build_type: Debug + std: 14 + other_pkgs: clang-10 + cmake_configurations: -DCATCH_ENABLE_CONFIGURE_TESTS=ON + + # Valgrind test Clang-10 + - cxx: clang++-10 + build_description: Valgrind tests + build_type: Debug + std: 14 + other_pkgs: clang-10 valgrind + cmake_configurations: -DMEMORYCHECK_COMMAND=`which valgrind` -DMEMORYCHECK_COMMAND_OPTIONS="-q --track-origins=yes --leak-check=full --num-callers=50 --show-leak-kinds=definite --error-exitcode=1" + other_ctest_args: -T memcheck -LE uses-python + steps: - uses: actions/checkout@v2 @@ -83,4 +100,4 @@ jobs: 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 + run: ctest -C ${{matrix.build_type}} -j 2 ${{matrix.other_ctest_args}} diff --git a/packages/Catch2/.github/workflows/mac-builds.yml b/packages/Catch2/.github/workflows/mac-builds.yml index 5bcc35414b959b79435ecaa06b49a877cf1352b3..0ad5982dcc9b817790bf6472a63371adf7038355 100644 --- a/packages/Catch2/.github/workflows/mac-builds.yml +++ b/packages/Catch2/.github/workflows/mac-builds.yml @@ -4,11 +4,11 @@ on: [push, pull_request] jobs: build: - runs-on: macos-10.15 + runs-on: macos-12 strategy: matrix: cxx: - - g++-9 + - g++-11 - clang++ build_type: [Debug, Release] std: [14, 17] diff --git a/packages/Catch2/.gitignore b/packages/Catch2/.gitignore index 1b3934bf5e7f4854ea526248190d97cd4f4f8308..cafbd6b2979e841e857fe6b942525d70bf538c83 100644 --- a/packages/Catch2/.gitignore +++ b/packages/Catch2/.gitignore @@ -11,11 +11,6 @@ Release 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 @@ -25,9 +20,17 @@ DerivedData Build .idea .vs +.vscode cmake-build-* benchmark-dir .conan/test_package/build bazel-* build-fuzzers debug-build +.vscode +msvc-sln* +# Currently we use Doxygen for dep graphs and the full docs are only slowly +# being filled in, so we definitely do not want git to deal with the docs. +docs/doxygen +*.cache +compile_commands.json diff --git a/packages/Catch2/.gitrepo b/packages/Catch2/.gitrepo index 3bb3f7649f68e0d2962f3f6b488cdd1cdb401f31..de961c79fcf1019990fc65996d7ebf36934f9eae 100644 --- a/packages/Catch2/.gitrepo +++ b/packages/Catch2/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:catchorg/Catch2.git branch = devel - commit = fb4153e05e430921574d79d868ebc44dd9528629 - parent = 57867f14916a3779d2de6004b203bd636dcfee88 + commit = 7b2e7d623b626ed2cae1d4b7f2b5480bdabbefd8 + parent = 95b3a702d689cb12fed8c321811e8afcff4485d4 method = merge cmdver = 0.4.3 diff --git a/packages/Catch2/BUILD.bazel b/packages/Catch2/BUILD.bazel index 6dc626d806f123c31beefdb8c8d258b1c39e2248..7c4435163104f15a226566e8f07ed68a47b29e33 100644 --- a/packages/Catch2/BUILD.bazel +++ b/packages/Catch2/BUILD.bazel @@ -1,25 +1,91 @@ # Load the cc_library rule. load("@rules_cc//cc:defs.bzl", "cc_library") +load("@bazel_skylib//rules:expand_template.bzl", "expand_template") + +expand_template( + name = "catch_user_config", + out = "catch2/catch_user_config.hpp", + substitutions = { + "#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "", + "#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT", + "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "", + "#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "", + "#cmakedefine CATCH_CONFIG_COUNTER": "", + "#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "", + "#cmakedefine CATCH_CONFIG_CPP17_BYTE": "", + "#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "", + "#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "", + "#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "", + "#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "", + "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "", + "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "", + "#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION": "", + "#cmakedefine CATCH_CONFIG_DISABLE": "", + "#cmakedefine CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS": "", + "#cmakedefine CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER": "", + "#cmakedefine CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER": "", + "#cmakedefine CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER": "", + "#cmakedefine CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER": "", + "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT": "", + "#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@": "", + "#cmakedefine CATCH_CONFIG_FAST_COMPILE": "", + "#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER": "", + "#cmakedefine CATCH_CONFIG_NO_COUNTER": "", + "#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "", + "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "", + "#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "", + "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "", + "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "", + "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "", + "#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "", + "#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "", + "#cmakedefine CATCH_CONFIG_NO_USE_ASYNC": "", + "#cmakedefine CATCH_CONFIG_NO_WCHAR": "", + "#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH": "", + "#cmakedefine CATCH_CONFIG_NOSTDOUT": "", + "#cmakedefine CATCH_CONFIG_POSIX_SIGNALS": "", + "#cmakedefine CATCH_CONFIG_PREFIX_ALL": "", + "#cmakedefine CATCH_CONFIG_USE_ASYNC": "", + "#cmakedefine CATCH_CONFIG_WCHAR": "", + "#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "", + "#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "", + "#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "", + "@CATCH_CONFIG_DEFAULT_REPORTER@": "console", + "@CATCH_CONFIG_CONSOLE_WIDTH@": "80", + }, + template = "src/catch2/catch_user_config.hpp.in", +) + +# Generated header library, modifies the include prefix to account for +# generation path so that we can include <catch2/catch_user_config.hpp> +# correctly. +cc_library( + name = "catch2_generated", + hdrs = ["catch2/catch_user_config.hpp"], + include_prefix = ".", # to manipulate -I of dependenices + visibility = ["//visibility:public"], +) # Static library, without main. cc_library( name = "catch2", + srcs = glob( + ["src/catch2/**/*.cpp"], + exclude = ["src/catch2/internal/catch_main.cpp"], + ), 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/"], + linkstatic = True, + visibility = ["//visibility:public"], + deps = [":catch2_generated"], ) # 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/"], -) + linkstatic = True, + visibility = ["//visibility:public"], + deps = [":catch2"], +) \ No newline at end of file diff --git a/packages/Catch2/CMake/CatchConfigOptions.cmake b/packages/Catch2/CMake/CatchConfigOptions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a8ae93d43e7837caac719f75018a6b4d089d2252 --- /dev/null +++ b/packages/Catch2/CMake/CatchConfigOptions.cmake @@ -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 + +## +# This file contains options that are materialized into the Catch2 +# compiled library. All of them default to OFF, as even the positive +# forms correspond to the user _forcing_ them to ON, while being OFF +# means that Catch2 can use its own autodetection. +# +# For detailed docs look into docs/configuration.md + + +macro(AddOverridableConfigOption OptionBaseName) + option(CATCH_CONFIG_${OptionBaseName} "Read docs/configuration.md for details" OFF) + option(CATCH_CONFIG_NO_${OptionBaseName} "Read docs/configuration.md for details" OFF) +endmacro() + +macro(AddConfigOption OptionBaseName) + option(CATCH_CONFIG_${OptionBaseName} "Read docs/configuration.md for details" OFF) +endmacro() + +set(_OverridableOptions + "ANDROID_LOGWRITE" + "BAZEL_SUPPORT" + "COLOUR_WIN32" + "COUNTER" + "CPP11_TO_STRING" + "CPP17_BYTE" + "CPP17_OPTIONAL" + "CPP17_STRING_VIEW" + "CPP17_UNCAUGHT_EXCEPTIONS" + "CPP17_VARIANT" + "GLOBAL_NEXTAFTER" + "POSIX_SIGNALS" + "USE_ASYNC" + "WCHAR" + "WINDOWS_SEH" +) + +foreach(OptionName ${_OverridableOptions}) + AddOverridableConfigOption(${OptionName}) +endforeach() + +set(_OtherConfigOptions + "DISABLE_EXCEPTIONS" + "DISABLE_EXCEPTIONS_CUSTOM_HANDLER" + "DISABLE" + "DISABLE_STRINGIFICATION" + "ENABLE_ALL_STRINGMAKERS" + "ENABLE_OPTIONAL_STRINGMAKER" + "ENABLE_PAIR_STRINGMAKER" + "ENABLE_TUPLE_STRINGMAKER" + "ENABLE_VARIANT_STRINGMAKER" + "EXPERIMENTAL_REDIRECT" + "FAST_COMPILE" + "NOSTDOUT" + "PREFIX_ALL" + "WINDOWS_CRTDBG" +) + + +foreach(OptionName ${_OtherConfigOptions}) + AddConfigOption(${OptionName}) +endforeach() + +set(CATCH_CONFIG_DEFAULT_REPORTER "console" CACHE STRING "Read docs/configuration.md for details. The name of the reporter should be without quotes.") +set(CATCH_CONFIG_CONSOLE_WIDTH "80" CACHE STRING "Read docs/configuration.md for details. Must form a valid integer literal.") + +# There is no good way to both turn this into a CMake cache variable, +# and keep reasonable default semantics inside the project. Thus we do +# not define it and users have to provide it as an outside variable. +#set(CATCH_CONFIG_FALLBACK_STRINGIFIER "" CACHE STRING "Read docs/configuration.md for details.") diff --git a/packages/Catch2/CMake/MiscFunctions.cmake b/packages/Catch2/CMake/CatchMiscFunctions.cmake similarity index 73% rename from packages/Catch2/CMake/MiscFunctions.cmake rename to packages/Catch2/CMake/CatchMiscFunctions.cmake index 7548f287f9f14fd5a761da97693d34394d317d25..73c8b4dd26a780e3276ec54fc6fec42a81dfa651 100644 --- a/packages/Catch2/CMake/MiscFunctions.cmake +++ b/packages/Catch2/CMake/CatchMiscFunctions.cmake @@ -1,3 +1,11 @@ + +# 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(CheckCXXCompilerFlag) function(add_cxx_flag_if_supported_to_targets flagname targets) check_cxx_compiler_flag("${flagname}" HAVE_FLAG_${flagname}) @@ -35,35 +43,58 @@ function(add_warnings_to_targets targets) if (NOT MSVC) set(CHECKED_WARNING_FLAGS + "-Wabsolute-value" "-Wall" - "-Wextra" - "-Wpedantic" - "-Wweak-vtables" - "-Wunreachable-code" - "-Wmissing-declarations" + "-Wc++20-compat" + "-Wcall-to-pure-virtual-from-ctor-dtor" + "-Wcast-align" + "-Wcatch-value" + "-Wdangling" + "-Wdeprecated" + "-Wdeprecated-register" + "-Wexceptions" "-Wexit-time-destructors" + "-Wextra" + "-Wextra-semi" + "-Wfloat-equal" "-Wglobal-constructors" + "-Winit-self" + "-Wmisleading-indentation" + "-Wmismatched-new-delete" + "-Wmismatched-return-types" + "-Wmismatched-tags" + "-Wmissing-braces" + "-Wmissing-declarations" "-Wmissing-noreturn" + "-Wmissing-prototypes" + "-Wmissing-variable-declarations" + "-Wnull-dereference" + "-Wold-style-cast" + "-Woverloaded-virtual" "-Wparentheses" - "-Wextra-semi" - "-Wunreachable-code" - "-Wstrict-aliasing" + "-Wpedantic" + "-Wreorder" "-Wreturn-std-move" - "-Wmissing-braces" - "-Wdeprecated" - "-Wvla" + "-Wshadow" + "-Wstrict-aliasing" + "-Wsuggest-destructor-override" + "-Wsuggest-override" "-Wundef" - "-Wmisleading-indentation" - "-Wcatch-value" - "-Wabsolute-value" - "-Wreturn-std-move" - "-Wunused-parameter" + "-Wuninitialized" + "-Wunneeded-internal-declaration" + "-Wunreachable-code" + "-Wunused" "-Wunused-function" - "-Wcall-to-pure-virtual-from-ctor-dtor" - "-Wdeprecated-register" - "-Wsuggest-override" - "-Wshadow" - "-Wold-style-cast" + "-Wunused-parameter" + "-Wvla" + "-Wweak-vtables" + + # This is a useful warning, but our tests sometimes rely on + # functions being present, but not picked (e.g. various checks + # for stringification implementation ordering). + # Ergo, we should use it every now and then, but we cannot + # enable it by default. + # "-Wunused-member-function" ) foreach(warning ${CHECKED_WARNING_FLAGS}) add_cxx_flag_if_supported_to_targets(${warning} "${targets}") diff --git a/packages/Catch2/CMake/catch2-with-main.pc.in b/packages/Catch2/CMake/catch2-with-main.pc.in index 122f1f96a726279471f1ceaa13315f970a8bbaa7..69a790bbdbd28822ace8ce9be2560c2c6af9cf68 100644 --- a/packages/Catch2/CMake/catch2-with-main.pc.in +++ b/packages/Catch2/CMake/catch2-with-main.pc.in @@ -7,4 +7,4 @@ Description: A modern, C++-native test framework for C++14 and above (links in d Version: ${pkg_version} Requires: catch2 = ${pkg_version} Cflags: -I${includedir} -Libs: -L${libdir} -lCatch2WithMain +Libs: -L${libdir} -lCatch2Main diff --git a/packages/Catch2/CMakeLists.txt b/packages/Catch2/CMakeLists.txt index f1be3f59435e965a6f2007f8a9cb35dad3639f85..ae8e86b9b9564ea914660612ceaaa5f642dc5f0f 100644 --- a/packages/Catch2/CMakeLists.txt +++ b/packages/Catch2/CMakeLists.txt @@ -9,7 +9,7 @@ else() endif() option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON) -option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON) +option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON) option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF) include(CMakeDependentOption) @@ -20,6 +20,7 @@ cmake_dependent_option(CATCH_BUILD_FUZZERS "Build fuzzers" OFF "CATCH_DEVELOPMEN 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) cmake_dependent_option(CATCH_BUILD_SURROGATES "Enable generating and building surrogate TUs for the main headers" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_CONFIGURE_TESTS "Enable CMake configuration tests. WARNING: VERY EXPENSIVE" OFF "CATCH_DEVELOPMENT_BUILD" OFF) # Catch2's build breaks if done in-tree. You probably should not build @@ -29,18 +30,37 @@ 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) +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9) # Enable IPO for CMake versions that support it cmake_policy(SET CMP0069 NEW) + project(Catch2 + VERSION 3.1.0 # CML version placeholder, don't delete + LANGUAGES CXX + # HOMEPAGE_URL is not supported until CMake version 3.12, which + # we do not target yet. + # HOMEPAGE_URL "https://github.com/catchorg/Catch2" + DESCRIPTION "A modern, C++-native, unit test framework." + ) +else() + project(Catch2 + VERSION 3.1.0 # CML version placeholder, don't delete + LANGUAGES CXX + ) endif() - -project(Catch2 LANGUAGES CXX VERSION 3.0.0) - -# Provide path for scripts +# Provide path for scripts. We first add path to the scripts we don't use, +# but projects including us might, and set the path up to parent scope. +# Then we also add path that we use to configure the project, but is of +# no use to top level projects. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/extras") +if (NOT NOT_SUBPROJECT) + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE) +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") + include(GNUInstallDirs) include(CMakePackageConfigHelpers) +include(CatchConfigOptions) if(CATCH_DEVELOPMENT_BUILD) include(CTest) endif() @@ -93,16 +113,6 @@ 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 @@ -114,27 +124,11 @@ if (NOT_SUBPROJECT) ${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 @@ -151,6 +145,7 @@ if (NOT_SUBPROJECT) docs/ DESTINATION "${CMAKE_INSTALL_DOCDIR}" + PATTERN "doxygen" EXCLUDE ) endif() diff --git a/packages/Catch2/CMakePresets.json b/packages/Catch2/CMakePresets.json new file mode 100644 index 0000000000000000000000000000000000000000..00f3a6d3afb1a29761a4f1034af68c5ad60be316 --- /dev/null +++ b/packages/Catch2/CMakePresets.json @@ -0,0 +1,25 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "basic-tests", + "displayName": "Basic development build", + "description": "Enables development build with basic tests that are cheap to build and run", + "cacheVariables": { + "CATCH_DEVELOPMENT_BUILD": "ON" + } + }, + { + "name": "all-tests", + "inherits": "basic-tests", + "displayName": "Full development build", + "description": "Enables development build with examples and ALL tests", + "cacheVariables": { + "CATCH_BUILD_EXAMPLES": "ON", + "CATCH_BUILD_EXTRA_TESTS": "ON", + "CATCH_BUILD_SURROGATES": "ON", + "CATCH_ENABLE_CONFIGURE_TESTS": "ON" + } + } + ] +} diff --git a/packages/Catch2/README.md b/packages/Catch2/README.md index 31be055dbc6da5655c73eda39654f7918f1a9ccb..83fdf7b31a13bb12694c3a22b54b57dec7c1eb0a 100644 --- a/packages/Catch2/README.md +++ b/packages/Catch2/README.md @@ -7,10 +7,21 @@ [](https://github.com/catchorg/Catch2/actions/workflows/mac-builds.yml) [](https://ci.appveyor.com/project/catchorg/catch2) [](https://codecov.io/gh/catchorg/Catch2) -[](https://godbolt.org/z/9x9qoM) +[](https://godbolt.org/z/EdoY15q9G) [](https://discord.gg/4CWS9zD) +## 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. + + ## Catch2 v3 is being developed! You are on the `devel` branch, where the next major version, v3, of @@ -26,17 +37,6 @@ 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: @@ -47,5 +47,6 @@ This documentation comprises these three parts: ## 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) +* For discussion or questions please use [our Discord](https://discord.gg/4CWS9zD) +* See who else is using Catch2 in [Open Source Software](docs/opensource-users.md#top) +or [commercially](docs/commercial-users.md#top). diff --git a/packages/Catch2/SECURITY.md b/packages/Catch2/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..b66bf73160421dfe147d7df97bdf89baaca71877 --- /dev/null +++ b/packages/Catch2/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +* Versions 1.x (branch Catch1.x) are no longer supported. +* Versions 2.x (branch v2.x) are currently supported. +* `devel` branch serves for stable-ish development and is supported, + but branches `devel-*` are considered short lived and are not supported separately. + + +## Reporting a Vulnerability + +Due to its nature as a _unit_ test framework, Catch2 shouldn't interact +with untrusted inputs and there shouldn't be many security vulnerabilities +in it. + +However, if you find one you send email to martin <dot> horenovsky <at> +gmail <dot> com. If you want to encrypt the email, my pgp key is +`E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`. diff --git a/packages/Catch2/WORKSPACE b/packages/Catch2/WORKSPACE index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2f265da0a095573e5ce933ea5c44483506ee5acb 100644 --- a/packages/Catch2/WORKSPACE +++ b/packages/Catch2/WORKSPACE @@ -0,0 +1,14 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "bazel_skylib", + strip_prefix = "bazel-skylib-2a87d4a62af886fb320883aba102255aba87275e", + urls = [ + "https://github.com/bazelbuild/bazel-skylib/archive/2a87d4a62af886fb320883aba102255aba87275e.tar.gz", + ], + sha256 = "d847b08d6702d2779e9eb399b54ff8920fa7521dc45e3e53572d1d8907767de7", +) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() \ No newline at end of file diff --git a/packages/Catch2/appveyor.yml b/packages/Catch2/appveyor.yml index d84d775c934258326aa2c2d74fcb569cd8b1d07d..a8f77df09a4ad9fdbcaeb8bf35db531351eb6795 100644 --- a/packages/Catch2/appveyor.yml +++ b/packages/Catch2/appveyor.yml @@ -51,9 +51,10 @@ test_script: # build explicitly. environment: matrix: - - FLAVOR: VS 2019 x64 Debug Surrogates + - FLAVOR: VS 2019 x64 Debug Surrogates Configure Tests APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 surrogates: 1 + configure_tests: 1 platform: x64 configuration: Debug diff --git a/packages/Catch2/conanfile.py b/packages/Catch2/conanfile.py index 7c597d49a37bbd78648426df387f6ae1366051a6..7aa27ef599406dfa6417b9904cd54247618d8a8a 100644 --- a/packages/Catch2/conanfile.py +++ b/packages/Catch2/conanfile.py @@ -20,7 +20,7 @@ class CatchConan(ConanFile): cmake = CMake(self) cmake.definitions["BUILD_TESTING"] = "OFF" cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF" - cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON" + cmake.definitions["CATCH_INSTALL_EXTRAS"] = "ON" cmake.configure(build_folder="build") return cmake @@ -42,16 +42,19 @@ conan_basic_setup()'''.format(line_to_replace, self.install_folder.replace("\\", cmake.install() def package_info(self): + lib_suffix = "d" if self.settings.build_type == "Debug" else "" + 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"] + self.cpp_info.components["catch2base"].libs = ["Catch2" + lib_suffix] + self.cpp_info.components["catch2base"].builddirs.append("lib/cmake/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"].libs = ["Catch2Main" + lib_suffix] self.cpp_info.components["catch2main"].requires = ["catch2base"] diff --git a/packages/Catch2/docs/Readme.md b/packages/Catch2/docs/Readme.md index 262edb5cf48eae5e06c9e69d35932ec8a404c2cc..1e59cf97ab32c2d81b66d4ee6b554f1cc6de2c81 100644 --- a/packages/Catch2/docs/Readme.md +++ b/packages/Catch2/docs/Readme.md @@ -25,10 +25,10 @@ Running: * [Command line](command-line.md#top) Odds and ends: +* [Frequently Asked Questions (FAQ)](faq.md#top) +* [Best practices and other tips](usage-tips.md#top) * [CMake integration](cmake-integration.md#top) * [CI and other miscellaneous pieces](ci-and-misc.md#top) - -FAQ: * [Known limitations](limitations.md#top) Other: diff --git a/packages/Catch2/docs/benchmarks.md b/packages/Catch2/docs/benchmarks.md index 101539ddc5c82fcbec30ebe1ab7f91b3b6913f91..548913c76fb24653a51556ebba67d37d076a93c7 100644 --- a/packages/Catch2/docs/benchmarks.md +++ b/packages/Catch2/docs/benchmarks.md @@ -11,7 +11,8 @@ 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. +- *Run*: one run is one execution of the user code. Sometimes also referred + to as an _iteration_. - *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 diff --git a/packages/Catch2/docs/ci-and-misc.md b/packages/Catch2/docs/ci-and-misc.md index 0d016618cf8bf978c7e85c07c2f0d727833517f1..ef9dff24cafacc3109d1dd948377512e67729746 100644 --- a/packages/Catch2/docs/ci-and-misc.md +++ b/packages/Catch2/docs/ci-and-misc.md @@ -1,12 +1,6 @@ <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. @@ -34,19 +28,6 @@ The advantage of this format is that the JUnit Ant schema is widely understood b 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``` @@ -69,18 +50,8 @@ Because of the incremental nature of Catch's test suites and ability to run spec ```-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 +## Low-level tools ### CodeCoverage module (GCOV, LCOV...) diff --git a/packages/Catch2/docs/cmake-integration.md b/packages/Catch2/docs/cmake-integration.md index d8d08495e1bf27c69b2cc09a1e46fd69540f6c72..dc3efc9d9f4c578476d33fe54b20b6564eaddc54 100644 --- a/packages/Catch2/docs/cmake-integration.md +++ b/packages/Catch2/docs/cmake-integration.md @@ -5,6 +5,7 @@ [CMake targets](#cmake-targets)<br> [Automatic test registration](#automatic-test-registration)<br> [CMake project options](#cmake-project-options)<br> +[`CATCH_CONFIG_*` customization options in CMake](#catch_config_-customization-options-in-cmake)<br> [Installing Catch2 from git repository](#installing-catch2-from-git-repository)<br> [Installing Catch2 from vcpkg](#installing-catch2-from-vcpkg)<br> @@ -50,7 +51,7 @@ Include(FetchContent) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview3 + GIT_TAG v3.0.1 # or a later release ) FetchContent_MakeAvailable(Catch2) @@ -62,17 +63,19 @@ target_link_libraries(tests PRIVATE Catch2::Catch2WithMain) ## Automatic test registration -Catch2's repository also contains two CMake scripts that help users +Catch2's repository also contains three 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` (deprecated) +3) `CatchShardTests.cmake` (and its dependency `CatchShardTestsImpl.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. +<a id="catch_discover_tests"></a> ### `Catch.cmake` and `CatchAddTests.cmake` `Catch.cmake` provides function `catch_discover_tests` to get tests from @@ -256,6 +259,49 @@ unset(OptionalCatchTestLauncher) ParseAndAddCatchTests(bar) ``` + +### `CatchShardTests.cmake` + +> `CatchShardTests.cmake` was introduced in Catch2 3.1.0. + +`CatchShardTests.cmake` provides a function +`catch_add_sharded_tests(TEST_BINARY)` that splits tests from `TEST_BINARY` +into multiple shards. The tests in each shard and their order is randomized, +and the seed changes every invocation of CTest. + +Currently there are 3 customization points for this script: + + * SHARD_COUNT - number of shards to split target's tests into + * REPORTER - reporter spec to use for tests + * TEST_SPEC - test spec used for filtering tests + +Example usage: + +``` +include(CatchShardTests) + +catch_add_sharded_tests(foo-tests + SHARD_COUNT 4 + REPORTER "xml::out=-" + TEST_SPEC "A" +) + +catch_add_sharded_tests(tests + SHARD_COUNT 8 + REPORTER "xml::out=-" + TEST_SPEC "B" +) +``` + +This registers total of 12 CTest tests (4 + 8 shards) to run shards +from `foo-tests` test binary, filtered by a test spec. + +_Note that this script is currently a proof-of-concept for reseeding +shards per CTest run, and thus does not support (nor does it currently +aim to support) all customization points from +[`catch_discover_tests`](#catch_discover_tests)._ + + ## CMake project options Catch2's CMake project also provides some options for other projects @@ -265,8 +311,9 @@ that consume it. These are: Catch2's test binary will be built. Defaults to `ON`. * `CATCH_INSTALL_DOCS` -- When `ON`, Catch2's documentation will be included in the installation. Defaults to `ON`. -* `CATCH_INSTALL_HELPERS` -- When `ON`, Catch2's extras folder will be -included in the installation. Defaults to `ON`. +* `CATCH_INSTALL_EXTRAS` -- When `ON`, Catch2's extras folder (the CMake +scripts mentioned above, debugger helpers) will be included in the +installation. Defaults to `ON`. * `CATCH_DEVELOPMENT_BUILD` -- When `ON`, configures the build for development of Catch2. This means enabling test projects, warnings and so on. Defaults to `OFF`. @@ -292,6 +339,31 @@ compiled separately to ensure that they are self-sufficient. Defaults to `OFF`. +## `CATCH_CONFIG_*` customization options in CMake + +> CMake support for `CATCH_CONFIG_*` options was introduced in Catch2 3.0.1 + +Due to the new separate compilation model, all the options from the +[Compile-time configuration docs](configuration.md#top) can also be set +through Catch2's CMake. To set them, define the option you want as `ON`, +e.g. `-DCATCH_CONFIG_NOSTDOUT=ON`. + +Note that setting the option to `OFF` doesn't disable it. To force disable +an option, you need to set the `_NO_` form of it to `ON`, e.g. +`-DCATCH_CONFIG_NO_COLOUR_WIN32=ON`. + + +To summarize the configuration option behaviour with an example: + +| `-DCATCH_CONFIG_COLOUR_WIN32` | `-DCATCH_CONFIG_NO_COLOUR_WIN32` | Result | +|-------------------------------|----------------------------------|-------------| +| `ON` | `ON` | error | +| `ON` | `OFF` | force-on | +| `OFF` | `ON` | force-off | +| `OFF` | `OFF` | auto-detect | + + + ## Installing Catch2 from git repository If you cannot install Catch2 from a package manager (e.g. Ubuntu 16.04 diff --git a/packages/Catch2/docs/command-line.md b/packages/Catch2/docs/command-line.md index 14511db98105b9bda5c89ba74fec365c5a5f8fa6..218e2f596e4ec89c68fbeaee9f93d5d22f0b6584 100644 --- a/packages/Catch2/docs/command-line.md +++ b/packages/Catch2/docs/command-line.md @@ -15,11 +15,11 @@ [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> +[Skip all benchmarks](#skip-all-benchmarks)<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> @@ -29,14 +29,15 @@ [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> +[Test Sharding](#test-sharding)<br> +[Allow running the binary without tests](#allow-running-the-binary-without-tests)<br> +[Output verbosity](#output-verbosity)<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 /> @@ -55,18 +56,25 @@ Click one of the following links to take you straight to that option - or scroll </br> -<a href="#list-test-names-only"> ` --list-test-names-only`</a><br /> +<a href="#listing-available-tests-tags-or-reporters"> ` --list-tests`</a><br /> +<a href="#listing-available-tests-tags-or-reporters"> ` --list-tags`</a><br /> <a href="#listing-available-tests-tags-or-reporters"> ` --list-reporters`</a><br /> +<a href="#listing-available-tests-tags-or-reporters"> ` --list-listeners`</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="#skip-benchmarks"> ` --skip-benchmarks`</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 /> +<a href="#colour-mode"> ` --colour-mode`</a><br /> +<a href="#test-sharding"> ` --shard-count`</a><br /> +<a href="#test-sharding"> ` --shard-index`</a><br /> +<a href=#no-tests-override> ` --allow-running-no-tests`</a><br /> +<a href=#output-verbosity> ` --verbosity`</a><br /> </br> @@ -118,18 +126,48 @@ Test names containing special characters, such as `,` or `[` can specify them on <a id="choosing-a-reporter-to-use"></a> ## Choosing a reporter to use -<pre>-r, --reporter <reporter></pre> +<pre>-r, --reporter <reporter[::key=value]*></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: +Reporters are how the output from Catch2 (results of assertions, tests, +benchmarks and so on) is formatted and written out. The default reporter +is called the "Console" reporter and is intended to provide relatively +verbose and human-friendly output. -<pre>-r console --r compact --r xml --r junit -</pre> +Reporters are also individually configurable. To pass configuration options +to the reporter, you append `::key=value` to the reporter specification +as many times as you want, e.g. `--reporter xml::out=someFile.xml`. + +The keys must either be prefixed by "X", in which case they are not parsed +by Catch2 and are only passed down to the reporter, or one of options +hardcoded into Catch2. Currently there are only 2, +["out"](#sending-output-to-a-file), and ["colour-mode"](#colour-mode). + +_Note that the reporter might still check the X-prefixed options for +validity, and throw an error if they are wrong._ + +> Support for passing arguments to reporters through the `-r`, `--reporter` flag was introduced in Catch2 3.0.1 + +There are multiple built-in reporters, you can see what they do by using the +[`--list-reporter`](command-line.md#listing-available-tests-tags-or-reporters) +flag. If you need a reporter providing custom format outside of the already +provided ones, look at the ["write your own reporter" part of the reporter +documentation](reporters.md#writing-your-own-reporter). + +This option may be passed multiple times to use multiple (different) +reporters at the same time. See the [reporter documentation](reporters.md#multiple-reporters) +for details on what the resulting behaviour is. Also note that at most one +reporter can be provided without the output-file part of reporter spec. +This reporter will use the "default" output destination, based on +the [`-o`, `--out`](#sending-output-to-a-file) option. + +> Support for using multiple different reporters at the same time was [introduced](https://github.com/catchorg/Catch2/pull/2183) in Catch2 3.0.1 + + +_Note: There is currently no way to escape `::` in the reporter spec, +and thus the reporter names, or configuration keys and values, cannot +contain `::`. As `::` in paths is relatively obscure (unlike ':'), we do +not consider this an issue._ -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 @@ -159,24 +197,62 @@ Sometimes this results in a flood of failure messages and you'd rather just see <a id="listing-available-tests-tags-or-reporters"></a> ## Listing available tests, tags or reporters -<pre>-l, --list-tests --t, --list-tags +``` +--list-tests +--list-tags --list-reporters -</pre> +--list-listeners +``` + +> The `--list*` options became customizable through reporters in Catch2 3.0.1 + +> The `--list-listeners` option was added in Catch2 3.0.1 -```-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. +`--list-tests` lists all registered tests matching specified test spec. +Usually this listing also includes tags, and potentially also other +information, like source location, based on verbosity and reporter's design. -```-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-tags` lists all tags from registered tests matching specified test +spec. Usually this also includes number of tests cases they match and +similar information. -```--list-reporters``` lists the available reporters. +`--list-reporters` lists all available reporters and their descriptions. + +`--list-listeners` lists all registered listeners and their descriptions. + +The [`--verbosity` argument](#output-verbosity) modifies the level of detail provided by the default `--list*` options +as follows: + +| Option | `normal` (default) | `quiet` | `high` | +|--------------------|---------------------------------|---------------------|-----------------------------------------| +| `--list-tests` | Test names and tags | Test names only | Same as `normal`, plus source code line | +| `--list-tags` | Tags and counts | Same as `normal` | Same as `normal` | +| `--list-reporters` | Reporter names and descriptions | Reporter names only | Same as `normal` | +| `--list-listeners` | Listener names and descriptions | Same as `normal` | Same as `normal` | <a id="sending-output-to-a-file"></a> ## Sending output to a file -<pre>-o, --out <filename> +<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). +Use this option to send all output to a file, instead of stdout. You can +use `-` as the filename to explicitly send the output to stdout (this is +useful e.g. when using multiple reporters). + +> Support for `-` as the filename was introduced in Catch2 3.0.1 + +Filenames starting with "%" (percent symbol) are reserved by Catch2 for +meta purposes, e.g. using `%debug` as the filename opens stream that +writes to platform specific debugging/logging mechanism. + +Catch2 currently recognizes 3 meta streams: + +* `%debug` - writes to platform specific debugging/logging output +* `%stdout` - writes to stdout +* `%stderr` - writes to stderr + +> Support for `%stdout` and `%stderr` was introduced in Catch2 3.0.1 + <a id="naming-a-test-run"></a> ## Naming a test run @@ -207,16 +283,24 @@ This option transforms tabs and newline characters into ```\t``` and ```\n``` re ## Warnings <pre>-w, --warn <warning name></pre> -Enables reporting of suspicious test states. There are currently two -available warnings +You can think of Catch2's warnings as the equivalent of `-Werror` (`/WX`) +flag for C++ compilers. It turns some suspicious occurences, like a section +without assertions, into errors. Because these might be intended, warnings +are not enabled by default, but user can opt in. + +You can enable multiple warnings at the same time. + +There are currently two warnings implemented: ``` - 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 + NoAssertions // Fail test case / leaf section if no assertions + // (e.g. `REQUIRE`) is encountered. + UnmatchedTestSpec // Fail test run if any of the CLI test specs did + // not match any tests. ``` +> `UnmatchedTestSpec` was introduced in Catch2 3.0.1. + <a id="reporting-timings"></a> ## Reporting timings @@ -238,15 +322,13 @@ are. ## 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. +Provide the name of a file that contains a list of test case names, +one per line. Blank lines are skipped. -<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 useful way to generate an initial instance of this file is to combine +the [`--list-tests`](#listing-available-tests-tags-or-reporters) flag with +the [`--verbosity quiet`](#output-verbosity) option. You can also +use test specs to filter this list down to what you want first. <a id="order"></a> @@ -267,23 +349,36 @@ 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 +Randomly ordered. 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 +Since the random order was made subset stable, we promise that given +the same random seed, the order of test cases will be the same across +different platforms, as long as the tests were compiled against identical +version of Catch2. We reserve the right to change the relative order +of tests cases between Catch2 versions, but it is unlikely to happen often. + <a id="rng-seed"></a> ## Specify a seed for the Random Number Generator -<pre>--rng-seed <'time'|number></pre> +<pre>--rng-seed <'time'|'random-device'|number></pre> + +Sets the seed for random number generators used by Catch2. These are used +e.g. to shuffle tests when user asks for tests to be in random order. + +Using `time` as the argument asks Catch2 generate the seed through call +to `std::time(nullptr)`. This provides very weak randomness and multiple +runs of the binary can generate the same seed if they are started close +to each other. -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. +Using `random-device` asks for `std::random_device` to be used instead. +If your implementation provides working `std::random_device`, it should +be preferred to using `time`. Catch2 uses `std::random_device` by default. -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 @@ -298,6 +393,16 @@ See [The LibIdentify repo for more information and examples](https://github.com/ 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="skip-benchmarks"></a> +## Skip all benchmarks +<pre>--skip-benchmarks</pre> + +> [Introduced](https://github.com/catchorg/Catch2/issues/2408) in Catch2 3.0.1. + +This flag tells Catch2 to skip running all benchmarks. Benchmarks in this +case mean code blocks in `BENCHMARK` and `BENCHMARK_ADVANCED` macros, not +test cases with the `[!benchmark]` tag. + <a id="benchmark-samples"></a> ## Specify the number of benchmark samples to collect <pre>--benchmark-samples <# of samples></pre> @@ -394,7 +499,7 @@ 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 +- 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). @@ -402,21 +507,77 @@ start of the first section.</br> ## 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 +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> +<a id="colour-mode"></a> ## Override output colouring -<pre>--use-colour <yes|no|auto></pre> +<pre>--colour-mode <ansi|win32|none|default></pre> + +> The `--colour-mode` option replaced the old `--colour` option in Catch2 3.0.1 + + +Catch2 support two different ways of colouring terminal output, and by +default it attempts to make a good guess on which implementation to use +(and whether to even use it, e.g. Catch2 tries to avoid writing colour +codes when writing the results into a file). + +`--colour-mode` allows the user to explicitly select what happens. + +* `--colour-mode ansi` tells Catch2 to always use ANSI colour codes, even +when writing to a file +* `--colour-mode win32` tells Catch2 to use colour implementation based + on Win32 terminal API +* `--colour-mode none` tells Catch2 to disable colours completely +* `--colour-mode default` lets Catch2 decide + +`--colour-mode default` is the default setting. + + +<a id="test-sharding"></a> +## Test Sharding +<pre>--shard-count <#number of shards>, --shard-index <#shard index to run></pre> + +> [Introduced](https://github.com/catchorg/Catch2/pull/2257) in Catch2 3.0.1. + +When `--shard-count <#number of shards>` is used, the tests to execute +will be split evenly in to the given number of sets, identified by indices +starting at 0. The tests in the set given by +`--shard-index <#shard index to run>` will be executed. The default shard +count is `1`, and the default index to run is `0`. + +_It is an error to specify a shard index greater than the number of shards._ + +Sharding is useful when you want to split test execution across multiple +processes, as is done with the [Bazel test sharding](https://docs.bazel.build/versions/main/test-encyclopedia.html#test-sharding). + + +<a id="no-tests-override"></a> +## Allow running the binary without tests +<pre>--allow-running-no-tests</pre> + +> Introduced in Catch2 3.0.1. + +By default, Catch2 test binaries return non-0 exit code if no tests were +run, e.g. if the binary was compiled with no tests, or the provided test +spec matched no tests. This flag overrides that, so a test run with no +tests still returns 0. + +## Output verbosity +``` +-v, --verbosity <quiet|normal|high> +``` + +Changing verbosity might change how much details Catch2's reporters output. +However, you should consider changing the verbosity level as a _suggestion_. +Not all reporters support all verbosity levels, e.g. because the reporter's +format cannot meaningfully change. In that case, the verbosity level is +ignored. -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. +Verbosity defaults to _normal_. -`--use-colour yes` forces coloured output, `--use-colour no` disables coloured -output. The default behaviour is `--use-colour auto`. --- diff --git a/packages/Catch2/docs/commercial-users.md b/packages/Catch2/docs/commercial-users.md index ca77b67dbabbf739a5b9c2eff7d01346f521a5a4..bb41e741e7e84f17f0291ddbb85f95488de748c1 100644 --- a/packages/Catch2/docs/commercial-users.md +++ b/packages/Catch2/docs/commercial-users.md @@ -13,6 +13,7 @@ with you sharing this fact. - Locksley.CZ - [Makimo](https://makimo.pl/) - NASA + - [Nexus Software Systems](https://nexwebsites.com) - [UX3D](https://ux3d.io) - [King](https://king.com) diff --git a/packages/Catch2/docs/configuration.md b/packages/Catch2/docs/configuration.md index 51f71bc763cc41ed43ab9c1bec32f8bc5334d3dc..9fd7f58b6d9e964ccf3d26ddb067a5f0889147fe 100644 --- a/packages/Catch2/docs/configuration.md +++ b/packages/Catch2/docs/configuration.md @@ -8,17 +8,19 @@ [stdout](#stdout)<br> [Fallback stringifier](#fallback-stringifier)<br> [Default reporter](#default-reporter)<br> +[Bazel support](#bazel-support)<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. +Catch2 is designed to "just work" as much as possible, and most of the +configuration options below are changed automatically during compilation, +according to the detected environment. However, this detection can also +be overriden by users, using macros documented below, and/or CMake options +with the same name. ## Prefixing Catch macros @@ -30,19 +32,18 @@ To keep test code clean and uncluttered Catch uses short macro names (e.g. ```TE ## 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'. + CATCH_CONFIG_COLOUR_WIN32 // Force enables compiling colouring impl based on Win32 console API + CATCH_CONFIG_NO_COLOUR_WIN32 // Force disables ... -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. +Yes, Catch2 uses the british spelling of colour. -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): +Catch2 attempts to autodetect whether the Win32 console colouring API, +`SetConsoleTextAttribute`, is available, and if it is available it compiles +in a console colouring implementation that uses it. -Note that when ANSI colour codes are used "unistd.h" must be includable - along with a definition of ```isatty()``` +This option can be used to override Catch2's autodetection and force the +compilation either ON or OFF. -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 @@ -96,6 +97,14 @@ This means that defining `CATCH_CONFIG_DEFAULT_REPORTER` to `"console"` is equivalent with the out-of-the-box experience. +## Bazel support +When `CATCH_CONFIG_BAZEL_SUPPORT` is defined or when `BAZEL_TEST=1` (which is set by the Bazel inside of a test environment), +Catch2 will register a `JUnit` reporter writing to a path pointed by `XML_OUTPUT_FILE` provided by Bazel. + +> `CATCH_CONFIG_BAZEL_SUPPORT` was [introduced](https://github.com/catchorg/Catch2/pull/2399) in Catch2 3.0.1. + +> `CATCH_CONFIG_BAZEL_SUPPORT` was [deprecated](https://github.com/catchorg/Catch2/pull/2459) in Catch2 3.1.0. + ## C++11 toggles CATCH_CONFIG_CPP11_TO_STRING // Use `std::to_string` @@ -179,13 +188,6 @@ 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 diff --git a/packages/Catch2/docs/contributing.md b/packages/Catch2/docs/contributing.md index fd45cc44478afe385877b6240bca3d9476d1d87a..addeb5c9a44e7d1ad29e436a4b558d8dd3f3f960 100644 --- a/packages/Catch2/docs/contributing.md +++ b/packages/Catch2/docs/contributing.md @@ -62,18 +62,23 @@ 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". +Catch2 is slowly gaining more and more types of tests, currently Catch2 +project also has buildable examples, "ExtraTests", and CMake config tests. 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. +passing if they compile. -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. +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. + +Finally, CMake config tests test that you set Catch2's compile-time +configuration options through CMake, using CMake options of the same name. + +None of these tests are enabled by default. To enable them, add +`-DCATCH_BUILD_EXAMPLES=ON`, `-DCATCH_BUILD_EXTRA_TESTS=ON`, and +`-DCATCH_ENABLE_CONFIGURE_TESTS=ON` when configuration the CMake build. Bringing this all together, the steps below should configure, build, and run all tests in the `Debug` compilation. @@ -85,7 +90,7 @@ and run all tests in the `Debug` compilation. ./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 +cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON # 3. Run the actual build cmake --build debug-build @@ -104,6 +109,8 @@ cd Catch2 ./tools/scripts/buildAndTest.sh ``` +A Windows version of the script is available at `tools\scripts\buildAndTest.cmd`. + 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 @@ -129,6 +136,8 @@ should use. It provides you with the top anchor mentioned to link to <a id="top"></a> # Cool feature +> [Introduced](https://github.com/catchorg/Catch2/pull/123456) in Catch2 X.Y.Z + Text that explains how to use the cool feature. @@ -289,9 +298,9 @@ Specifically, every source file should start with the licence header: ``` 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. +This means that for file `catch_matchers_foo.hpp`, the include guard should +be `CATCH_MATCHERS_FOO_HPP_INCLUDED`, for `catch_generators_bar.hpp`, the include +guard should be `CATCH_GENERATORS_BAR_HPP_INCLUDED`, and so on. ## CoC diff --git a/packages/Catch2/docs/deprecations.md b/packages/Catch2/docs/deprecations.md index e56b197a298f07d11a4eb8e2d201e057130c47b1..2c9bf5517bb342188c62c3909239acc8c45c7f7b 100644 --- a/packages/Catch2/docs/deprecations.md +++ b/packages/Catch2/docs/deprecations.md @@ -17,13 +17,14 @@ as it can be replaced by `Catch.cmake` that provides the function command line interface instead of parsing C++ code with regular expressions. -## Planned changes - -### 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. - +### `CATCH_CONFIG_BAZEL_SUPPORT` + +Catch2 supports writing the Bazel JUnit XML output file when it is aware +that is within a bazel testing environment. Originally there was no way +to accurately probe the environment for this information so the flag +`CATCH_CONFIG_BAZEL_SUPPORT` was added. This now deprecated. Bazel has now had a change +where it will export `BAZEL_TEST=1` for purposes like the above. Catch2 +will now instead inspect the environment instead of relying on build configuration. --- diff --git a/packages/Catch2/docs/event-listeners.md b/packages/Catch2/docs/event-listeners.md index 6231100667cbda9a7629d6c9b638f65e9431d2b2..9b706948d1f5adf26ec3efe6072fba2b23a46f9b 100644 --- a/packages/Catch2/docs/event-listeners.md +++ b/packages/Catch2/docs/event-listeners.md @@ -1,74 +1,43 @@ <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 +An event listener is a bit like a reporter, in that it responds to various +reporter events in Catch2, but it is not expected to write any output. +Instead, an event listener performs actions within the test process, such +as performing global initialization (e.g. of a C library), or cleaning out +in-memory logs if they are not needed (the test case passed). + +Unlike reporters, each registered event listener is always active. Event +listeners are always notified before reporter(s). + +To write your own event listener, you should derive from `Catch::TestEventListenerBase`, +as it provides empty stubs for all reporter events, allowing you to +only override events you care for. Afterwards you have to register it +with Catch2 using `CATCH_REGISTER_LISTENER` macro, so that Catch2 knows +about it and instantiates it before running tests. + +Example event listener: +```cpp +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +class testRunListener : public Catch::EventListenerBase { +public: + using Catch::EventListenerBase::EventListenerBase; + + void testRunStarting(Catch::TestRunInfo const&) override { + lib_foo_init(); } }; -CATCH_REGISTER_LISTENER( MyListener ) + +CATCH_REGISTER_LISTENER(testRunListener) ``` _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 ); -``` +[You can find the list of events that the listeners can react to on its +own page](reporter-events.md#top). -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. --- diff --git a/packages/Catch2/docs/faq.md b/packages/Catch2/docs/faq.md new file mode 100644 index 0000000000000000000000000000000000000000..81d8be680fa2af90df03b6a20abda6ca72106ed3 --- /dev/null +++ b/packages/Catch2/docs/faq.md @@ -0,0 +1,63 @@ +<a id="top"></a> +# Frequently Asked Questions (FAQ) + +**Contents**<br> +[How do I run global setup/teardown only if tests will be run?](#how-do-i-run-global-setupteardown-only-if-tests-will-be-run)<br> +[How do I clean up global state between running different tests?](#how-do-i-clean-up-global-state-between-running-different-tests)<br> +[Why cannot I derive from the built-in reporters?](#why-cannot-i-derive-from-the-built-in-reporters)<br> +[What is Catch2's ABI stability policy?](#what-is-catch2s-abi-stability-policy)<br> +[What is Catch2's API stability policy?](#what-is-catch2s-api-stability-policy)<br> +[Does Catch2 support running tests in parallel?](#does-catch2-support-running-tests-in-parallel)<br> + +## How do I run global setup/teardown only if tests will be run? + +Write a custom [event listener](event-listeners.md#top) and place the +global setup/teardown code into the `testRun*` events. + + +## How do I clean up global state between running different tests? + +Write a custom [event listener](event-listeners.md#top) and place the +cleanup code into either `testCase*` or `testCasePartial*` events, +depending on how often the cleanup needs to happen. + + +## Why cannot I derive from the built-in reporters? + +They are not made to be overriden, in that we do not attempt to maintain +a consistent internal state if a member function is overriden, and by +forbidding users from using them as a base class, we can refactor them +as needed later. + + +## What is Catch2's ABI stability policy? + +Catch2 provides no ABI stability guarantees whatsoever. Catch2 provides +rich C++ interface, and trying to freeze its ABI would take a lot of +pointless work. + +Catch2 is not designed to be distributed as dynamic library, and you +should really be able to compile everything with the same compiler binary. + + +## What is Catch2's API stability policy? + +Catch2 follows [semver](https://semver.org/) to the best of our ability. +This means that we will not knowingly make backwards-incompatible changes +without incrementing the major version number. + + +## Does Catch2 support running tests in parallel? + +Not natively, no. We see running tests in parallel as the job of an +external test runner, that can also run them in separate processes, +support test execution timeouts and so on. + +However, Catch2 provides some tools that make the job of external test +runners easier. [See the relevant section in our page on best +practices](usage-tips.md#parallel-tests). + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/generators.md b/packages/Catch2/docs/generators.md index b8164f829fcb1b6b5930b5697fc215a89f26e56a..7a865d4364a7c39340086edae8064c54a0dac842 100644 --- a/packages/Catch2/docs/generators.md +++ b/packages/Catch2/docs/generators.md @@ -114,7 +114,7 @@ a test case, * 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 + * `RangeGenerator<T>(first, last)` -- generates all values inside a `[first, last)` arithmetic range * `IteratorGenerator<T>` -- copies and returns values from an iterator range > `ChunkGenerator<T>`, `RandomIntegerGenerator<Integral>`, `RandomFloatGenerator<Float>` and `RangeGenerator<T>` were introduced in Catch2 2.7.0. diff --git a/packages/Catch2/docs/limitations.md b/packages/Catch2/docs/limitations.md index 65483b87bbd0873f7e07e79f39de08e5a55e190f..55c54738a6d66a3b621957886949732fbe9cc923 100644 --- a/packages/Catch2/docs/limitations.md +++ b/packages/Catch2/docs/limitations.md @@ -94,39 +94,57 @@ 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. +Catch2 keeps test execution in one process strictly serial, and there +are no plans to change this. If you find yourself with a test suite +that takes too long to run and yo uwant to make it parallel, you have +to run multiple processes side by side. + +There are 2 basic ways to do that, +* you can split your tests into multiple binaries, and run those binaries + in parallel +* you can run the same test binary multiple times, but run a different + subset of the tests in each process + +There are multiple ways to achieve the latter, the easiest way is to use +[test sharding](command-line.md#test-sharding). + ## 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: + +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 directive is applied to it). This snippet is sufficient +to trigger the compilation error: + ```cpp -#define CATCH_CONFIG_MAIN -#include "catch.hpp" +#include <catch2/catch_test_macros.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`: +Catch2 provides a workaround, by letting the user disable stringification +of the original expression by defining `CATCH_CONFIG_DISABLE_STRINGIFICATION`, +like so: ```cpp -#define CATCH_CONFIG_FAST_COMPILE #define CATCH_CONFIG_DISABLE_STRINGIFICATION -#include "catch.hpp" +#include <catch2/catch_test_macros.hpp> TEST_CASE("test") { CHECK(std::string(R"("\)") == "\"\\"); } ``` -_Do note that this changes the output somewhat_ +_Do note that this changes the output:_ ``` catchwork\test1.cpp(6): PASSED: @@ -135,26 +153,11 @@ 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> +#include <catch2/catch_test_macros.hpp> TEST_CASE("a") { CHECK_THROWS(throw 3); @@ -170,11 +173,6 @@ TEST_CASE("b") { 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 diff --git a/packages/Catch2/docs/list-of-examples.md b/packages/Catch2/docs/list-of-examples.md index 642d4d23783155159cb411cc7dc78c50f4c5801d..a919408adf7958cecd08fa4160e36d3e90d45174 100644 --- a/packages/Catch2/docs/list-of-examples.md +++ b/packages/Catch2/docs/list-of-examples.md @@ -3,7 +3,6 @@ ## 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) diff --git a/packages/Catch2/docs/matchers.md b/packages/Catch2/docs/matchers.md index 6fdb15bfa0c64c840fa640f95c915a8df7688b2b..0060bfd172307af534a7389eb684bffd3118d654 100644 --- a/packages/Catch2/docs/matchers.md +++ b/packages/Catch2/docs/matchers.md @@ -35,10 +35,10 @@ operators, that is `&&`, `||`, and `!`, like so: ```cpp using Catch::Matchers::EndsWith; -using Catch::Matchers::Contains; +using Catch::Matchers::ContainsSubstring; REQUIRE_THAT( getSomeString(), - EndsWith("as a service") && Contains("web scale")); + EndsWith("as a service") && ContainsSubstring("web scale")); ``` The example above asserts that the string returned from `getSomeString` @@ -64,7 +64,7 @@ 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" ) ); + (Catch::Matchers::StartsWith( "Big data" ) && !Catch::Matchers::ContainsSubstring( "web scale" ) ); REQUIRE_THAT(str, match_expression); } ``` @@ -88,7 +88,7 @@ Out of the box, Catch2 provides the following 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)`, +* `ContainsSubstring(std::string str, CaseSensitive)`, * `Equals(std::string str, CaseSensitive)`, and * `Matches(std::string str, CaseSensitive)`. @@ -248,7 +248,7 @@ Note that `DerivedException` in the example above has to derive from ### Generic range Matchers -> Generic range matchers were introduced in Catch2 X.Y.Z +> Generic range matchers were introduced in Catch2 3.0.1 Catch2 also provides some matchers that use the new style matchers definitions to handle generic range-like types. These are: @@ -258,6 +258,12 @@ definitions to handle generic range-like types. These are: * `SizeIs(Matcher size_matcher)` * `Contains(T&& target_element, Comparator = std::equal_to<>{})` * `Contains(Matcher element_matcher)` +* `AllMatch(Matcher element_matcher)` +* `NoneMatch(Matcher element_matcher)` +* `AnyMatch(Matcher element_matcher)` +* `AllTrue()` +* `NoneTrue()` +* `AnyTrue()` `IsEmpty` should be self-explanatory. It successfully matches objects that are empty according to either `std::empty`, or ADL-found `empty` @@ -275,6 +281,14 @@ 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. +`AllMatch`, `NoneMatch`, and `AnyMatch` match ranges for which either +all, none, or any of the contained elements matches the given matcher, +respectively. + +`AllTrue`, `NoneTrue`, and `AnyTrue` match ranges for which either +all, none, or any of the contained elements are `true`, respectively. +It works for ranges of `bool`s and ranges of elements (explicitly) +convertible to `bool`. ## Writing custom matchers (old style) @@ -350,7 +364,7 @@ style matchers arbitrarily. ## Writing custom matchers (new style) -> New style matchers were introduced in Catch2 X.Y.Z +> New style matchers were introduced in Catch2 3.0.1 To create a new-style matcher, you have to create your own type that derives from `Catch::Matchers::MatcherGenericBase`. Your type has to diff --git a/packages/Catch2/docs/migrate-v2-to-v3.md b/packages/Catch2/docs/migrate-v2-to-v3.md index 41c4d470e546d86ae3ef7af1a6c7f60e8e71d999..a9c2bb6300cf8e3525f5a5c4bece2642c3c715eb 100644 --- a/packages/Catch2/docs/migrate-v2-to-v3.md +++ b/packages/Catch2/docs/migrate-v2-to-v3.md @@ -50,7 +50,8 @@ 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.) +the `Catch2` target.). If you use pkg-config, change `pkg-config catch2` to +`pkg-config catch2-with-main`. 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>` @@ -64,7 +65,9 @@ to piecemeal includes. You will likely want to start by including [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>`, @@ -72,11 +75,21 @@ 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. + +* The namespaces of Matchers were flattened and cleaned up. + +Matchers are no longer declared deep within an internal namespace and +then brought up into `Catch` namespace. All Matchers now live in the +`Catch::Matchers` namespace. + +* The `Contains` string matcher was renamed to `ContainsSubstring`. + +* The reporter interfaces changed in a breaking manner. + +If you are using a custom reporter or listener, you will likely need to +modify them to conform to the new interfaces. Unlike before in v2, +the [interfaces](reporters.md#top) and the [events](reporter-events.md#top) +are now documented. --- diff --git a/packages/Catch2/docs/opensource-users.md b/packages/Catch2/docs/opensource-users.md index f709aa6e7d27b91a11b27aedba8d6752b6e8482a..c65f71851a01a5b9573eee1b0b1686b9a1372351 100644 --- a/packages/Catch2/docs/opensource-users.md +++ b/packages/Catch2/docs/opensource-users.md @@ -17,6 +17,9 @@ maintainer's explicit consent._ ## Libraries & Frameworks +### [accessorpp](https://github.com/wqking/accessorpp) +C++ library for implementing property and data binding. + ### [alpaka](https://github.com/alpaka-group/alpaka) A header-only C++14 abstraction library for accelerator development. @@ -50,6 +53,9 @@ Header-only C++11 library to encode/decode base64, base64url, base32, base32hex ### [DtCraft](https://github.com/twhuang-uiuc/DtCraft) A High-performance Cluster Computing Engine. +### [eventpp](https://github.com/wqking/eventpp) +C++ event library for callbacks, event dispatcher, and event queue. With eventpp you can easily implement signal and slot mechanism, publisher and subscriber pattern, or observer pattern. + ### [forest](https://github.com/xorz57/forest) Template Library of Tree Data Structures. @@ -77,6 +83,9 @@ 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. +### [OpenALpp](https://github.com/Laguna1989/OpenALpp) +A modern OOP C++14 audio library built on OpenAL for Windows, Linux and web (emscripten). + ### [polymorphic_value](https://github.com/jbcoe/polymorphic_value) A polymorphic value-type for C++. @@ -109,6 +118,9 @@ A high available cloud native micro-service application management platform impl ### [ArangoDB](https://github.com/arangodb/arangodb) ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. +### [Cytopia](https://github.com/CytopiaTeam/Cytopia) +Cytopia is a free, open source retro pixel-art city building game with a big focus on mods. It utilizes a custom isometric rendering engine based on SDL2. + ### [d-SEAMS](https://github.com/d-SEAMS/seams-core) Open source molecular dynamics simulation structure analysis suite of tools in modern C++. diff --git a/packages/Catch2/docs/other-macros.md b/packages/Catch2/docs/other-macros.md index 5e7f0af09f4d6a45a94edc35ba92c33d12aed4d8..24a0fb6e6f4db0299d01b5da1d2a05e913611711 100644 --- a/packages/Catch2/docs/other-macros.md +++ b/packages/Catch2/docs/other-macros.md @@ -15,7 +15,7 @@ stringification machinery to the _expr_ and records the result. As with evaluates to `true`. `CHECKED_ELSE( expr )` work similarly, but the block is entered only if the _expr_ evaluated to `false`. -> `CHECKED_X` macros were changed to not count as failure in Catch2 X.Y.Z. +> `CHECKED_X` macros were changed to not count as failure in Catch2 3.0.1. Example: ```cpp @@ -59,9 +59,9 @@ TEST_CASE( "SUCCEED showcase" ) { } ``` -* `STATIC_REQUIRE` +* `STATIC_REQUIRE` and `STATIC_CHECK` -> [Introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch2 2.4.2. +> `STATIC_REQUIRE` was [introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch2 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 @@ -77,6 +77,20 @@ TEST_CASE("STATIC_REQUIRE showcase", "[traits]") { } ``` +> `STATIC_CHECK` was [introduced](https://github.com/catchorg/Catch2/pull/2318) in Catch2 3.0.1. + +`STATIC_CHECK( expr )` is equivalent to `STATIC_REQUIRE( expr )`, with the +difference that when `CATCH_CONFIG_RUNTIME_STATIC_REQUIRE` is defined, it +becomes equivalent to `CHECK` instead of `REQUIRE`. + +Example: +```cpp +TEST_CASE("STATIC_CHECK showcase", "[traits]") { + STATIC_CHECK( std::is_void<void>::value ); + STATIC_CHECK_FALSE( std::is_void<int>::value ); +} +``` + ## Test case related macros * `METHOD_AS_TEST_CASE` diff --git a/packages/Catch2/docs/own-main.md b/packages/Catch2/docs/own-main.md index 6a9b1aadc7ab31ff3923adbf3ef3daf14d05bdb7..26dfa86da6a6f011a0b6f629d544c348957db478 100644 --- a/packages/Catch2/docs/own-main.md +++ b/packages/Catch2/docs/own-main.md @@ -2,63 +2,69 @@ # 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> +[Let Catch2 take full control of args and config](#let-catch2-take-full-control-of-args-and-config)<br> +[Amending the Catch2 config](#amending-the-catch2-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. +The easiest way to use Catch2 is to use its own `main` function, and let +it handle the command line arguments. This is done by linking against +Catch2Main library, e.g. through the [CMake target](cmake-integration.md#cmake-targets), +or pkg-config files. -This is achieved by writing ```#define CATCH_CONFIG_MAIN``` before the ```#include "catch.hpp"``` in *exactly one* source file. +If you want to provide your own `main`, then you should link against +the static library (target) only, without the main part. You will then +have to write your own `main` and call into Catch2 test runner manually. -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. +Below are some basic recipes on what you can do supplying your own main. -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 +## Let Catch2 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. +This is useful if you just need to have code that executes before/after +Catch2 runs tests. -```c++ -#define CATCH_CONFIG_RUNNER -#include "catch.hpp" +```cpp +#include <catch2/catch_session.hpp> int main( int argc, char* argv[] ) { - // global setup... + // your setup ... int result = Catch::Session().run( argc, argv ); - // global clean-up... + // your clean-up... return result; } ``` -## Amending the config +_Note that if you only want to run some set up before tests are run, it +might be simpler to use [event listeners](event-listeners.md#top) instead._ -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" +## Amending the Catch2 config -int main( int argc, char* argv[] ) -{ +If you want Catch2 to process command line arguments, but also want to +programmatically change the resulting configuration of Catch2 run, +you can do it in two ways: + +```c++ +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 + + // 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 @@ -66,38 +72,32 @@ int main( int argc, char* argv[] ) } ``` -Take a look at the definitions of Config and ConfigData to see what you can do with them. +If you want full control of the configuration, don't call `applyCommandLine`. -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" +You can add new command line options to Catch2, by composing the premade +CLI parser (called Clara), and add your own options. -int main( int argc, char* argv[] ) -{ +```cpp +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 + + // Build a new parser on top of Catch2's + using namespace Catch::Clara; + auto cli + = session.cli() // Get Catch2's 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 + + // Now pass the new composite back to Catch2 so it uses that + session.cli( cli ); + + // Let Catch2 (using Clara) parse the command line int returnCode = session.applyCommandLine( argc, argv ); if( returnCode != 0 ) // Indicates a command line error return returnCode; @@ -110,12 +110,13 @@ int main( int argc, char* argv[] ) } ``` -See the [Clara documentation](https://github.com/philsquared/Clara/blob/master/README.md) for more details. +See the [Clara documentation](https://github.com/catchorg/Clara/blob/master/README.md) +for more details on how to use the Clara parser. ## Version detection -Catch provides a triplet of macros providing the header's version, +Catch2 provides a triplet of macros providing the header's version, * `CATCH_VERSION_MAJOR` * `CATCH_VERSION_MINOR` diff --git a/packages/Catch2/docs/release-notes.md b/packages/Catch2/docs/release-notes.md index 7e0f5a8f90d065d98e7a3ded517642a572795b94..da2c598cebbaa352c1a3bc33804ae66ada3366ca 100644 --- a/packages/Catch2/docs/release-notes.md +++ b/packages/Catch2/docs/release-notes.md @@ -2,7 +2,9 @@ # Release notes **Contents**<br> +[3.1.0](#310)<br> [3.0.1](#301)<br> +[2.13.7](#2137)<br> [2.13.6](#2136)<br> [2.13.5](#2135)<br> [2.13.4](#2134)<br> @@ -48,25 +50,54 @@ [Even Older versions](#even-older-versions)<br> -## 3.0.1 (in progress) +## 3.1.0 + +### Improvements +* Improved suppression of `-Wparentheses` for older GCCs + * Turns out that even GCC 9 does not properly handle `_Pragma`s in the C++ frontend. +* Added type constraints onto `random` generator (#2433) + * These constraints copy what the standard says for the underlying `std::uniform_int_distribution` +* Suppressed -Wunused-variable from nvcc (#2306, #2427) +* Suppressed -Wunused-variable from MinGW (#2132) +* Added All/Any/NoneTrue range matchers (#2319) + * These check that all/any/none of boolean values in a range are true. +* The JUnit reporter now normalizes classnames from C++ namespaces to Java-like namespaces (#2468) + * This provides better support for other JUnit based tools. +* The Bazel support now understands `BAZEL_TEST` environment variable (#2459) + * The `CATCH_CONFIG_BAZEL_SUPPORT` configuration option is also still supported. +* Returned support for compiling Catch2 with GCC 5 (#2448) + * This required removing inherited constructors from Catch2's internals. + * I recommend updating to a newer GCC anyway. +* `catch_discover_tests` now has a new options for setting library load path(s) when running the Catch2 binary (#2467) + + +### Fixes +* Fixed crash when listing listeners without any registered listeners (#2442) +* Fixed nvcc compilation error in constructor benchmarking helper (#2477) +* Catch2's CMakeList supports pre-3.12 CMake again (#2428) + * The gain from requiring CMake 3.12 was very minor, but y'all should really update to newer CMake + + +### Miscellaneous +* Fixed SelfTest build on MinGW (#2447) +* The in-repo conan recipe exports the CMake helper (#2460) +* Added experimental CMake script to showcase using test case sharding together with CTest + * Compared to `catch_discover_tests`, it supports very limited number of options and customization +* Added documentation page on best practices when running Catch2 tests +* Catch2 can be built as a dynamic library (#2397, #2398) + * Note that Catch2 does not have visibility annotations, and you are responsible for ensuring correct visibility built into the resulting library. + + + +## 3.0.1 **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. +You probably want to look into the [migration docs](migrate-v2-to-v3.md#top), +which were written to help people coming from v2.x.x versions to the +v3 releases. ### FAQ @@ -131,6 +162,14 @@ new design. * With the exception of the XmlReporter, the outputs of first party reporters should remain the same * New pair of events were added * One obsolete event was removed + * The base class has been renamed + * The built-in reporter class hierarchy has been redone +* Catch2 generates a random seed if one hasn't been specified by the user +* The short flag for `--list-tests`, `-l`, has been removed. + * This is not a commonly used flag and does not need to use up valuable single-letter space. +* The short flag for `--list-tags`, `-t`, has been removed. + * This is not a commonly used flag and does not need to use up valuable single-letter space. +* The `--colour` option has been replaced with `--colour-mode` option ### Improvements @@ -161,6 +200,39 @@ new design. * `--list-*` flags write their output to file specified by the `-o` flag (#2061, #2163) * `Approx::operator()` is now properly `const` * Catch2's internal helper variables no longer use reserved identifiers (#578) +* `--rng-seed` now accepts string `"random-device"` to generate random seed using `std::random_device` +* Catch2 now supports test sharding (#2257) + * You can ask for the tests to be split into N groups and only run one of them. + * This greatly simplifies parallelization of tests in a binary through external runner. +* The embedded CLI parser now supports repeatedly callable lambdas + * A lambda-based option parser can opt into being repeatedly specifiable. +* Added `STATIC_CHECK` macro, similar to `STATIC_REQUIRE` (#2318) + * When deferred tu runtime, it behaves like `CHECK`, and not like `REQUIRE`. +* You can have multiple tests with the same name, as long as other parts of the test identity differ (#1915, #1999, #2175) + * Test identity includes test's name, test's tags and and test's class name if applicable. +* Added new warning, `UnmatchedTestSpec`, to error on test specs with no matching tests +* The `-w`, `--warn` warning flags can now be provided multiple times to enable multiple warnings +* The case-insensitive handling of tags is now more reliable and takes up less memory +* Test case and assertion counting can no longer reasonably overflow on 32 bit systems + * The count is now kept in `uint64_t` on all platforms, instead of using `size_t` type. +* The `-o`, `--out` output destination specifiers recognize `-` as stdout + * You have to provide it as `--out=-` to avoid CLI error about missing option + * The new reporter specification also recognizes `-` as stdout +* Multiple reporters can now run at the same time and write to different files (#1712, #2183) + * To support this, the `-r`, `--reporter` flag now also accepts optional output destination + * For full overview of the semantics of using multiple reporters, look into the reporter documentation + * To enable the new syntax, reporter names can no longer contain `::`. +* Console colour support has been rewritten and significantly improved + * The colour implementation based on ANSI colour codes is always available + * Colour implementations respect their associated stream + * previously e.g. Win32 impl would change console colour even if Catch2 was writing to a file + * The colour API is resilient against changing evaluation order of expressions + * The associated CLI flag and compile-time configuration options have changed + * For details see the docs for command-line and compile-time Catch2 configuration +* Added a support for Bazel integration with `XML_OUTPUT_FILE` env var (#2399) + * This has to be enabled during compilation. +* Added `--skip-benchmarks` flag to run tests without any `BENCHMARK`s (#2392, #2408) +* Added option to list all listeners in the binary via `--list-listeners` ### Fixes @@ -169,6 +241,12 @@ new design. * Various ways of failing a benchmark are now counted and reporter properly * The ULP matcher now handles comparing numbers with different signs properly (#2152) * Universal ADL-found operators should no longer break decomposition (#2121) +* Reporter selection is properly case-insensitive + * Previously it forced lower cased name, which would fail for reporters with upper case characters in name +* The cumulative reporter base stores benchmark results alongside assertion results +* Catch2's SE handling should no longer interferes with ASan on Windows (#2334) +* Fixed Windows console colour handling for tests that redirect stdout (#2345) +* Fixed issue with the `random` generators returning the same value over and over again ### Other changes @@ -182,9 +260,28 @@ new design. * 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 +* Passing invalid test specifications passed to Catch2 are now reported before tests are run, and are a hard error. +* Running 0 tests (e.g. due to empty binary, or test spec not matching anything) returns non-0 exit code + * Flag `--allow-running-no-tests` overrides this behaviour. + * `NoTests` warning has been removed because it is fully subsumed by this change. +* Catch2's compile-time configuration options (`CATCH_CONFIG_FOO`) can be set through CMake options of the same name + * They use the same semantics as C++ defines, including the `CATCH_CONFIG_NO_FOO` overrides, + * `-DCATCH_CONFIG_DEFAULT_REPORTER=compact` changes default reporter to "compact" + * `-DCATCH_CONFIG_NO_ANDROID_LOGWRITE=ON` forces android logwrite to off + * `-DCATCH_CONFIG_ANDROID_LOGWRITE=OFF` does nothing (the define will not exist) +## 2.13.7 + +### Fixes +* Added missing `<iterator>` include in benchmarking. (#2231) +* Fixed noexcept build with benchmarking enabled (#2235) +* Fixed build for compilers with C++17 support but without C++17 library support (#2195) +* JUnit only uses 3 decimal places when reporting durations (#2221) +* `!mayfail` tagged tests are now marked as `skipped` in JUnit reporter output (#2116) + + ## 2.13.6 ### Fixes diff --git a/packages/Catch2/docs/release-process.md b/packages/Catch2/docs/release-process.md index 1b39b1f263c3ccd12da8788ba75f7a40e15bcfbc..12d23b7d416fbbcfe37a67222b121914b59d3d30 100644 --- a/packages/Catch2/docs/release-process.md +++ b/packages/Catch2/docs/release-process.md @@ -40,14 +40,10 @@ After version number is incremented, single-include header is regenerated and re 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. +We also attach the two amalgamated files as "binaries". -Since 2.5.0, the release tag and the "binaries" (headers) should be PGP -signed. +Since 2.5.0, the release tag and the "binaries" (amalgamated files) should +be PGP signed. #### Signing a tag @@ -57,16 +53,14 @@ 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 +#### Signing the amalgamated files -This will create ASCII-armored signatures for the headers that are -uploaded to the GitHub release: +This will create ASCII-armored signatures for the two amalgamated files +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 --armor --output extras/catch_amalgamated.hpp.asc --detach-sig extras/catch_amalgamated.hpp +gpg --armor --output extras/catch_amalgamated.cpp.asc --detach-sig extras/catch_amalgamated.cpp ``` _GPG does not support signing multiple files in single invocation._ diff --git a/packages/Catch2/docs/reporter-events.md b/packages/Catch2/docs/reporter-events.md new file mode 100644 index 0000000000000000000000000000000000000000..7adae53cab29785d5a61f7fa99c668e0868caa0a --- /dev/null +++ b/packages/Catch2/docs/reporter-events.md @@ -0,0 +1,175 @@ +<a id="top"></a> +# Reporter events + +**Contents**<br> +[Test running events](#test-running-events)<br> +[Benchmarking events](#benchmarking-events)<br> +[Listings events](#listings-events)<br> +[Miscellaneous events](#miscellaneous-events)<br> + +Reporter events are one of the customization points for user code. They +are used by [reporters](reporters.md#top) to customize Catch2's output, +and by [event listeners](event-listeners.md#top) to perform in-process +actions under some conditions. + +There are currently 21 reporter events in Catch2, split between 4 distinct +event groups: +* test running events (10 events) +* benchmarking (4 events) +* listings (3 events) +* miscellaneous (4 events) + +## Test running events + +Test running events are always paired so that for each `fooStarting` event, +there is a `fooEnded` event. This means that the 10 test running events +consist of 5 pairs of events: + +* `testRunStarting` and `testRunEnded`, +* `testCaseStarting` and `testCaseEnded`, +* `testCasePartialStarting` and `testCasePartialEnded`, +* `sectionStarting` and `sectionEnded`, +* `assertionStarting` and `assertionEnded` + +### `testRun` events + +```cpp +void testRunStarting( TestRunInfo const& testRunInfo ); +void testRunEnded( TestRunStats const& testRunStats ); +``` + +The `testRun` events bookend the entire test run. `testRunStarting` is +emitted before the first test case is executed, and `testRunEnded` is +emitted after all the test cases have been executed. + +### `testCase` events + +```cpp +void testCaseStarting( TestCaseInfo const& testInfo ); +void testCaseEnded( TestCaseStats const& testCaseStats ); +``` + +The `testCase` events bookend one _full_ run of a specific test case. +Individual runs through a test case, e.g. due to `SECTION`s or `GENERATE`s, +are handled by a different event. + + +### `testCasePartial` events + +> Introduced in Catch2 3.0.1 + +```cpp +void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ); +void testCasePartialEnded(TestCaseStats const& testCaseStats, uint64_t partNumber ); +``` + +`testCasePartial` events bookend one _partial_ run of a specific test case. +This means that for any given test case, these events can be emitted +multiple times, e.g. due to multiple leaf sections. + +In regards to nesting with `testCase` events, `testCasePartialStarting` +will never be emitted before the corresponding `testCaseStarting`, and +`testCasePartialEnded` will always be emitted before the corresponding +`testCaseEnded`. + + +### `section` events + +```cpp +void sectionStarting( SectionInfo const& sectionInfo ); +void sectionEnded( SectionStats const& sectionStats ); +``` + +`section` events are emitted only for active `SECTION`s, that is, sections +that are entered. Sections that are skipped in this test case run-through +do not cause events to be emitted. + +_Note that test cases always contain one implicit section. The event for +this section is emitted after the corresponding `testCasePartialStarting` +event._ + + +### `assertion` events + +```cpp +void assertionStarting( AssertionInfo const& assertionInfo ); +void assertionEnded( AssertionStats const& assertionStats ); +``` + +`assertionStarting` is called after the expression is captured, but before +the assertion expression is evaluated. This might seem like a minor +distinction, but what it means is that if you have assertion like +`REQUIRE( a + b == c + d )`, then what happens is that `a + b` and `c + d` +are evaluated before `assertionStarting` is emitted, while the `==` is +evaluated after the event. + + +## Benchmarking events + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch2 2.9.0. + +```cpp +void benchmarkPreparing( StringRef name ) override; +void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; +void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; +void benchmarkFailed( StringRef error ) override; +``` + +Due to the benchmark lifecycle being bit more complicated, the benchmarking +events have their own category, even though they could be seen as parallel +to the `assertion*` events. You should expect running a benchmark to +generate at least 2 of the events above. + +To understand the explanation below, you should read the [benchmarking +documentation](benchmarks.md#top) first. + +* `benchmarkPreparing` event is sent after the environmental probe +finishes, but before the user code is first estimated. +* `benchmarkStarting` event is sent after the user code is estimated, +but has not been benchmarked yet. +* `benchmarkEnded` event is sent after the user code has been benchmarked, +and contains the benchmarking results. +* `benchmarkFailed` event is sent if either the estimation or the +benchmarking itself fails. + + +## Listings events + +> Introduced in Catch2 3.0.1. + +Listings events are events that correspond to the test binary being +invoked with `--list-foo` flag. + +There are currently 3 listing events, one for reporters, one for tests, +and one for tags. Note that they are not exclusive to each other. + +```cpp +void listReporters( std::vector<ReporterDescription> const& descriptions ); +void listTests( std::vector<TestCaseHandle> const& tests ); +void listTags( std::vector<TagInfo> const& tagInfos ); +``` + + +## Miscellaneous events + +```cpp +void reportInvalidTestSpec( StringRef unmatchedSpec ); +void fatalErrorEncountered( StringRef error ); +void noMatchingTestCases( StringRef unmatchedSpec ); +``` + +These are one-off events that do not neatly fit into other categories. + +`reportInvalidTestSpec` is sent for each [test specification command line +argument](command-line.md#specifying-which-tests-to-run) that wasn't +parsed into a valid spec. + +`fatalErrorEncountered` is sent when Catch2's POSIX signal handling +or Windows SE handler is called into with a fatal signal/exception. + +`noMatchingTestCases` is sent for each user provided test specification +that did not match any registered tests. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/reporters.md b/packages/Catch2/docs/reporters.md index a33e55bf11bf296986105f94e9127eff8c11f684..496c61a925a8185109cb16432144df1f1fa8c942 100644 --- a/packages/Catch2/docs/reporters.md +++ b/packages/Catch2/docs/reporters.md @@ -1,46 +1,212 @@ <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. +Reporters are a customization point for most of Catch2's output, e.g. +formatting and writing out [assertions (whether passing or failing), +sections, test cases, benchmarks, and so on](reporter-events.md#top). + +Catch2 comes with a bunch of reporters by default (currently 8), and +you can also write your own reporter. Because multiple reporters can +be active at the same time, your own reporters do not even have to handle +all reporter event, just the ones you are interested in, e.g. benchmarks. + ## 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.: +You can see which reporters are available by running the test binary +with `--list-reporters`. You can then pick one of them with the [`-r`, +`--reporter` option](command-line.md#choosing-a-reporter-to-use), followed +by the name of the desired reporter, like so: + +``` +--reporter xml +``` + +You can also select multiple reporters to be used at the same time. +In that case you should read the [section on using multiple +reporters](#multiple-reporters) to avoid any surprises from doing so. + +<a id="multiple-reporters"></a> +## Using multiple reporters + +> Support for having multiple parallel reporters was [introduced](https://github.com/catchorg/Catch2/pull/2183) in Catch2 3.0.1 + +Catch2 supports using multiple reporters at the same time while having +them write into different destinations. The two main uses of this are + +* having both human-friendly and machine-parseable (e.g. in JUnit format) + output from one run of binary +* having "partial" reporters that are highly specialized, e.g. having one + reporter that writes out benchmark results as markdown tables and does + nothing else, while also having standard testing output separately + +Specifying multiple reporter looks like this: ``` --r xml +--reporter JUnit::out=result-junit.xml --reporter console::out=-::colour-mode=ansi ``` -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: +This tells Catch2 to use two reporters, `JUnit` reporter that writes +its machine-readable XML output to file `result-junit.xml`, and the +`console` reporter that writes its user-friendly output to stdout and +uses ANSI colour codes for colouring the output. -* `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. +Using multiple reporters (or one reporter and one-or-more [event +listeners](event-listener.md#top)) can have surprisingly complex semantics +when using customization points provided to reporters by Catch2, namely +capturing stdout/stderr from test cases. -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`. +As long as at least one reporter (or listener) asks Catch2 to capture +stdout/stderr, captured stdout and stderr will be available to all +reporters and listeners. -* `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. +Because this might be surprising to the users, if at least one active +_reporter_ is non-capturing, then Catch2 tries to roughly emulate +non-capturing behaviour by printing out the captured stdout/stderr +just before `testCasePartialEnded` event is sent out to the active +reporters and listeners. This means that stdout/stderr is no longer +printed out from tests as it is being written, but instead it is written +out in batch after each runthrough of a test case is finished. -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). +You can also write your own custom reporter and tell Catch2 to use it. +When writing your reporter, you have two options: + +* Derive from `Catch::ReporterBase`. When doing this, you will have + to provide handling for all [reporter events](reporter-events.md#top). +* Derive from one of the provided [utility reporter bases in + Catch2](#utility-reporter-bases). + +Generally we recommend doing the latter, as it is less work. + +Apart from overriding handling of the individual reporter events, reporters +have access to some extra customization points, described below. + + +### Utility reporter bases + +Catch2 currently provides two utility reporter bases: + +* `Catch::StreamingReporterBase` +* `Catch::CumulativeReporterBase` + +`StreamingReporterBase` is useful for reporters that can format and write +out the events as they come in. It provides (usually empty) implementation +for all reporter events, and if you let it handle the relevant events, +it also handles storing information about active test run and test case. + +`CumulativeReporterBase` is a base for reporters that need to see the whole +test run, before they can start writing the output, such as the JUnit +and SonarQube reporters. This post-facto approach requires the assertions +to be stringified when it is finished, so that the assertion can be written +out later. Because the stringification can be expensive, and not all +cumulative reporters need the assertions, this base provides customization +point to change whether the assertions are saved or not, separate for +passing and failing assertions. + + +_Generally we recommend that if you override a member function from either +of the bases, you call into the base's implementation first. This is not +necessarily in all cases, but it is safer and easier._ + + +Writing your own reporter then looks like this: + +```cpp +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> + +class PartialReporter : public Catch::StreamingReporterBase { +public: + using StreamingReporterBase::StreamingReporterBase; + + static std::string getDescription() { + return "Reporter for testing TestCasePartialStarting/Ended events"; + } + + void testCasePartialStarting(Catch::TestCaseInfo const& testInfo, + uint64_t partNumber) override { + std::cout << "TestCaseStartingPartial: " << testInfo.name << '#' << partNumber << '\n'; + } + + void testCasePartialEnded(Catch::TestCaseStats const& testCaseStats, + uint64_t partNumber) override { + std::cout << "TestCasePartialEnded: " << testCaseStats.testInfo->name << '#' << partNumber << '\n'; + } +}; + + +CATCH_REGISTER_REPORTER("partial", PartialReporter) +``` + +This create a simple reporter that responds to `testCasePartial*` events, +and calls itself "partial" reporter, so it can be invoked with +`--reporter partial` command line flag. + + +### `ReporterPreferences` + +Each reporter instance contains instance of `ReporterPreferences`, a type +that holds flags for the behaviour of Catch2 when this reporter run. +Currently there are two customization options: + +* `shouldRedirectStdOut` - whether the reporter wants to handle + writes to stdout/stderr from user code, or not. This is useful for + reporters that output machine-parseable output, e.g. the JUnit + reporter, or the XML reporter. +* `shouldReportAllAssertions` - whether the reporter wants to handle + `assertionEnded` events for passing assertions as well as failing + assertions. Usually reporters do not report successful assertions + and don't need them for their output, but sometimes the desired output + format includes passing assertions even without the `-s` flag. + + +### Per-reporter configuration + +> Per-reporter configuration was introduced in Catch2 3.0.1 + +Catch2 supports some configuration to happen per reporter. The configuration +options fall into one of two categories: + +* Catch2-recognized options +* Reporter-specific options + +The former is a small set of universal options that Catch2 handles for +the reporters, e.g. output file or console colour mode. The latter are +options that the reporters have to handle themselves, but the keys and +values can be arbitrary strings, as long as they don't contain `::`. This +allows writing reporters that can be significantly customized at runtime. + +Reporter-specific options always have to be prefixed with "X" (large +letter X). + + +### Other expected functionality of a reporter + +When writing a custom reporter, there are few more things that you should +keep in mind. These are not important for correctness, but they are +important for the reporter to work _nicely_. + +* Catch2 provides a simple verbosity option for users. There are three + verbosity levels, "quiet", "normal", and "high", and if it makes sense + for reporter's output format, it should respond to these by changing + what, and how much, it writes out. + +* Catch2 operates with an rng-seed. Knowing what seed a test run had + is important if you want to replicate it, so your reporter should + report the rng-seed, if at all possible given the target output format. + +* Catch2 also operates with test filters, or test specs. If a filter + is present, you should also report the filter, if at all possible given + the target output format. + + --- diff --git a/packages/Catch2/docs/test-cases-and-sections.md b/packages/Catch2/docs/test-cases-and-sections.md index 7622eef36e8961adb7a157baddf512d649303ea4..613bbd14f307c884ea4512186aec3587fd770279 100644 --- a/packages/Catch2/docs/test-cases-and-sections.md +++ b/packages/Catch2/docs/test-cases-and-sections.md @@ -44,7 +44,15 @@ The tag expression, ```"[widget]"``` selects A, B & D. ```"[gadget]"``` selects 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. +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. However, escapes are not +supported however and `[\]]` is not a valid tag. + +The same tag can be specified multiple times for a single test case, +but only one of the instances of identical tags will be kept. Which one +is kept is functionally random. + ### Special Tags @@ -64,7 +72,8 @@ All tag names beginning with non-alphanumeric characters are reserved by Catch. * `[@<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. +* `[!benchmark]` - this test case is actually a benchmark. Currently this only serves to hide the test case by default, to avoid the execution time costs. + ## Tag aliases @@ -145,7 +154,7 @@ Scenario : vector can be sized and resized Then : The size changes ``` -See also [runnable example on godbolt](https://godbolt.org/z/e5vPPM), +See also [runnable example on godbolt](https://godbolt.org/z/eY5a64r99), with a more complicated (and failing) example. > `AND_GIVEN` was [introduced](https://github.com/catchorg/Catch2/issues/1360) in Catch2 2.4.0. @@ -253,10 +262,6 @@ TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product } ``` -_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 Catch2 2.9.0. diff --git a/packages/Catch2/docs/test-fixtures.md b/packages/Catch2/docs/test-fixtures.md index d797214fbeda8a2bdbbb38aceb66af58097c9444..e4747c269ca6941451214d00475983aa0ac7b68e 100644 --- a/packages/Catch2/docs/test-fixtures.md +++ b/packages/Catch2/docs/test-fixtures.md @@ -59,7 +59,10 @@ struct Template_Fixture { T m_a; }; -TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) { +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 ); } @@ -77,7 +80,11 @@ struct Foo_class { } }; -TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Template_Fixture, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test succeeds", "[class][template]", (Foo_class, std::vector), int) { +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 ); } ``` @@ -101,7 +108,12 @@ 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) { +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); } @@ -117,8 +129,13 @@ 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))) -{ +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); } ``` @@ -132,8 +149,10 @@ only difference is the source of types. This allows you to reuse the template ty 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) -{ +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 ); } ``` diff --git a/packages/Catch2/docs/tutorial.md b/packages/Catch2/docs/tutorial.md index f764321fe4c31309a85433d260eb038159eff1ae..55a11714cafedaf6cb3900c949173e707b0f651e 100644 --- a/packages/Catch2/docs/tutorial.md +++ b/packages/Catch2/docs/tutorial.md @@ -5,9 +5,8 @@ [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> +[BDD style testing](#bdd-style-testing)<br> +[Data and Type driven tests](#data-and-type-driven-tests)<br> [Next steps](#next-steps)<br> @@ -95,7 +94,7 @@ before we move on. * The test automatically self-registers with the test runner, and user does not have do anything more to ensure that it is picked up by the test framework. _Note that you can run specific test, or set of tests, - through the [command line](command-line#top)._ + through the [command line](command-line.md#top)._ * The individual test assertions are written using the `REQUIRE` macro. It accepts a boolean expression, and uses expression templates to internally decompose it, so that it can be individually stringified @@ -113,8 +112,8 @@ Like most test frameworks, Catch2 supports a class-based fixture mechanism, where individual tests are methods on class and setup/teardown can be done in constructor/destructor of the type. -However, idiomatic usage of Catch2 avoids using it in favour of free -standing test cases using _sections_ to share setup and teardown code. +However, their use in Catch2 is rare, because idiomatic Catch2 tests +instead use _sections_ to share setup and teardown code between test code. This is best explained through an example ([code](../examples/100-Fix-Section.cpp)): ```c++ @@ -189,83 +188,38 @@ unreadable. From experience, having section nest more than 3 levels is usually very hard to follow and not worth the removed duplication. -## BDD-Style +## BDD style testing -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). +Catch2 also provides some basic support for BDD-style testing. There are +macro aliases for `TEST_CASE` and `SECTIONS` that you can use so that +the resulting tests read as BDD spec. `SCENARIO` acts as a `TEST_CASE` +with "Scenario: " name prefix. Then there are `GIVEN`, `WHEN`, `THEN` +(and their variants with `AND_` prefix), which act as a `SECTION`, +similarly prefixed with the macro name. -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 -``` +For more details on the macros look at the [test cases and +sections](test-cases-and-sections.md#top) part of the reference docs, +or at the [vector example done with BDD macros](../examples/120-Bdd-ScenarioGivenWhenThen.cpp). -## Type parametrised test cases +## Data and Type driven tests -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. +Test cases in Catch2 can also be driven by types, input data, or both +at the same time. -For more details, see our documentation on [test cases and -sections](test-cases-and-sections.md#type-parametrised-test-cases). +For more details look into the Catch2 reference, either at the +[type parametrized test cases](test-cases-and-sections.md#type-parametrised-test-cases), +or [data generators](generators.md#top). ## 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. +This page is a brief introduction to get you up and running with Catch2, +and to show the basic features of Catch2. The features mentioned here +can get you quite far, but there are many more. However, you can read +about these as you go, in the ever-growing [reference section](Readme.md#top) +of the documentation. -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. --- diff --git a/packages/Catch2/docs/usage-tips.md b/packages/Catch2/docs/usage-tips.md new file mode 100644 index 0000000000000000000000000000000000000000..8e5c3df11a1f8f77a1fc27ab954de50996d0c53b --- /dev/null +++ b/packages/Catch2/docs/usage-tips.md @@ -0,0 +1,100 @@ +<a id="top"></a> +# Best practices and other tips on using Catch2 + +## Running tests + +Your tests should be run in a manner roughly equivalent with: + +``` +./tests --order rand --warn NoAssertions +``` + +Notice that all the tests are run in a large batch, their relative order +is randomized, and that you ask Catch2 to fail test whose leaf-path +does not contain an assertion. + +The reason I recommend running all your tests in the same process is that +this exposes your tests to interference from their runs. This can be both +positive interference, where the changes in global state from previous +test allow later tests to pass, but also negative interference, where +changes in global state from previous test causes later tests to fail. + +In my experience, interference, especially destructive interference, +usually comes from errors in the code under test, rather than the tests +themselves. This means that by allowing interference to happen, our tests +can find these issues. Obviously, to shake out interference coming from +different orderings of tests, the test order also need to be shuffled +between runs. + +However, running all tests in a single batch eventually becomes impractical +as they will take too long to run, and you will want to run your tests +in parallel. + + +<a id="parallel-tests"></a> +## Running tests in parallel + +There are multiple ways of running tests in parallel, with various level +of structure. If you are using CMake and CTest, then we provide a helper +function [`catch_discover_tests`](cmake-integration.md#automatic-test-registration) +that registers each Catch2 `TEST_CASE` as a single CTest test, which +is then run in a separate process. This is an easy way to set up parallel +tests if you are already using CMake & CTest to run your tests, but you +will lose the advantage of running tests in batches. + + +Catch2 also supports [splitting tests in a binary into multiple +shards](command-line.md#test-sharding). This can be used by any test +runner to run batches of tests in parallel. Do note that when selecting +on the number of shards, you should have more shards than there are cores, +to avoid issues with long running tests getting accidentally grouped in +the same shard, and causing long-tailed execution time. + +**Note that naively composing sharding and random ordering of tests will break.** + +Invoking Catch2 test executable like this + +```text +./tests --order rand --shard-index 0 --shard-count 3 +./tests --order rand --shard-index 1 --shard-count 3 +./tests --order rand --shard-index 2 --shard-count 3 +``` + +does not guarantee covering all tests inside the executable, because +each invocation will have its own random seed, thus it will have its own +random order of tests and thus the partitioning of tests into shards will +be different as well. + +To do this properly, you need the individual shards to share the random +seed, e.g. +```text +./tests --order rand --shard-index 0 --shard-count 3 --rng-seed 0xBEEF +./tests --order rand --shard-index 1 --shard-count 3 --rng-seed 0xBEEF +./tests --order rand --shard-index 2 --shard-count 3 --rng-seed 0xBEEF +``` + +Catch2 actually provides a helper to automatically register multiple shards +as CTest tests, with shared random seed that changes each CTest invocation. +For details look at the documentation of +[`CatchShardTests.cmake` CMake script](cmake-integration.md#catchshardtestscmake). + + +## Organizing tests into binaries + +Both overly large and overly small test binaries can cause issues. Overly +large test binaries have to be recompiled and relinked often, and the +link times are usually also long. Overly small test binaries in turn pay +significant overhead from linking against Catch2 more often per compiled +test case, and also make it hard/impossible to run tests in batches. + +Because there is no hard and fast rule for the right size of a test binary, +I recommend having 1:1 correspondence between libraries in project and test +binaries. (At least if it is possible, in some cases it is not.) Having +a test binary for each library in project keeps related tests together, +and makes tests easy to navigate by reflecting the project's organizational +structure. + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/examples/000-CatchMain.cpp b/packages/Catch2/examples/000-CatchMain.cpp deleted file mode 100644 index 5d06bd98950dc0946c4327fac6b461652058080e..0000000000000000000000000000000000000000 --- a/packages/Catch2/examples/000-CatchMain.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// 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 index 70a0b4c10a6247b6fb4933c9fd8c108ae89329a4..7ec208d5f095b0b22ca7824f145618ef68d41ac6 100644 --- a/packages/Catch2/examples/010-TestCase.cpp +++ b/packages/Catch2/examples/010-TestCase.cpp @@ -19,7 +19,7 @@ TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) { } // Compile & run: -// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success +// - g++ -std=c++14 -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): diff --git a/packages/Catch2/examples/020-TestCase-1.cpp b/packages/Catch2/examples/020-TestCase-1.cpp index 5d7d8de6e9e3640f2ba3a7744b83d9ecba0670a6..cec55799ac932ea4e06180e1a71032033ede764d 100644 --- a/packages/Catch2/examples/020-TestCase-1.cpp +++ b/packages/Catch2/examples/020-TestCase-1.cpp @@ -10,8 +10,8 @@ TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp +// - g++ -std=c++14 -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 diff --git a/packages/Catch2/examples/030-Asn-Require-Check.cpp b/packages/Catch2/examples/030-Asn-Require-Check.cpp index f638afae52ed9f4a251a53656760fbd0d874988f..0d027ca93ea2149b6c800b41e0fc0c7186ebc233 100644 --- a/packages/Catch2/examples/030-Asn-Require-Check.cpp +++ b/packages/Catch2/examples/030-Asn-Require-Check.cpp @@ -8,7 +8,7 @@ // - REQUIRE_FALSE() stops at first failure. // - CHECK_FALSE() continues after failure. -// main() provided in 000-CatchMain.cpp +// main() provided by linkage to Catch2WithMain #include <catch2/catch_test_macros.hpp> @@ -53,8 +53,8 @@ TEST_CASE( "Assert that something is false (continue after failure)", "[check-fa } // 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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success +// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 030-Asn-Require-Check.cpp && 030-Asn-Require-Check --success // Expected compact output (all assertions): // diff --git a/packages/Catch2/examples/100-Fix-Section.cpp b/packages/Catch2/examples/100-Fix-Section.cpp index 6ec5ee803390616ad7d4346e3904babd6879343f..cfbfa79f999b5301cd28639db9509956961b0ab4 100644 --- a/packages/Catch2/examples/100-Fix-Section.cpp +++ b/packages/Catch2/examples/100-Fix-Section.cpp @@ -4,7 +4,7 @@ // - Sections (this file) // - Traditional class-based fixtures -// main() provided in 000-CatchMain.cpp +// main() provided by linkage to Catch2WithMain #include <catch2/catch_test_macros.hpp> #include <vector> @@ -45,8 +45,8 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) { } // 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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp && 100-Fix-Section --success +// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp && 100-Fix-Section --success // Expected compact output (all assertions): // diff --git a/packages/Catch2/examples/110-Fix-ClassFixture.cpp b/packages/Catch2/examples/110-Fix-ClassFixture.cpp index 38617a3b91e46b812566c994e61dcc92f2a94107..75c10da62a9f4ff840ca1151f221627dedc5af1c 100644 --- a/packages/Catch2/examples/110-Fix-ClassFixture.cpp +++ b/packages/Catch2/examples/110-Fix-ClassFixture.cpp @@ -4,7 +4,7 @@ // - Sections // - Traditional class-based fixtures (this file) -// main() provided in 000-CatchMain.cpp +// main() provided by linkage to Catch2WithMain #include <catch2/catch_test_macros.hpp> @@ -52,8 +52,11 @@ TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/Normal", "[create]" ) { } // 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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success +// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 110-Fix-ClassFixture.cpp && 110-Fix-ClassFixture --success +// +// Compile with pkg-config: +// - g++ -std=c++14 -Wall $(pkg-config catch2-with-main --cflags) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp $(pkg-config catch2-with-main --libs) // Expected compact output (all assertions): // diff --git a/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp index 97336a7057734c5de6e8cdb705e74616c5768787..99cdf9ab99a4eee2edad868c5bf9d64351b1cb67 100644 --- a/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp +++ b/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp @@ -1,6 +1,6 @@ // 120-Bdd-ScenarioGivenWhenThen.cpp -// main() provided in 000-CatchMain.cpp +// main() provided by linkage with Catch2WithMain #include <catch2/catch_test_macros.hpp> @@ -48,8 +48,8 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) { } // 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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success +// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 120-Bdd-ScenarioGivenWhenThen.cpp && 120-Bdd-ScenarioGivenWhenThen --success // Expected compact output (all assertions): // diff --git a/packages/Catch2/examples/210-Evt-EventListeners.cpp b/packages/Catch2/examples/210-Evt-EventListeners.cpp index a4b938c9032575a1e36fd6a19ac6919bed82e785..6cedb885c448cb0f8a78bde3ab5b3cade1c905ca 100644 --- a/packages/Catch2/examples/210-Evt-EventListeners.cpp +++ b/packages/Catch2/examples/210-Evt-EventListeners.cpp @@ -7,7 +7,7 @@ #include <catch2/catch_test_macros.hpp> #include <catch2/reporters/catch_reporter_event_listener.hpp> -#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> #include <catch2/catch_test_case_info.hpp> #include <iostream> @@ -22,7 +22,7 @@ std::string ws(int const level) { } std::ostream& operator<<(std::ostream& out, Catch::Tag t) { - return out << "original: " << t.original << "lower cased: " << t.lowerCased; + return out << "original: " << t.original; } template< typename T > @@ -308,7 +308,7 @@ struct MyListener : Catch::EventListenerBase { using EventListenerBase::EventListenerBase; // inherit constructor // Get rid of Wweak-tables - ~MyListener(); + ~MyListener() override; // The whole test run starting void testRunStarting( Catch::TestRunInfo const& testRunInfo ) override { @@ -420,8 +420,8 @@ TEST_CASE_METHOD( Fixture, "3: Testcase with class-based fixture", "[tag-C][tag- } // 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 +// - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success +// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 210-Evt-EventListeners.cpp && 210-Evt-EventListeners --success // Expected compact output (all assertions): // diff --git a/packages/Catch2/extras/Catch.cmake b/packages/Catch2/extras/Catch.cmake index a3885162039121634d4b72eb96d8545ce797a32f..bc553591b25d9efbc460e7d0409fb9289c8d6200 100644 --- a/packages/Catch2/extras/Catch.cmake +++ b/packages/Catch2/extras/Catch.cmake @@ -116,6 +116,13 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``. ``--out dir/<test_name>suffix``. This can be used to add a file extension to the output e.g. ".xml". + ``DL_PATHS path...`` + Specifies paths that need to be set for the dynamic linker to find shared + libraries/DLLs when running the test executable (PATH/LD_LIBRARY_PATH respectively). + These paths will both be set when retrieving the list of test cases from the + test executable and when the tests are executed themselves. This requires + cmake/ctest >= 3.22. + #]=======================================================================] #------------------------------------------------------------------------------ @@ -124,7 +131,7 @@ function(catch_discover_tests TARGET) "" "" "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX" - "TEST_SPEC;EXTRA_ARGS;PROPERTIES" + "TEST_SPEC;EXTRA_ARGS;PROPERTIES;DL_PATHS" ${ARGN} ) @@ -135,6 +142,12 @@ function(catch_discover_tests TARGET) set(_TEST_LIST ${TARGET}_TESTS) endif() + if (_DL_PATHS) + if(${CMAKE_VERSION} VERSION_LESS "3.22.0") + message(FATAL_ERROR "The DL_PATHS option requires at least cmake 3.22") + endif() + 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) @@ -164,6 +177,7 @@ function(catch_discover_tests TARGET) -D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}" -D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}" -D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}" + -D "TEST_DL_PATHS=${_DL_PATHS}" -D "CTEST_FILE=${ctest_tests_file}" -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" VERBATIM diff --git a/packages/Catch2/extras/CatchAddTests.cmake b/packages/Catch2/extras/CatchAddTests.cmake index 9210f5a4df30c49f744cd47bb5dac9e08f8806b1..beec3aede51f3606ba931f7fe2c819af990aceef 100644 --- a/packages/Catch2/extras/CatchAddTests.cmake +++ b/packages/Catch2/extras/CatchAddTests.cmake @@ -10,10 +10,19 @@ set(reporter ${TEST_REPORTER}) set(output_dir ${TEST_OUTPUT_DIR}) set(output_prefix ${TEST_OUTPUT_PREFIX}) set(output_suffix ${TEST_OUTPUT_SUFFIX}) +set(dl_paths ${TEST_DL_PATHS}) set(script) set(suite) set(tests) +if(WIN32) + set(dl_paths_variable_name PATH) +elseif(APPLE) + set(dl_paths_variable_name DYLD_LIBRARY_PATH) +else() + set(dl_paths_variable_name LD_LIBRARY_PATH) +endif() + function(add_command NAME) set(_args "") # use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments @@ -35,6 +44,12 @@ if(NOT EXISTS "${TEST_EXECUTABLE}") "Specified test executable '${TEST_EXECUTABLE}' does not exist" ) endif() + +if(dl_paths) + cmake_path(CONVERT "${dl_paths}" TO_NATIVE_PATH_LIST paths) + set(ENV{${dl_paths_variable_name}} "${paths}") +endif() + execute_process( COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-tests --verbosity quiet OUTPUT_VARIABLE output @@ -85,6 +100,13 @@ if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) endif() endif() +if(dl_paths) + foreach(path ${dl_paths}) + cmake_path(NATIVE_PATH path native_path) + list(APPEND environment_modifications "${dl_paths_variable_name}=path_list_prepend:${native_path}") + endforeach() +endif() + # Parse output foreach(line ${output}) set(test ${line}) @@ -115,6 +137,14 @@ foreach(line ${output}) WORKING_DIRECTORY "${TEST_WORKING_DIR}" ${properties} ) + + if(environment_modifications) + add_command(set_tests_properties + "${prefix}${test}${suffix}" + PROPERTIES + ENVIRONMENT_MODIFICATION "${environment_modifications}") + endif() + list(APPEND tests "${prefix}${test}${suffix}") endforeach() diff --git a/packages/Catch2/extras/CatchShardTests.cmake b/packages/Catch2/extras/CatchShardTests.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d3b5e6fcf876afb12abba2843ece3786313520fe --- /dev/null +++ b/packages/Catch2/extras/CatchShardTests.cmake @@ -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 + +# Supported optional args: +# * SHARD_COUNT - number of shards to split target's tests into +# * REPORTER - reporter spec to use for tests +# * TEST_SPEC - test spec used for filtering tests +function(catch_add_sharded_tests TARGET) + if (${CMAKE_VERSION} VERSION_LESS "3.10.0") + message(FATAL_ERROR "add_sharded_catch_tests only supports CMake versions 3.10.0 and up") + endif() + + cmake_parse_arguments( + "" + "" + "SHARD_COUNT;REPORTER;TEST_SPEC" + "" + ${ARGN} + ) + + if (NOT DEFINED _SHARD_COUNT) + set(_SHARD_COUNT 2) + 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} ${_SHARD_COUNT}") + string(SUBSTRING ${args_hash} 0 7 args_hash) + + set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-sharded-tests-include-${args_hash}.cmake") + set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-sharded-tests-impl-${args_hash}.cmake") + + 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" + ) + + set_property(DIRECTORY + APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}" + ) + + set(shard_impl_script_file "${CMAKE_CURRENT_LIST_DIR}/CatchShardTestsImpl.cmake") + + add_custom_command( + TARGET ${TARGET} POST_BUILD + BYPRODUCTS "${ctest_tests_file}" + COMMAND "${CMAKE_COMMAND}" + -D "TARGET_NAME=${TARGET}" + -D "TEST_BINARY=$<TARGET_FILE:${TARGET}>" + -D "CTEST_FILE=${ctest_tests_file}" + -D "SHARD_COUNT=${_SHARD_COUNT}" + -D "REPORTER_SPEC=${_REPORTER}" + -D "TEST_SPEC=${_TEST_SPEC}" + -P "${shard_impl_script_file}" + VERBATIM + ) + + +endfunction() diff --git a/packages/Catch2/extras/CatchShardTestsImpl.cmake b/packages/Catch2/extras/CatchShardTestsImpl.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d18dddef1642e54aba158416bb53202c692a1a1c --- /dev/null +++ b/packages/Catch2/extras/CatchShardTestsImpl.cmake @@ -0,0 +1,52 @@ + +# 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 + +# Indirection for CatchShardTests that allows us to delay the script +# file generation until build time. + +# Expected args: +# * TEST_BINARY - full path to the test binary to run sharded +# * CTEST_FILE - full path to ctest script file to write to +# * TARGET_NAME - name of the target to shard (used for test names) +# * SHARD_COUNT - number of shards to split the binary into +# Optional args: +# * REPORTER_SPEC - reporter specs to be passed down to the binary +# * TEST_SPEC - test spec to pass down to the test binary + +if(NOT EXISTS "${TEST_BINARY}") + message(FATAL_ERROR + "Specified test binary '${TEST_BINARY}' does not exist" + ) +endif() + +set(other_args "") +if (TEST_SPEC) + set(other_args "${other_args} ${TEST_SPEC}") +endif() +if (REPORTER_SPEC) + set(other_args "${other_args} --reporter ${REPORTER_SPEC}") +endif() + +# foreach RANGE in cmake is inclusive of the end, so we have to adjust it +math(EXPR adjusted_shard_count "${SHARD_COUNT} - 1") + +file(WRITE "${CTEST_FILE}" + "string(RANDOM LENGTH 8 ALPHABET \"0123456789abcdef\" rng_seed)\n" + "\n" + "foreach(shard_idx RANGE ${adjusted_shard_count})\n" + " add_test(${TARGET_NAME}-shard-" [[${shard_idx}]] "/${adjusted_shard_count}\n" + " ${TEST_BINARY}" + " --shard-index " [[${shard_idx}]] + " --shard-count ${SHARD_COUNT}" + " --rng-seed " [[0x${rng_seed}]] + " --order rand" + "${other_args}" + "\n" + " )\n" + "endforeach()\n" +) diff --git a/packages/Catch2/extras/catch_amalgamated.cpp b/packages/Catch2/extras/catch_amalgamated.cpp index b67149f08e72e92549da2b44ce5fa4533e043dc4..ecda2301b3adc6e555f5a27358c0af698762b882 100644 --- a/packages/Catch2/extras/catch_amalgamated.cpp +++ b/packages/Catch2/extras/catch_amalgamated.cpp @@ -5,8 +5,8 @@ // SPDX-License-Identifier: BSL-1.0 -// Catch v3.0.0-preview.3 -// Generated: 2020-10-08 13:59:26.616931 +// Catch v3.1.0 +// Generated: 2022-07-17 20:14:05.885021 // ---------------------------------------------------------- // This file is an amalgamation of multiple different files. // You probably shouldn't edit it directly. @@ -15,11 +15,57 @@ #include "catch_amalgamated.hpp" + + +namespace Catch { + namespace Benchmark { + namespace Detail { + ChronometerConcept::~ChronometerConcept() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + + + +namespace Catch { + namespace Benchmark { + namespace Detail { + BenchmarkFunction::callable::~callable() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + + +#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 + + // Adapted from donated nonius code. #include <cassert> +#include <cstddef> #include <iterator> #include <random> @@ -33,8 +79,8 @@ 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; + sample resample(URng& rng, unsigned int resamples, std::vector<double>::iterator first, std::vector<double>::iterator last, Estimator& estimator) { + auto n = static_cast<size_t>(last - first); std::uniform_int_distribution<decltype(n)> dist(0, n - 1); sample out; @@ -42,7 +88,7 @@ using Catch::Benchmark::Detail::sample; 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)]; }); + std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[static_cast<std::ptrdiff_t>(dist(rng))]; }); return estimator(resampled.begin(), resampled.end()); }); std::sort(out.begin(), out.end()); @@ -127,11 +173,15 @@ using Catch::Benchmark::Detail::sample; 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); + 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 ); } } @@ -140,6 +190,15 @@ namespace Catch { namespace Benchmark { namespace Detail { +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + bool directCompare( double lhs, double rhs ) { return lhs == rhs; } +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif + 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); @@ -147,7 +206,9 @@ namespace Catch { double g = idx - j; std::nth_element(first, first + j, last); auto xj = first[j]; - if (g == 0) return xj; + if ( directCompare( g, 0 ) ) { + return xj; + } auto xj1 = *std::min_element(first + (j + 1), last); return xj + g * (xj1 - xj); @@ -179,7 +240,7 @@ namespace Catch { 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 sg = (std::min)(mg_min / 4., sb / std::sqrt(n)); double sg2 = sg * sg; double sb2 = sb * sb; @@ -190,7 +251,7 @@ namespace Catch { 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))); + return static_cast<int>(-2. * k0 / (k1 + std::sqrt(det))); }; auto var_out = [n, sb2, sg2](double c) { @@ -198,11 +259,11 @@ namespace Catch { return (nc / n) * (sb2 - nc * sg2); }; - return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2; + 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) { + bootstrap_analysis analyse_samples(double confidence_level, unsigned 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; @@ -249,91 +310,6 @@ namespace Catch { } // 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> @@ -351,7 +327,7 @@ bool marginComparison(double lhs, double rhs, double margin) { namespace Catch { Approx::Approx ( double value ) - : m_epsilon( std::numeric_limits<float>::epsilon()*100 ), + : m_epsilon( std::numeric_limits<float>::epsilon()*100. ), m_margin( 0.0 ), m_scale( 0.0 ), m_value( value ) @@ -495,7 +471,7 @@ namespace Catch { : expr; } - std::string AssertionResult::getMessage() const { + StringRef AssertionResult::getMessage() const { return m_resultData.message; } SourceLineInfo AssertionResult::getSourceInfo() const { @@ -510,13 +486,40 @@ namespace Catch { +namespace { + bool provideBazelReporterOutput() { +#ifdef CATCH_CONFIG_BAZEL_SUPPORT + return true; +#else + +# if defined( _MSC_VER ) + // On Windows getenv throws a warning as there is no input validation, + // since the switch is hardcoded, this should not be an issue. +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + + return std::getenv( "BAZEL_TEST" ) != nullptr; + +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif +#endif + } +} namespace Catch { - Config::Config( ConfigData const& data ) - : m_data( data ), - m_stream( openStream() ) - { + bool operator==( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ) { + return lhs.name == rhs.name && + lhs.outputFilename == rhs.outputFilename && + lhs.colourMode == rhs.colourMode && + lhs.customOptions == rhs.customOptions; + } + + Config::Config( ConfigData const& data ): + m_data( data ) { // We need to trim filter specs to avoid trouble with superfluous // whitespace (esp. important for bdd macros, as those are manually // aligned with whitespace). @@ -528,6 +531,7 @@ namespace Catch { elem = trim(elem); } + TestSpecParser parser(ITagAliasRegistry::get()); if (!m_data.testsOrTags.empty()) { m_hasTestFilters = true; @@ -536,25 +540,86 @@ namespace Catch { } } m_testSpec = parser.testSpec(); - } - Config::~Config() = default; + // Insert the default reporter if user hasn't asked for a specfic one + if ( m_data.reporterSpecifications.empty() ) { + m_data.reporterSpecifications.push_back( { +#if defined( CATCH_CONFIG_DEFAULT_REPORTER ) + CATCH_CONFIG_DEFAULT_REPORTER, +#else + "console", +#endif + {}, {}, {} + } ); + } - std::string const& Config::getFilename() const { - return m_data.outputFilename ; + if(provideBazelReporterOutput()){ + // Register a JUnit reporter for Bazel. Bazel sets an environment + // variable with the path to XML output. If this file is written to + // during test, Bazel will not generate a default XML output. + // This allows the XML output file to contain higher level of detail + // than what is possible otherwise. +# if defined( _MSC_VER ) + // On Windows getenv throws a warning as there is no input validation, + // since the key is hardcoded, this should not be an issue. +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" ); +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif + if ( bazelOutputFilePtr != nullptr ) { + m_data.reporterSpecifications.push_back( + { "junit", std::string( bazelOutputFilePtr ), {}, {} } ); + } + } + + + // We now fixup the reporter specs to handle default output spec, + // default colour spec, etc + bool defaultOutputUsed = false; + for ( auto const& reporterSpec : m_data.reporterSpecifications ) { + // We do the default-output check separately, while always + // using the default output below to make the code simpler + // and avoid superfluous copies. + if ( reporterSpec.outputFile().none() ) { + CATCH_ENFORCE( !defaultOutputUsed, + "Internal error: cannot use default output for " + "multiple reporters" ); + defaultOutputUsed = true; + } + + m_processedReporterSpecs.push_back( ProcessedReporterSpec{ + reporterSpec.name(), + reporterSpec.outputFile() ? *reporterSpec.outputFile() + : data.defaultOutputFilename, + reporterSpec.colourMode().valueOr( data.defaultColourMode ), + reporterSpec.customOptions() } ); + } } + Config::~Config() = default; + + 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; } + bool Config::listListeners() const { return m_data.listListeners; } std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + std::vector<ReporterSpec> const& Config::getReporterSpecs() const { + return m_data.reporterSpecifications; + } + + std::vector<ProcessedReporterSpec> const& + Config::getProcessedReporterSpecs() const { + return m_processedReporterSpecs; + } + TestSpec const& Config::testSpec() const { return m_testSpec; } bool Config::hasTestFilters() const { return m_hasTestFilters; } @@ -562,31 +627,34 @@ namespace Catch { // 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; } + StringRef 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); } + bool Config::warnAboutMissingAssertions() const { + return !!( m_data.warnings & WarnAbout::NoAssertions ); + } + bool Config::warnAboutUnmatchedTestSpecs() const { + return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec ); + } + bool Config::zeroTestsCountAsSuccess() const { return m_data.allowZeroTests; } 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; } + uint32_t Config::rngSeed() const { return m_data.rngSeed; } + unsigned int Config::shardCount() const { return m_data.shardCount; } + unsigned int Config::shardIndex() const { return m_data.shardIndex; } + ColourMode Config::defaultColourMode() const { return m_data.defaultColourMode; } 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::skipBenchmarks() const { return m_data.skipBenchmarks; } bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } - int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + unsigned 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 @@ -598,13 +666,6 @@ 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 ) { @@ -613,7 +674,7 @@ namespace Catch { } ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept: - m_info( std::move( old.m_info ) ) { + m_info( CATCH_MOVE( old.m_info ) ) { old.m_moved = true; } @@ -729,16 +790,16 @@ namespace Catch { public: // IMutableRegistryHub void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override { - m_reporterRegistry.registerReporter( name, std::move(factory) ); + m_reporterRegistry.registerReporter( name, CATCH_MOVE(factory) ); } - void registerListener( IReporterFactoryPtr factory ) override { - m_reporterRegistry.registerListener( std::move(factory) ); + void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) override { + m_reporterRegistry.registerListener( CATCH_MOVE(factory) ); } void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override { - m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) ); + m_testCaseRegistry.registerTest( CATCH_MOVE(testInfo), CATCH_MOVE(invoker) ); } - void registerTranslator( const IExceptionTranslator* translator ) override { - m_exceptionTranslatorRegistry.registerTranslator( translator ); + void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) override { + m_exceptionTranslatorRegistry.registerTranslator( CATCH_MOVE(translator) ); } void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { m_tagAliasRegistry.add( alias, tag, lineInfo ); @@ -786,6 +847,7 @@ namespace Catch { #include <algorithm> +#include <cassert> #include <iomanip> #include <set> @@ -794,58 +856,78 @@ 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 << "'"); + IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig&& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, CATCH_MOVE(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); + IEventListenerPtr prepareReporters(Config const* config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty() + && config->getProcessedReporterSpecs().size() == 1) { + auto const& spec = config->getProcessedReporterSpecs()[0]; + return createReporter( + spec.name, + ReporterConfig( config, + makeStream( spec.outputFilename ), + spec.colourMode, + spec.customOptions ) ); } - // 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 multi = Detail::make_unique<MultiReporter>(config); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); for (auto const& listener : listeners) { - multi.addListener(listener->create(Catch::ReporterConfig(config))); + multi->addListener(listener->create(config)); } - multi.addReporter(createReporter(config->getReporterName(), config)); - return ret; + + std::size_t reporterIdx = 0; + for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) { + multi->addReporter( createReporter( + reporterSpec.name, + ReporterConfig( config, + makeStream( reporterSpec.outputFilename ), + reporterSpec.colourMode, + reporterSpec.customOptions ) ) ); + reporterIdx++; + } + + return multi; } class TestGroup { public: - explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): + explicit TestGroup(IEventListenerPtr&& reporter, Config const* config): m_reporter(reporter.get()), m_config{config}, - m_context{config, std::move(reporter)} { + m_context{config, CATCH_MOVE(reporter)} { - auto const& allTestCases = getAllTestCasesSorted(*m_config); - m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); - auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + assert( m_config->testSpec().getInvalidSpecs().empty() && + "Invalid test specs should be handled before running tests" ); - if (m_matches.empty() && invalidArgs.empty()) { - for (auto const& test : allTestCases) - if (!test.getTestCaseInfo().isHidden()) - m_tests.emplace(&test); + auto const& allTestCases = getAllTestCasesSorted(*m_config); + auto const& testSpec = m_config->testSpec(); + if ( !testSpec.hasFilters() ) { + 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()); + m_matches = + testSpec.matchesByFilter( allTestCases, *m_config ); + for ( auto const& match : m_matches ) { + m_tests.insert( match.tests.begin(), + match.tests.end() ); + } } + + m_tests = createShard(m_tests, m_config->shardCount(), m_config->shardIndex()); } 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); @@ -855,28 +937,26 @@ namespace Catch { for (auto const& match : m_matches) { if (match.tests.empty()) { - m_reporter->noMatchingTestCases(match.name); - totals.error = -1; + m_unmatchedTestSpecs = true; + m_reporter->noMatchingTestCases( match.name ); } } - 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*>; + bool hadUnmatchedTestSpecs() const { + return m_unmatchedTestSpecs; + } - IStreamingReporter* m_reporter; + + private: + IEventListener* m_reporter; Config const* m_config; RunContext m_context; - Tests m_tests; + std::set<TestCaseHandle const*> m_tests; TestSpec::Matches m_matches; + bool m_unmatchedTestSpecs = false; }; void applyFilenamesAsTags() { @@ -902,14 +982,17 @@ namespace Catch { getCurrentMutableContext().setConfig(m_config.get()); m_startupExceptions = true; - Colour colourGuard( Colour::Red ); - Catch::cerr() << "Errors occurred during startup!" << '\n'; + auto errStream = makeStream( "%stderr" ); + auto colourImpl = makeColourImpl( + ColourMode::PlatformDefault, errStream.get() ); + auto guard = colourImpl->guardColour( Colour::Red ); + errStream->stream() << "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'; + errStream->stream() << TextFlow::Column( ex.what() ).indent(2) << '\n'; } } } @@ -924,16 +1007,16 @@ namespace Catch { 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; + << "\nCatch2 v" << libraryVersion() << '\n' + << m_cli << '\n' + << "For more detailed usage please see the project docs\n\n" << std::flush; } 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; + << std::left << std::setw(16) << "framework: " << "Catch2\n" + << std::left << std::setw(16) << "version: " << libraryVersion() << '\n' << std::flush; } int Session::applyCommandLine( int argc, char const * const * argv ) { @@ -941,15 +1024,19 @@ namespace Catch { return 1; auto result = m_cli.parse( Clara::Args( argc, argv ) ); + if( !result ) { config(); getCurrentMutableContext().setConfig(m_config.get()); - Catch::cerr() - << Colour( Colour::Red ) + auto errStream = makeStream( "%stderr" ); + auto colour = makeColourImpl( ColourMode::PlatformDefault, errStream.get() ); + + errStream->stream() + << colour->guardColour( Colour::Red ) << "\nError(s) in input:\n" << TextFlow::Column( result.errorMessage() ).indent( 2 ) << "\n\n"; - Catch::cerr() << "Run with -? for usage\n" << std::endl; + errStream->stream() << "Run with -? for usage\n\n" << std::flush; return MaxExitCode; } @@ -957,6 +1044,7 @@ namespace Catch { showHelp(); if( m_configData.libIdentify ) libIdentify(); + m_config.reset(); return 0; } @@ -992,12 +1080,12 @@ namespace Catch { int Session::run() { if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { - Catch::cout() << "...waiting for enter/ return before starting" << std::endl; + Catch::cout() << "...waiting for enter/ return before starting\n" << std::flush; 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; + Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << '\n' << std::flush; static_cast<void>(std::getchar()); } return exitCode; @@ -1026,6 +1114,14 @@ namespace Catch { return 0; } + if ( m_configData.shardIndex >= m_configData.shardCount ) { + Catch::cerr() << "The shard count (" << m_configData.shardCount + << ") must be greater than the shard index (" + << m_configData.shardIndex << ")\n" + << std::flush; + return 1; + } + CATCH_TRY { config(); // Force config to be constructed @@ -1039,27 +1135,43 @@ namespace Catch { getCurrentMutableContext().setConfig(m_config.get()); // Create reporter(s) so we can route listings through them - auto reporter = makeReporter(m_config.get()); + auto reporter = prepareReporters(m_config.get()); + + auto const& invalidSpecs = m_config->testSpec().getInvalidSpecs(); + if ( !invalidSpecs.empty() ) { + for ( auto const& spec : invalidSpecs ) { + reporter->reportInvalidTestSpec( spec ); + } + return 1; + } + // Handle list request if (list(*reporter, *m_config)) { return 0; } - TestGroup tests { std::move(reporter), m_config.get() }; + TestGroup tests { CATCH_MOVE(reporter), m_config.get() }; auto const totals = tests.execute(); - if( m_config->warnAboutNoTests() && totals.error == -1 ) + if ( tests.hadUnmatchedTestSpecs() + && m_config->warnAboutUnmatchedTestSpecs() ) { + return 3; + } + + if ( totals.testCases.total() == 0 + && !m_config->zeroTestsCountAsSuccess() ) { 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))); + return (std::min) (MaxExitCode, static_cast<int>(totals.assertions.failed)); } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) catch( std::exception& ex ) { - Catch::cerr() << ex.what() << std::endl; + Catch::cerr() << ex.what() << '\n' << std::flush; return MaxExitCode; } #endif @@ -1069,6 +1181,22 @@ namespace Catch { + +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(); + } + } + +} + + + #include <cassert> #include <cctype> #include <algorithm> @@ -1117,7 +1245,7 @@ namespace Catch { else if( tag == "!nonportable"_sr ) return TestCaseProperties::NonPortable; else if( tag == "!benchmark"_sr ) - return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden ); + return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden; else return TestCaseProperties::None; } @@ -1159,16 +1287,25 @@ namespace Catch { const size_t extras = 3 + 3; return extractFilenamePart(filepath).size() + extras; } + } // end unnamed namespace + + bool operator<( Tag const& lhs, Tag const& rhs ) { + Detail::CaseInsensitiveLess cmp; + return cmp( lhs.original, rhs.original ); + } + bool operator==( Tag const& lhs, Tag const& rhs ) { + Detail::CaseInsensitiveEqualTo cmp; + return cmp( lhs.original, rhs.original ); } Detail::unique_ptr<TestCaseInfo> - makeTestCaseInfo(std::string const& _className, + makeTestCaseInfo(StringRef _className, NameAndTags const& nameAndTags, SourceLineInfo const& _lineInfo ) { return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo); } - TestCaseInfo::TestCaseInfo(std::string const& _className, + TestCaseInfo::TestCaseInfo(StringRef _className, NameAndTags const& _nameAndTags, SourceLineInfo const& _lineInfo): name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ), @@ -1180,7 +1317,6 @@ namespace Catch { // (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]. @@ -1204,6 +1340,7 @@ namespace Catch { // it over to backing storage and actually reference the // backing storage in the saved tags StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1); + CATCH_ENFORCE(!tagStr.empty(), "Empty tags are not allowed"); enforceNotReservedTag(tagStr, lineInfo); properties |= parseSpecialTag(tagStr); // When copying a tag to the backing storage, we need to @@ -1225,9 +1362,8 @@ namespace Catch { } // 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; }), + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); } @@ -1273,24 +1409,22 @@ namespace Catch { 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; + tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart)); } - bool TestCaseHandle::operator < ( TestCaseHandle const& rhs ) const { - return m_info->name < rhs.m_info->name; + bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) { + // We want to avoid redoing the string comparisons multiple times, + // so we store the result of a three-way comparison before using + // it in the actual comparison logic. + const auto cmpName = lhs.name.compare( rhs.name ); + if ( cmpName != 0 ) { + return cmpName < 0; + } + const auto cmpClassName = lhs.className.compare( rhs.className ); + if ( cmpClassName != 0 ) { + return cmpClassName < 0; + } + return lhs.tags < rhs.tags; } TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const { @@ -1330,15 +1464,13 @@ namespace Catch { TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) : Pattern( filterString ) - , m_tag( toLower( tag ) ) + , m_tag( 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); + return std::find( begin( testCase.tags ), + end( testCase.tags ), + Tag( m_tag ) ) != end( testCase.tags ); } bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { @@ -1390,8 +1522,8 @@ namespace Catch { return matches; } - const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ - return (m_invalidArgs); + const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const { + return m_invalidSpecs; } } @@ -1400,49 +1532,13 @@ namespace Catch { #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; + static auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); } - } - auto getEstimatedClockResolution() -> uint64_t { - static auto s_resolution = estimateClockResolution(); - return s_resolution; - } + } // end unnamed namespace void Timer::start() { m_nanoseconds = getCurrentNanosecondsSinceEpoch(); @@ -1464,12 +1560,6 @@ namespace Catch { } // 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> @@ -1479,8 +1569,6 @@ namespace Catch { namespace Detail { - const std::string unprintableString = "{?}"; - namespace { const int hexThreshold = 255; @@ -1517,6 +1605,48 @@ namespace Detail { } } // end unnamed namespace + std::string convertIntoString(StringRef string, bool escape_invisibles) { + std::string ret; + // This is enough for the "don't escape invisibles" case, and a good + // lower bound on the "escape invisibles" case. + ret.reserve(string.size() + 2); + + if (!escape_invisibles) { + ret += '"'; + ret += string; + ret += '"'; + return ret; + } + + ret += '"'; + for (char c : string) { + switch (c) { + case '\r': + ret.append("\\r"); + break; + case '\n': + ret.append("\\n"); + break; + case '\t': + ret.append("\\t"); + break; + case '\f': + ret.append("\\f"); + break; + default: + ret.push_back(c); + break; + } + } + ret += '"'; + + return ret; + } + + std::string convertIntoString(StringRef string) { + return convertIntoString(string, getCurrentContext().getConfig()->showInvisibles()); + } + 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; @@ -1543,44 +1673,25 @@ namespace Detail { //// ======================================================= //// 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; + return Detail::convertIntoString( str ); } #ifdef CATCH_CONFIG_CPP17_STRING_VIEW std::string StringMaker<std::string_view>::convert(std::string_view str) { - return ::Catch::Detail::stringify(std::string{ str }); + return Detail::convertIntoString( StringRef( str.data(), str.size() ) ); } #endif std::string StringMaker<char const*>::convert(char const* str) { if (str) { - return ::Catch::Detail::stringify(std::string{ str }); + return Detail::convertIntoString( str ); } else { return{ "{null string}" }; } } std::string StringMaker<char*>::convert(char* str) { if (str) { - return ::Catch::Detail::stringify(std::string{ str }); + return Detail::convertIntoString( str ); } else { return{ "{null string}" }; } @@ -1693,14 +1804,9 @@ std::string StringMaker<double>::convert(double value) { } // end namespace Catch -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - - -namespace Catch { +namespace Catch { Counts Counts::operator - ( Counts const& other ) const { Counts diff; @@ -1717,7 +1823,7 @@ namespace Catch { return *this; } - std::size_t Counts::total() const { + std::uint64_t Counts::total() const { return passed + failed + failedButOk; } bool Counts::allPassed() const { @@ -1784,28 +1890,13 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 3, 0, 0, "preview", 3 ); + static Version version( 3, 1, 0, "", 0 ); 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 { @@ -1817,9 +1908,6 @@ namespace Catch { } // end namespace Catch -/////////////////////////////////////////// -// vvv formerly catch_generators.cpp vvv // -/////////////////////////////////////////// namespace Catch { @@ -1846,121 +1934,102 @@ namespace Detail { } // 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; -} +std::uint32_t Catch::Generators::Detail::getSeed() { return sharedRng()(); } -////////////////////////////////////////////////// -// vvv formerly catch_interfaces_config.cpp vvv // -////////////////////////////////////////////////// namespace Catch { - IConfig::~IConfig() = default; + IResultCapture::~IResultCapture() = default; } -///////////////////////////////////////////////////// -// vvv formerly catch_interfaces_exception.cpp vvv // -///////////////////////////////////////////////////// namespace Catch { - IExceptionTranslator::~IExceptionTranslator() = default; - IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; + IConfig::~IConfig() = default; } -//////////////////////////////////////////////////////// -// vvv formerly catch_interfaces_registry_hub.cpp vvv // -//////////////////////////////////////////////////////// namespace Catch { - IRegistryHub::~IRegistryHub() = default; - IMutableRegistryHub::~IMutableRegistryHub() = default; + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; } -////////////////////////////////////////////////// -// vvv formerly catch_interfaces_runner.cpp vvv // -////////////////////////////////////////////////// +#include <string> namespace Catch { - IRunner::~IRunner() = default; -} - - -//////////////////////////////////////////////////// -// vvv formerly catch_interfaces_testcase.cpp vvv // -//////////////////////////////////////////////////// + namespace Generators { + bool GeneratorUntypedBase::countedNext() { + auto ret = next(); + if ( ret ) { + m_stringReprCache.clear(); + ++m_currentElementIndex; + } + return ret; + } -namespace Catch { - ITestInvoker::~ITestInvoker() = default; - ITestCaseRegistry::~ITestCaseRegistry() = default; -} + StringRef GeneratorUntypedBase::currentElementAsString() const { + if ( m_stringReprCache.empty() ) { + m_stringReprCache = stringifyImpl(); + } + return m_stringReprCache; + } + } // namespace Generators +} // namespace Catch -namespace Catch { - IReporterRegistry::~IReporterRegistry() = default; -} namespace Catch { - IReporterFactory::~IReporterFactory() = default; + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; } #include <algorithm> +#include <cassert> #include <iomanip> namespace Catch { - ReporterConfig::ReporterConfig( IConfig const* _fullConfig ) - : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + ReporterConfig::ReporterConfig( + IConfig const* _fullConfig, + Detail::unique_ptr<IStream> _stream, + ColourMode colourMode, + std::map<std::string, std::string> customOptions ): + m_stream( CATCH_MOVE(_stream) ), + m_fullConfig( _fullConfig ), + m_colourMode( colourMode ), + m_customOptions( CATCH_MOVE( customOptions ) ) {} - ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ) - : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} - - std::ostream& ReporterConfig::stream() const { return *m_stream; } + Detail::unique_ptr<IStream> ReporterConfig::takeStream() && { + assert( m_stream ); + return CATCH_MOVE( m_stream ); + } IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; } + ColourMode ReporterConfig::colourMode() const { return m_colourMode; } + std::map<std::string, std::string> const& + ReporterConfig::customOptions() const { + return m_customOptions; + } - 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 ) - {} + ReporterConfig::~ReporterConfig() = default; - AssertionStats::AssertionStats( AssertionResult const& _assertionResult, - std::vector<MessageInfo> const& _infoMessages, - Totals const& _totals ) + AssertionStats::AssertionStats( AssertionResult const& _assertionResult, + std::vector<MessageInfo> const& _infoMessages, + Totals const& _totals ) : assertionResult( _assertionResult ), infoMessages( _infoMessages ), totals( _totals ) @@ -2002,20 +2071,6 @@ namespace Catch { {} - 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 ) @@ -2024,93 +2079,39 @@ namespace Catch { aborting( _aborting ) {} - void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + IEventListener::~IEventListener() = default; - 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(); +} // end namespace Catch - 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'; - } - } +namespace Catch { + IReporterFactory::~IReporterFactory() = default; + EventListenerFactory::~EventListenerFactory() = default; +} - 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 { + IReporterRegistry::~IReporterRegistry() = default; +} + + + + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} namespace Catch { AssertionHandler::AssertionHandler - ( StringRef const& macroName, + ( StringRef macroName, SourceLineInfo const& lineInfo, StringRef capturedExpression, ResultDisposition::Flags resultDisposition ) @@ -2121,7 +2122,7 @@ namespace Catch { void AssertionHandler::handleExpr( ITransientExpression const& expr ) { m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); } - void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { + void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) { m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); } @@ -2172,14 +2173,45 @@ namespace Catch { // 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 ) { + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) { handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); } } // namespace Catch + + +#include <algorithm> + +namespace Catch { + namespace Detail { + + bool CaseInsensitiveLess::operator()( StringRef lhs, + StringRef rhs ) const { + return std::lexicographical_compare( + lhs.begin(), lhs.end(), + rhs.begin(), rhs.end(), + []( char l, char r ) { return toLower( l ) < toLower( r ); } ); + } + + bool + CaseInsensitiveEqualTo::operator()( StringRef lhs, + StringRef rhs ) const { + return std::equal( + lhs.begin(), lhs.end(), + rhs.begin(), rhs.end(), + []( char l, char r ) { return toLower( l ) == toLower( r ); } ); + } + + } // namespace Detail +} // namespace Catch + + + + #include <algorithm> +#include <ostream> namespace { bool isOptPrefix( char c ) { @@ -2282,7 +2314,7 @@ namespace Catch { } else { return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + - source + "'" ); + source + '\'' ); } return ParserResult::ok( ParseResultType::Matched ); } @@ -2399,7 +2431,7 @@ namespace Catch { return Detail::InternalParseResult::runtimeError( "Expected argument following " + token.token); - auto result = valueRef->setValue(argToken.token); + const auto result = valueRef->setValue(argToken.token); if (!result) return Detail::InternalParseResult(result); if (result.value() == @@ -2614,347 +2646,217 @@ namespace Catch { } // 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 // -//////////////////////////////////////////////////////// +#include <fstream> +#include <string> 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(); - } - } + Clara::Parser makeCommandLineParser( ConfigData& config ) { -} + using namespace Clara; + auto const setWarning = [&]( std::string const& warning ) { + if ( warning == "NoAssertions" ) { + config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::NoAssertions); + return ParserResult::ok( ParseResultType::Matched ); + } else if ( warning == "UnmatchedTestSpec" ) { + config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::UnmatchedTestSpec); + return ParserResult::ok( ParseResultType::Matched ); + } -////////////////////////////////////////// -// vvv formerly catch_polyfills.cpp vvv // -////////////////////////////////////////// + return ParserResult ::runtimeError( + "Unrecognised warning option: '" + warning + '\'' ); + }; + 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 + '\'' ); -#include <cmath> + 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 ); -namespace Catch { + 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" ) { + config.rngSeed = generateRandomSeed(GenerateFrom::Time); + return ParserResult::ok(ParseResultType::Matched); + } else if (seed == "random-device") { + config.rngSeed = generateRandomSeed(GenerateFrom::RandomDevice); + return ParserResult::ok(ParseResultType::Matched); + } -#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 + CATCH_TRY { + std::size_t parsedTo = 0; + unsigned long parsedSeed = std::stoul(seed, &parsedTo, 0); + if (parsedTo != seed.size()) { + return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + } -} // end namespace Catch + // TODO: Ideally we could parse unsigned int directly, + // but the stdlib doesn't provide helper for that + // type. After this is refactored to use fixed size + // type, we should check the parsed value is in range + // of the underlying type. + config.rngSeed = static_cast<unsigned int>(parsedSeed); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + } + }; + auto const setDefaultColourMode = [&]( std::string const& colourMode ) { + Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode )); + if ( !maybeMode ) { + return ParserResult::runtimeError( + "colour mode must be one of: default, ansi, win32, " + "or none. '" + + colourMode + "' is not recognised" ); + } + auto mode = *maybeMode; + if ( !isColourImplAvailable( mode ) ) { + return ParserResult::runtimeError( + "colour mode '" + colourMode + + "' is not supported in this binary" ); + } + config.defaultColourMode = mode; + 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& userReporterSpec ) { + if ( userReporterSpec.empty() ) { + return ParserResult::runtimeError( "Received empty reporter spec." ); + } + Optional<ReporterSpec> parsed = + parseReporterSpec( userReporterSpec ); + if ( !parsed ) { + return ParserResult::runtimeError( + "Could not parse reporter spec '" + userReporterSpec + + "'" ); + } -//////////////////////////////////////////////////// -// vvv formerly catch_uncaught_exceptions.cpp vvv // -//////////////////////////////////////////////////// + auto const& reporterSpec = *parsed; + IReporterRegistry::FactoryMap const& factories = + getRegistryHub().getReporterRegistry().getFactories(); + auto result = factories.find( reporterSpec.name() ); -#include <exception> + if ( result == factories.end() ) { + return ParserResult::runtimeError( + "Unrecognized reporter, '" + reporterSpec.name() + + "'. Check available with --list-reporters" ); + } -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 + const bool hadOutputFile = reporterSpec.outputFile().some(); + config.reporterSpecifications.push_back( CATCH_MOVE( *parsed ) ); + // It would be enough to check this only once at the very end, but + // there is not a place where we could call this check, so do it + // every time it could fail. For valid inputs, this is still called + // at most once. + if (!hadOutputFile) { + int n_reporters_without_file = 0; + for (auto const& spec : config.reporterSpecifications) { + if (spec.outputFile().none()) { + n_reporters_without_file++; + } + } + if (n_reporters_without_file > 1) { + return ParserResult::runtimeError( "Only one reporter may have unspecified output file." ); + } + } -//////////////////////////////////////////// -// vvv formerly catch_errno_guard.cpp vvv // -//////////////////////////////////////////// + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setShardCount = [&]( std::string const& shardCount ) { + CATCH_TRY{ + std::size_t parsedTo = 0; + int64_t parsedCount = std::stoll(shardCount, &parsedTo, 0); + if (parsedTo != shardCount.size()) { + return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + } + if (parsedCount <= 0) { + return ParserResult::runtimeError("Shard count must be a positive number"); + } -#include <cerrno> + config.shardCount = static_cast<unsigned int>(parsedCount); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + } + }; -namespace Catch { - ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} - ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } -} + auto const setShardIndex = [&](std::string const& shardIndex) { + CATCH_TRY{ + std::size_t parsedTo = 0; + int64_t parsedIndex = std::stoll(shardIndex, &parsedTo, 0); + if (parsedTo != shardIndex.size()) { + return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + } + if (parsedIndex < 0) { + return ParserResult::runtimeError("Shard index must be a non-negative number"); + } + config.shardIndex = static_cast<unsigned int>(parsedIndex); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + } + }; -/////////////////////////////////////////// -// 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" ) @@ -2967,10 +2869,10 @@ namespace Catch { | Opt( config.showInvisibles ) ["-i"]["--invisibles"] ( "show invisibles (tabs, newlines)" ) - | Opt( config.outputFilename, "filename" ) + | Opt( config.defaultOutputFilename, "filename" ) ["-o"]["--out"] - ( "output filename" ) - | Opt( setReporter, "name" ) + ( "default output filename" ) + | Opt( accept_many, setReporter, "name[::key=value]*" ) ["-r"]["--reporter"] ( "reporter to use (defaults to console)" ) | Opt( config.name, "name" ) @@ -2982,7 +2884,7 @@ namespace Catch { | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) ["-x"]["--abortx"] ( "abort after x failures" ) - | Opt( setWarning, "warning name" ) + | Opt( accept_many, setWarning, "warning name" ) ["-w"]["--warn"] ( "enable warnings" ) | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) @@ -3003,24 +2905,36 @@ namespace Catch { | Opt( setVerbosity, "quiet|normal|high" ) ["-v"]["--verbosity"] ( "set output verbosity" ) + | Opt( config.listTests ) + ["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["--list-tags"] + ( "list all/matching tags" ) | Opt( config.listReporters ) ["--list-reporters"] - ( "list all reporters" ) + ( "list all available reporters" ) + | Opt( config.listListeners ) + ["--list-listeners"] + ( "list all listeners" ) | Opt( setTestOrder, "decl|lex|rand" ) ["--order"] ( "test case order (defaults to decl)" ) - | Opt( setRngSeed, "'time'|number" ) + | Opt( setRngSeed, "'time'|'random-device'|number" ) ["--rng-seed"] ( "set a specific seed for random numbers" ) - | Opt( setColourUsage, "yes|no" ) - ["--use-colour"] - ( "should output be colourised" ) + | Opt( setDefaultColourMode, "ansi|win32|none|default" ) + ["--colour-mode"] + ( "what color mode should be used as default" ) | 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.skipBenchmarks) + ["--skip-benchmarks"] + ( "disable running benchmarks") | Opt( config.benchmarkSamples, "samples" ) ["--benchmark-samples"] ( "number of samples to collect (default: 100)" ) @@ -3036,6 +2950,15 @@ namespace Catch { | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) ["--benchmark-warmup-time"] ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Opt( setShardCount, "shard count" ) + ["--shard-count"] + ( "split the tests to execute into this many groups" ) + | Opt( setShardIndex, "shard index" ) + ["--shard-index"] + ( "index of the group of tests to execute (see --shard-count)" ) | + Opt( config.allowZeroTests ) + ["--allow-running-no-tests"] + ( "Treat 'No tests run' as a success" ) | Arg( config.testsOrTags, "test name|pattern|tags" ) ( "which test or tests to use" ); @@ -3045,87 +2968,113 @@ namespace Catch { } // end namespace Catch +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + + -#include <cstring> +#include <cassert> #include <ostream> +#include <utility> 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)); - } + ColourImpl::~ColourImpl() = default; - 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; + ColourImpl::ColourGuard ColourImpl::guardColour( Colour::Code colourCode ) { + return ColourGuard(colourCode, this ); } -} // end namespace Catch + void ColourImpl::ColourGuard::engageImpl( std::ostream& stream ) { + assert( &stream == &m_colourImpl->m_stream->stream() && + "Engaging colour guard for different stream than used by the " + "parent colour implementation" ); + static_cast<void>( stream ); + m_engaged = true; + m_colourImpl->use( m_code ); + } -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -#endif + ColourImpl::ColourGuard::ColourGuard( Colour::Code code, + ColourImpl const* colour ): + m_colourImpl( colour ), m_code( code ) { + } + ColourImpl::ColourGuard::ColourGuard( ColourGuard&& rhs ) noexcept: + m_colourImpl( rhs.m_colourImpl ), + m_code( rhs.m_code ), + m_engaged( rhs.m_engaged ) { + rhs.m_engaged = false; + } + ColourImpl::ColourGuard& + ColourImpl::ColourGuard::operator=( ColourGuard&& rhs ) noexcept { + using std::swap; + swap( m_colourImpl, rhs.m_colourImpl ); + swap( m_code, rhs.m_code ); + swap( m_engaged, rhs.m_engaged ); + return *this; + } + ColourImpl::ColourGuard::~ColourGuard() { + if ( m_engaged ) { + m_colourImpl->use( Colour::None ); + } + } + ColourImpl::ColourGuard& + ColourImpl::ColourGuard::engage( std::ostream& stream ) & { + engageImpl( stream ); + return *this; + } -#include <ostream> + ColourImpl::ColourGuard&& + ColourImpl::ColourGuard::engage( std::ostream& stream ) && { + engageImpl( stream ); + return CATCH_MOVE(*this); + } -namespace Catch { namespace { + //! A do-nothing implementation of colour, used as fallback for unknown + //! platforms, and when the user asks to deactivate all colours. + class NoColourImpl : public ColourImpl { + public: + NoColourImpl( IStream* stream ): ColourImpl( stream ) {} - struct IColourImpl { - virtual ~IColourImpl() = default; - virtual void use( Colour::Code _colourCode ) = 0; + private: + void use( Colour::Code ) const override {} }; + } // namespace - 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 ) ///////////////////////////////////////// +#if defined ( CATCH_CONFIG_COLOUR_WIN32 ) ///////////////////////////////////////// namespace Catch { namespace { - class Win32ColourImpl : public IColourImpl { + class Win32ColourImpl : public ColourImpl { public: - Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) - { + Win32ColourImpl(IStream* stream): + ColourImpl(stream) { CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); + GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), + &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 { + static bool useImplementationForStream(IStream const& stream) { + // Win32 text colour APIs can only be used on console streams + // We cannot check that the output hasn't been redirected, + // so we just check that the original stream is console stream. + return stream.isConsole(); + } + + private: + void use( Colour::Code _colourCode ) const override { switch( _colourCode ) { case Colour::None: return setTextAttribute( originalForegroundAttributes ); case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); @@ -3149,45 +3098,63 @@ namespace { } } - private: - void setTextAttribute( WORD _textAttribute ) { - SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); + void setTextAttribute( WORD _textAttribute ) const { + SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), + _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 ) ////////////////////////////////////// +#endif // Windows/ ANSI/ None + -#include <unistd.h> +#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC ) +# define CATCH_INTERNAL_HAS_ISATTY +# include <unistd.h> +#endif 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 { + class ANSIColourImpl : public ColourImpl { public: - void use( Colour::Code _colourCode ) override { + ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {} + + static bool useImplementationForStream(IStream const& stream) { + // This is kinda messy due to trying to support a bunch of + // different platforms at once. + // The basic idea is that if we are asked to do autodetection (as + // opposed to being told to use posixy colours outright), then we + // only want to use the colours if we are writing to console. + // However, console might be redirected, so we make an attempt at + // checking for that on platforms where we know how to do that. + bool useColour = stream.isConsole(); +#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \ + !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) ) + ErrnoGuard _; // for isatty + useColour = useColour && isatty( STDOUT_FILENO ); +# endif +# if defined( CATCH_PLATFORM_MAC ) || defined( CATCH_PLATFORM_IPHONE ) + useColour = useColour && !isDebuggerActive(); +# endif + + return useColour; + } + + private: + void use( Colour::Code _colourCode ) const override { + auto setColour = [&out = + m_stream->stream()]( char const* escapeCode ) { + // The escape sequence must be flushed to console, otherwise + // if stdin and stderr are intermixed, we'd get accidentally + // coloured output. + out << '\033' << escapeCode << std::flush; + }; switch( _colourCode ) { case Colour::None: case Colour::White: return setColour( "[0m" ); @@ -3208,89 +3175,56 @@ namespace { 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 + Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection, + IStream* stream ) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + if ( implSelection == ColourMode::Win32 ) { + return Detail::make_unique<Win32ColourImpl>( stream ); + } +#endif + if ( implSelection == ColourMode::ANSI ) { + return Detail::make_unique<ANSIColourImpl>( stream ); + } + if ( implSelection == ColourMode::None ) { + return Detail::make_unique<NoColourImpl>( stream ); + } -namespace Catch { + if ( implSelection == ColourMode::PlatformDefault) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + if ( Win32ColourImpl::useImplementationForStream( *stream ) ) { + return Detail::make_unique<Win32ColourImpl>( stream ); + } +#endif + if ( ANSIColourImpl::useImplementationForStream( *stream ) ) { + return Detail::make_unique<ANSIColourImpl>( stream ); + } + return Detail::make_unique<NoColourImpl>( stream ); + } - 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; + CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(implSelection) ); } - 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 ); + bool isColourImplAvailable( ColourMode colourSelection ) { + switch ( colourSelection ) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + case ColourMode::Win32: +#endif + case ColourMode::ANSI: + case ColourMode::None: + case ColourMode::PlatformDefault: + return true; + default: + return false; } } - std::ostream& operator << ( std::ostream& os, Colour const& ) { - return os; - } } // end namespace Catch @@ -3309,9 +3243,6 @@ namespace Catch { IResultCapture* getResultCapture() override { return m_resultCapture; } - IRunner* getRunner() override { - return m_runner; - } IConfig const* getConfig() const override { return m_config; @@ -3323,9 +3254,6 @@ namespace Catch { 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; } @@ -3334,7 +3262,6 @@ namespace Catch { private: IConfig const* m_config = nullptr; - IRunner* m_runner = nullptr; IResultCapture* m_resultCapture = nullptr; }; @@ -3354,7 +3281,7 @@ namespace Catch { Context::~Context() = default; - SimplePcg32& rng() { + SimplePcg32& sharedRng() { static SimplePcg32 s_rng; return s_rng; } @@ -3363,6 +3290,10 @@ namespace Catch { + + +#include <ostream> + #if defined(CATCH_CONFIG_ANDROID_LOGWRITE) #include <android/log.h> @@ -3436,7 +3367,7 @@ namespace Catch { 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; + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n\n" << std::flush; return false; } @@ -3500,7 +3431,24 @@ namespace Catch { namespace Catch { bool isDebuggerActive() { return false; } } -#endif // Platform +#endif // Platform + + + + +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; + } +} @@ -3542,7 +3490,7 @@ namespace Catch { namespace Catch { - IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} + IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() = default; namespace Detail { @@ -3550,7 +3498,7 @@ namespace Catch { // 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 ":" + // Find last occurrence of ":" size_t name_start = enumInstance.size(); while (name_start > 0 && enumInstance[name_start - 1] != ':') { --name_start; @@ -3604,38 +3552,53 @@ namespace Catch { + +#include <cerrno> + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} + + + namespace Catch { ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { } - void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { - m_translators.push_back( Detail::unique_ptr<const IExceptionTranslator>( translator ) ); + void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) { + m_translators.push_back( CATCH_MOVE( translator ) ); } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) std::string ExceptionTranslatorRegistry::translateActiveException() const { + // Compiling a mixed mode project with MSVC means that CLR + // exceptions will be caught in (...) as well. However, these do + // 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."; + } + + // First we try user-registered translators. If none of them can + // handle the exception, it will be rethrown handled by our defaults. 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(); } + // To avoid having to handle TFE explicitly everywhere, we just + // rethrow it so that it goes back up the caller. catch( TestFailureException& ) { std::rethrow_exception(std::current_exception()); } - catch( std::exception& ex ) { + catch( std::exception const& ex ) { return ex.what(); } - catch( std::string& msg ) { + catch( std::string const& msg ) { return msg; } catch( const char* msg ) { @@ -3669,39 +3632,80 @@ namespace Catch { +/** \file + * This file provides platform specific implementations of FatalConditionHandler + * + * This means that there is a lot of conditional compilation, and platform + * specific code. Currently, Catch2 supports a dummy handler (if no + * handler is desired), and 2 platform specific handlers: + * * Windows' SEH + * * POSIX signals + * + * Consequently, various pieces of code below are compiled if either of + * the platform specific handlers is enabled, or if none of them are + * enabled. It is assumed that both cannot be enabled at the same time, + * and doing so should cause a compilation error. + * + * If another platform specific handler is added, the compile guards + * below will need to be updated taking these assumptions into account. + */ -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif + + +#include <algorithm> + +#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + // If neither SEH nor signal handling is required, the handler impls + // do not have to do anything, and can be empty. + void FatalConditionHandler::engage_platform() {} + void FatalConditionHandler::disengage_platform() noexcept {} + FatalConditionHandler::FatalConditionHandler() = default; + FatalConditionHandler::~FatalConditionHandler() = default; + +} // end namespace Catch + +#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS ) +#error "Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time" +#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS #if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) namespace { - // Report the error condition + //! Signals fatal error message to the run context void reportFatal( char const * const message ) { Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); } -} -#endif // signals/SEH handling + //! Minimal size Catch2 needs for its own fatal error handling. + //! Picked empirically, so it might not be sufficient on all + //! platforms, and for all configurations. + constexpr std::size_t minStackSizeForErrors = 32 * 1024; +} // end unnamed namespace + +#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS #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" }, + { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, + { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, + { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, + { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, }; - LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { + static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) { for (auto const& def : signalDefs) { if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { reportFatal(def.name); @@ -3712,111 +3716,377 @@ namespace Catch { return EXCEPTION_CONTINUE_SEARCH; } + // Since we do not support multiple instantiations, we put these + // into global variables and rely on cleaning them up in outlined + // constructors/destructors + static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr; + + + // For MSVC, we reserve part of the stack memory for handling + // memory overflow structured exception. + FatalConditionHandler::FatalConditionHandler() { + ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors); + if (!SetThreadStackGuarantee(&guaranteeSize)) { + // We do not want to fully error out, because needing + // the stack reserve should be rare enough anyway. + Catch::cerr() + << "Failed to reserve piece of stack." + << " Stack overflows will not be reported successfully."; + } + } + + // We do not attempt to unset the stack guarantee, because + // Windows does not support lowering the stack size guarantee. + FatalConditionHandler::~FatalConditionHandler() = default; + + + void FatalConditionHandler::engage_platform() { + // Register as a the top level exception filter. + previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter); + } + + void FatalConditionHandler::disengage_platform() noexcept { + if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) { + Catch::cerr() + << "Unexpected SEH unhandled exception filter on disengage." + << " The filter was restored, but might be rolled back unexpectedly."; + } + previousTopLevelExceptionFilter = nullptr; + } + +} // end namespace Catch + +#endif // CATCH_CONFIG_WINDOWS_SEH + +#if defined( CATCH_CONFIG_POSIX_SIGNALS ) + +#include <signal.h> + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + +// Older GCCs trigger -Wmissing-field-initializers for T foo = {} +// which is zero initialization, but not explicit. We want to avoid +// that. +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + + static char* altStackMem = nullptr; + static std::size_t altStackSize = 0; + static stack_t oldSigStack{}; + static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{}; + + static void restorePreviousSignalHandlers() noexcept { + // We set signal handlers back to the previous ones. Hopefully + // nobody overwrote them in the meantime, and doesn't expect + // their signal handlers to live past ours given that they + // installed them after ours.. + 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); + } + + static void handleSignal( int sig ) { + char const * name = "<unknown signal>"; + for (auto const& def : signalDefs) { + if (sig == def.id) { + name = def.name; + break; + } + } + // We need to restore previous signal handlers and let them do + // their thing, so that the users can have the debugger break + // when a signal is raised, and so on. + restorePreviousSignalHandlers(); + reportFatal( name ); + raise( sig ); + } + 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); + assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); + if (altStackSize == 0) { + altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors); + } + altStackMem = new char[altStackSize](); + } + + FatalConditionHandler::~FatalConditionHandler() { + delete[] altStackMem; + // We signal that another instance can be constructed by zeroing + // out the pointer. + altStackMem = nullptr; + } + + void FatalConditionHandler::engage_platform() { + stack_t sigStack; + sigStack.ss_sp = altStackMem; + sigStack.ss_size = altStackSize; + 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) { - RemoveVectoredExceptionHandler(exceptionHandlerHandle); - SetThreadStackGuarantee(&guaranteeSize); - exceptionHandlerHandle = nullptr; - isSet = false; +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + + + void FatalConditionHandler::disengage_platform() noexcept { + restorePreviousSignalHandlers(); + } + +} // end namespace Catch + +#endif // CATCH_CONFIG_POSIX_SIGNALS + + + + +#include <cstring> + +namespace Catch { + namespace Detail { + + uint32_t convertToBits(float f) { + static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated"); + uint32_t i; + std::memcpy(&i, &f, sizeof(f)); + return i; + } + + uint64_t convertToBits(double d) { + static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated"); + uint64_t i; + std::memcpy(&i, &d, sizeof(d)); + return i; + } + + } // end namespace Detail +} // end namespace Catch + + + + + +#include <cstdio> +#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 override { + 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 ) { + if ( !str.empty() ) { + writeToDebugConsole( str ); + } + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class FileStream : public IStream { + std::ofstream m_ofs; + public: + FileStream( std::string const& 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() override { + return m_ofs; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class CoutStream : public IStream { + 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() override { return m_os; } + bool isConsole() const override { return true; } + }; + + class CerrStream : public IStream { + std::ostream m_os; + + public: + // Store the streambuf from cerr up-front because + // cout may get redirected when running tests + CerrStream(): m_os( Catch::cerr().rdbuf() ) {} + ~CerrStream() override = default; + + public: // IStream + std::ostream& stream() override { return m_os; } + bool isConsole() const override { return true; } + }; + + /////////////////////////////////////////////////////////////////////////// + + class DebugOutStream : public IStream { + Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; + 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() override { return m_os; } + }; + + } // unnamed namespace +} // namespace Detail + + /////////////////////////////////////////////////////////////////////////// + + auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream> { + if ( filename.empty() || filename == "-" ) { + return Detail::make_unique<Detail::CoutStream>(); + } + if( filename[0] == '%' ) { + if ( filename == "%debug" ) { + return Detail::make_unique<Detail::DebugOutStream>(); + } else if ( filename == "%stderr" ) { + return Detail::make_unique<Detail::CerrStream>(); + } else if ( filename == "%stdout" ) { + return Detail::make_unique<Detail::CoutStream>(); + } else { + CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' ); + } } + return Detail::make_unique<Detail::FileStream>( filename ); } -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; - }; + auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& { + if (lazyExpr.m_isNegated) + os << '!'; - // 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; + 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; + } - 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" } - }; +} // namespace Catch - 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]); - } - } +#ifdef CATCH_CONFIG_WINDOWS_CRTDBG +#include <crtdbg.h> - 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; - } - } +namespace Catch { - bool FatalConditionHandler::isSet = false; - struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; - stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[sigStackSize] = {}; + 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 -} // namespace Catch + Catch::LeakDetector::LeakDetector() {} -#endif // signals/SEH handling +#endif // CATCH_CONFIG_WINDOWS_CRTDBG -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif +Catch::LeakDetector::~LeakDetector() { + Catch::cleanUp(); +} @@ -3825,35 +4095,35 @@ namespace Catch { namespace Catch { namespace { - void listTests(IStreamingReporter& reporter, IConfig const& config) { + void listTests(IEventListener& reporter, IConfig const& config) { auto const& testSpec = config.testSpec(); auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); - reporter.listTests(matchedTestCases, config); + reporter.listTests(matchedTestCases); } - void listTags(IStreamingReporter& reporter, IConfig const& config) { + void listTags(IEventListener& reporter, IConfig const& config) { auto const& testSpec = config.testSpec(); std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); - std::map<StringRef, TagInfo> tagCounts; + std::map<StringRef, TagInfo, Detail::CaseInsensitiveLess> tagCounts; for (auto const& testCase : matchedTestCases) { for (auto const& tagName : testCase.getTestCaseInfo().tags) { - auto it = tagCounts.find(tagName.lowerCased); + auto it = tagCounts.find(tagName.original); if (it == tagCounts.end()) - it = tagCounts.insert(std::make_pair(tagName.lowerCased, TagInfo())).first; + it = tagCounts.insert(std::make_pair(tagName.original, 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)); + infos.push_back(CATCH_MOVE(tagc.second)); } - reporter.listTags(infos, config); + reporter.listTags(infos); } - void listReporters(IStreamingReporter& reporter, IConfig const& config) { + void listReporters(IEventListener& reporter) { std::vector<ReporterDescription> descriptions; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); @@ -3862,7 +4132,20 @@ namespace Catch { descriptions.push_back({ fac.first, fac.second->getDescription() }); } - reporter.listReporters(descriptions, config); + reporter.listReporters(descriptions); + } + + void listListeners(IEventListener& reporter) { + std::vector<ListenerDescription> descriptions; + + auto const& factories = + getRegistryHub().getReporterRegistry().getListeners(); + descriptions.reserve( factories.size() ); + for ( auto const& fac : factories ) { + descriptions.push_back( { fac->getName(), fac->getDescription() } ); + } + + reporter.listListeners( descriptions ); } } // end anonymous namespace @@ -3888,7 +4171,7 @@ namespace Catch { return out; } - bool list( IStreamingReporter& reporter, Config const& config ) { + bool list( IEventListener& reporter, Config const& config ) { bool listed = false; if (config.listTests()) { listed = true; @@ -3900,7 +4183,11 @@ namespace Catch { } if (config.listReporters()) { listed = true; - listReporters(reporter, config); + listReporters(reporter); + } + if ( config.listListeners() ) { + listed = true; + listListeners( reporter ); } return listed; } @@ -3912,13 +4199,16 @@ namespace Catch { namespace Catch { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS - LeakDetector leakDetector; + static LeakDetector leakDetector; CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION } +// Allow users of amalgamated .cpp file to remove our main and provide their own. +#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN) + #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 * []) { +extern "C" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) { #else // Standard C/C++ main entry point int main (int argc, char * argv[]) { @@ -3931,6 +4221,27 @@ int main (int argc, char * argv[]) { return Catch::Session().run( argc, argv ); } +#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN + + + + +namespace Catch { + + MessageInfo::MessageInfo( StringRef _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 + #include <cstdio> @@ -4071,6 +4382,32 @@ namespace Catch { + +#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 + + + namespace Catch { namespace { @@ -4136,36 +4473,67 @@ namespace { + +#include <ctime> +#include <random> + +namespace Catch { + + std::uint32_t generateRandomSeed( GenerateFrom from ) { + switch ( from ) { + case GenerateFrom::Time: + return static_cast<std::uint32_t>( std::time( nullptr ) ); + + case GenerateFrom::Default: + case GenerateFrom::RandomDevice: + // In theory, a platform could have random_device that returns just + // 16 bits. That is still some randomness, so we don't care too much + return static_cast<std::uint32_t>( std::random_device{}() ); + + default: + CATCH_ERROR("Unknown generation method"); + } + } + +} // end namespace Catch + + + + 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["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>>(); + 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 { + IEventListenerPtr ReporterRegistry::create( std::string const& name, ReporterConfig&& config ) const { auto it = m_factories.find( name ); if( it == m_factories.end() ) return nullptr; - return it->second->create( ReporterConfig( config ) ); + return it->second->create( CATCH_MOVE(config) ); } void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) { - m_factories.emplace(name, std::move(factory)); + CATCH_ENFORCE( name.find( "::" ) == name.npos, + "'::' is not allowed in reporter name: '" + name + '\'' ); + auto ret = m_factories.emplace(name, CATCH_MOVE(factory)); + CATCH_ENFORCE( ret.second, "reporter using '" + name + "' as name was already registered" ); } - void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) { - m_listeners.push_back( std::move(factory) ); + void ReporterRegistry::registerListener( + Detail::unique_ptr<EventListenerFactory> factory ) { + m_listeners.push_back( CATCH_MOVE(factory) ); } IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { @@ -4179,6 +4547,171 @@ namespace Catch { + + +#include <algorithm> + +namespace Catch { + + namespace { + struct kvPair { + StringRef key, value; + }; + + kvPair splitKVPair(StringRef kvString) { + auto splitPos = static_cast<size_t>( std::distance( + kvString.begin(), + std::find( kvString.begin(), kvString.end(), '=' ) ) ); + + return { kvString.substr( 0, splitPos ), + kvString.substr( splitPos + 1, kvString.size() ) }; + } + } + + namespace Detail { + std::vector<std::string> splitReporterSpec( StringRef reporterSpec ) { + static constexpr auto separator = "::"; + static constexpr size_t separatorSize = 2; + + size_t separatorPos = 0; + auto findNextSeparator = [&reporterSpec]( size_t startPos ) { + static_assert( + separatorSize == 2, + "The code below currently assumes 2 char separator" ); + + auto currentPos = startPos; + do { + while ( currentPos < reporterSpec.size() && + reporterSpec[currentPos] != separator[0] ) { + ++currentPos; + } + if ( currentPos + 1 < reporterSpec.size() && + reporterSpec[currentPos + 1] == separator[1] ) { + return currentPos; + } + ++currentPos; + } while ( currentPos < reporterSpec.size() ); + + return static_cast<size_t>( -1 ); + }; + + std::vector<std::string> parts; + + while ( separatorPos < reporterSpec.size() ) { + const auto nextSeparator = findNextSeparator( separatorPos ); + parts.push_back( static_cast<std::string>( reporterSpec.substr( + separatorPos, nextSeparator - separatorPos ) ) ); + + if ( nextSeparator == static_cast<size_t>( -1 ) ) { + break; + } + separatorPos = nextSeparator + separatorSize; + } + + // Handle a separator at the end. + // This is not a valid spec, but we want to do validation in a + // centralized place + if ( separatorPos == reporterSpec.size() ) { + parts.emplace_back(); + } + + return parts; + } + + Optional<ColourMode> stringToColourMode( StringRef colourMode ) { + if ( colourMode == "default" ) { + return ColourMode::PlatformDefault; + } else if ( colourMode == "ansi" ) { + return ColourMode::ANSI; + } else if ( colourMode == "win32" ) { + return ColourMode::Win32; + } else if ( colourMode == "none" ) { + return ColourMode::None; + } else { + return {}; + } + } + } // namespace Detail + + + bool operator==( ReporterSpec const& lhs, ReporterSpec const& rhs ) { + return lhs.m_name == rhs.m_name && + lhs.m_outputFileName == rhs.m_outputFileName && + lhs.m_colourMode == rhs.m_colourMode && + lhs.m_customOptions == rhs.m_customOptions; + } + + Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ) { + auto parts = Detail::splitReporterSpec( reporterSpec ); + + assert( parts.size() > 0 && "Split should never return empty vector" ); + + std::map<std::string, std::string> kvPairs; + Optional<std::string> outputFileName; + Optional<ColourMode> colourMode; + + // First part is always reporter name, so we skip it + for ( size_t i = 1; i < parts.size(); ++i ) { + auto kv = splitKVPair( parts[i] ); + auto key = kv.key, value = kv.value; + + if ( key.empty() || value.empty() ) { + return {}; + } else if ( key[0] == 'X' ) { + // This is a reporter-specific option, we don't check these + // apart from basic sanity checks + if ( key.size() == 1 ) { + return {}; + } + + auto ret = kvPairs.emplace( std::string(kv.key), std::string(kv.value) ); + if ( !ret.second ) { + // Duplicated key. We might want to handle this differently, + // e.g. by overwriting the existing value? + return {}; + } + } else if ( key == "out" ) { + // Duplicated key + if ( outputFileName ) { + return {}; + } + outputFileName = static_cast<std::string>( value ); + } else if ( key == "colour-mode" ) { + // Duplicated key + if ( colourMode ) { + return {}; + } + colourMode = Detail::stringToColourMode( value ); + // Parsing failed + if ( !colourMode ) { + return {}; + } + } else { + // Unrecognized option + return {}; + } + } + + return ReporterSpec{ CATCH_MOVE( parts[0] ), + CATCH_MOVE( outputFileName ), + CATCH_MOVE( colourMode ), + CATCH_MOVE( kvPairs ) }; + } + +ReporterSpec::ReporterSpec( + std::string name, + Optional<std::string> outputFileName, + Optional<ColourMode> colourMode, + std::map<std::string, std::string> customOptions ): + m_name( CATCH_MOVE( name ) ), + m_outputFileName( CATCH_MOVE( outputFileName ) ), + m_colourMode( CATCH_MOVE( colourMode ) ), + m_customOptions( CATCH_MOVE( customOptions ) ) {} + +} // namespace Catch + + + namespace Catch { bool isOk( ResultWas::OfType resultType ) { @@ -4188,14 +4721,68 @@ namespace Catch { 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 ) ); + 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 <cstdio> +#include <sstream> +#include <vector> + +namespace Catch { + + // 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::make_unique<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 ); } - bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } - bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } -} // end namespace Catch +} @@ -4212,10 +4799,10 @@ namespace Catch { GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : TrackerBase( nameAndLocation, ctx, parent ) {} - ~GeneratorTracker(); + ~GeneratorTracker() override; static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { - std::shared_ptr<GeneratorTracker> tracker; + GeneratorTracker* tracker; ITracker& currentTracker = ctx.currentTracker(); // Under specific circumstances, the generator we want @@ -4229,18 +4816,23 @@ namespace Catch { // } // // 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 ) ) { + 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 = std::static_pointer_cast<GeneratorTracker>( childTracker ); + tracker = static_cast<GeneratorTracker*>( childTracker ); } else { - tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker ); - currentTracker.addChild( tracker ); + auto newTracker = + Catch::Detail::make_unique<GeneratorTracker>( + nameAndLocation, ctx, ¤tTracker ); + tracker = newTracker.get(); + currentTracker.addChild( CATCH_MOVE(newTracker) ); } if( !tracker->isComplete() ) { @@ -4264,13 +4856,53 @@ namespace Catch { // `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(); + 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 @@ -4278,7 +4910,7 @@ namespace Catch { // this generator is still waiting for any child to start. if ( should_wait_for_child || ( m_runState == CompletedSuccessfully && - m_generator->next() ) ) { + m_generator->countedNext() ) ) { m_children.clear(); m_runState = Executing; } @@ -4289,21 +4921,20 @@ namespace Catch { return m_generator; } void setGenerator( GeneratorBasePtr&& generator ) override { - m_generator = std::move( generator ); + m_generator = CATCH_MOVE( generator ); } }; - GeneratorTracker::~GeneratorTracker() {} + GeneratorTracker::~GeneratorTracker() = default; } - RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter) + RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter) : m_runInfo(_config->name()), m_context(getCurrentMutableContext()), m_config(_config), - m_reporter(std::move(reporter)), + m_reporter(CATCH_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); } @@ -4312,16 +4943,8 @@ namespace Catch { 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; + const Totals prevTotals = m_totals; std::string redirectedCout; std::string redirectedCerr; @@ -4336,10 +4959,58 @@ namespace Catch { ITracker& rootTracker = m_trackerContext.startRun(); assert(rootTracker.isSectionTracker()); static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + + // We intentionally only seed the internal RNG once per test case, + // before it is first invoked. The reason for that is a complex + // interplay of generator/section implementation details and the + // Random*Generator types. + // + // The issue boils down to us needing to seed the Random*Generators + // with different seed each, so that they return different sequences + // of random numbers. We do this by giving them a number from the + // shared RNG instance as their seed. + // + // However, this runs into an issue if the reseeding happens each + // time the test case is entered (as opposed to first time only), + // because multiple generators could get the same seed, e.g. in + // ```cpp + // TEST_CASE() { + // auto i = GENERATE(take(10, random(0, 100)); + // SECTION("A") { + // auto j = GENERATE(take(10, random(0, 100)); + // } + // SECTION("B") { + // auto k = GENERATE(take(10, random(0, 100)); + // } + // } + // ``` + // `i` and `j` would properly return values from different sequences, + // but `i` and `k` would return the same sequence, because their seed + // would be the same. + // (The reason their seeds would be the same is that the generator + // for k would be initialized when the test case is entered the second + // time, after the shared RNG instance was reset to the same value + // it had when the generator for i was initialized.) + seedRng( *m_config ); + + uint64_t testRuns = 0; do { m_trackerContext.startCycle(); m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); - runCurrentTest(redirectedCout, redirectedCerr); + + m_reporter->testCasePartialStarting(testInfo, testRuns); + + const auto beforeRunTotals = m_totals; + std::string oneRunCout, oneRunCerr; + runCurrentTest(oneRunCout, oneRunCerr); + redirectedCout += oneRunCout; + redirectedCerr += oneRunCerr; + + const auto singleRunTotals = m_totals.delta(beforeRunTotals); + auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, oneRunCout, oneRunCerr, aborting()); + + m_reporter->testCasePartialEnded(statsForOneRun, testRuns); + ++testRuns; } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); Totals deltaTotals = m_totals.delta(prevTotals); @@ -4366,9 +5037,11 @@ namespace Catch { if (result.getResultType() == ResultWas::Ok) { m_totals.assertions.passed++; m_lastAssertionPassed = true; - } else if (!result.isOk()) { + } else if (!result.succeeded()) { m_lastAssertionPassed = false; - if( m_activeTestCase->getTestCaseInfo().okToFail() ) + if (result.isOk()) { + } + else if( m_activeTestCase->getTestCaseInfo().okToFail() ) m_totals.assertions.failedButOk++; else m_totals.assertions.failed++; @@ -4377,9 +5050,7 @@ namespace Catch { 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))); + m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)); if (result.getResultType() != ResultWas::Warning) m_messageScopes.clear(); @@ -4451,7 +5122,7 @@ namespace Catch { m_unfinishedSections.push_back(endInfo); } - void RunContext::benchmarkPreparing(std::string const& name) { + void RunContext::benchmarkPreparing( StringRef name ) { m_reporter->benchmarkPreparing(name); } void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { @@ -4460,8 +5131,8 @@ namespace Catch { void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) { m_reporter->benchmarkEnded( stats ); } - void RunContext::benchmarkFailed(std::string const & error) { - m_reporter->benchmarkFailed(error); + void RunContext::benchmarkFailed( StringRef error ) { + m_reporter->benchmarkFailed( error ); } void RunContext::pushScopedMessage(MessageInfo const & message) { @@ -4524,7 +5195,6 @@ namespace Catch { std::string(), false)); m_totals.testCases.failed++; - testGroupEnded(std::string(), m_totals, 1, 1); m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); } @@ -4552,8 +5222,6 @@ namespace Catch { 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) { @@ -4595,10 +5263,15 @@ namespace Catch { } void RunContext::invokeActiveTestCase() { - // We need to register a handler for signals/structured exceptions + // We need to engage a handler for signals/structured exceptions // before running the tests themselves, or the binary can crash // without failed test being reported. - FatalConditionHandler _; + FatalConditionHandlerGuard _(&m_fatalConditionhandler); + // We keep having issue where some compilers warn about an unused + // variable, even though the type has non-trivial constructor and + // destructor. This is annoying and ugly, but it makes them stfu. + (void)_; + m_activeTestCase->invoke(); } @@ -4654,7 +5327,7 @@ namespace Catch { void RunContext::handleMessage( AssertionInfo const& info, ResultWas::OfType resultType, - StringRef const& message, + StringRef message, AssertionReaction& reaction ) { m_reporter->assertionStarting( info ); @@ -4728,10 +5401,7 @@ namespace Catch { } void seedRng(IConfig const& config) { - if (config.rngSeed() != 0) { - std::srand(config.rngSeed()); - rng().seed(config.rngSeed()); - } + sharedRng().seed(config.rngSeed()); } unsigned int rngSeed() { @@ -4742,12 +5412,10 @@ namespace Catch { -#include <utility> - namespace Catch { Section::Section( SectionInfo&& info ): - m_info( std::move( info ) ), + m_info( CATCH_MOVE( info ) ), m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) { // Non-"included" sections will not use the timing information @@ -4790,7 +5458,7 @@ namespace Catch { } } - ISingleton::~ISingleton() {} + ISingleton::~ISingleton() = default; void addSingleton(ISingleton* singleton ) { getSingletons()->push_back( singleton ); @@ -4807,182 +5475,68 @@ namespace Catch { -#include <cstdio> -#include <iostream> -#include <fstream> -#include <sstream> -#include <vector> +#include <cstring> +#include <ostream> 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; } - }; - - /////////////////////////////////////////////////////////////////////////// + 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)); + } - 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() ) - {} + 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; + } - ~DebugOutStream() override = default; +} // end namespace Catch - 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 << "'" ); +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(); } - else - return new Detail::FileStream( filename ); } + std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept { + return m_exceptions; + } +#endif - // 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() ) - {} +} // end namespace Catch - 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 ); - } - /////////////////////////////////////////////////////////////////////////// +#include <iostream> +namespace Catch { -#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions +// If you #define this you must implement these functions +#if !defined( CATCH_CONFIG_NOSTDOUT ) std::ostream& cout() { return std::cout; } std::ostream& cerr() { return std::cerr; } std::ostream& clog() { return std::clog; } #endif -} + +} // namespace Catch @@ -4994,16 +5548,10 @@ namespace Detail { 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 ) { + bool startsWith( StringRef s, char prefix ) { return !s.empty() && s[0] == prefix; } bool endsWith( std::string const& s, std::string const& suffix ) { @@ -5016,13 +5564,19 @@ namespace Catch { return s.find( infix ) != std::string::npos; } void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + std::transform( s.begin(), s.end(), s.begin(), []( char c ) { + return toLower( c ); + } ); } std::string toLower( std::string const& s ) { std::string lc = s; toLowerInPlace( lc ); return lc; } + char toLower(char c) { + return static_cast<char>(std::tolower(static_cast<unsigned char>(c))); + } + 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 ); @@ -5072,11 +5626,6 @@ namespace Catch { 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 ) @@ -5095,28 +5644,44 @@ namespace Catch { namespace Catch { StringRef::StringRef( char const* rawChars ) noexcept - : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) + : StringRef( rawChars, 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 { + auto StringRef::operator == ( StringRef 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 { + bool StringRef::operator<(StringRef 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()); + int StringRef::compare( StringRef rhs ) const { + auto cmpResult = + strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) ); + + // This means that strncmp found a difference before the strings + // ended, and we can return it directly + if ( cmpResult != 0 ) { + return cmpResult; + } + + // If strings are equal up to length, then their comparison results on + // their size + if ( m_size < rhs.m_size ) { + return -1; + } else if ( m_size > rhs.m_size ) { + return 1; + } else { + return 0; + } + } + + auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& { + return os.write(str.data(), static_cast<std::streamsize>(str.size())); } std::string operator+(StringRef lhs, StringRef rhs) { @@ -5127,7 +5692,7 @@ namespace Catch { return ret; } - auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& { lhs.append(rhs.data(), rhs.size()); return lhs; } @@ -5171,7 +5736,7 @@ namespace Catch { << "\tRedefined at: " << lineInfo ); } - ITagAliasRegistry::~ITagAliasRegistry() {} + ITagAliasRegistry::~ITagAliasRegistry() = default; ITagAliasRegistry const& ITagAliasRegistry::get() { return getRegistryHub().getTagAliasRegistry(); @@ -5182,33 +5747,42 @@ 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) { + TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {} + + uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const { + // FNV-1a hash algorithm that is designed for uniqueness: + const hash_t prime = 1099511628211u; + hash_t hash = 14695981039346656037u; + for ( const char c : t.name ) { + hash ^= c; + hash *= prime; + } + for ( const char c : t.className ) { + hash ^= c; + hash *= prime; + } + for ( const Tag& tag : t.tags ) { + for ( const char c : tag.original ) { hash ^= c; hash *= prime; } - return hash; } - }; -} // end anonymous namespace + hash ^= m_seed; + hash *= prime; + const uint32_t low{ static_cast<uint32_t>( hash ) }; + const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) }; + return low * high; + } +} // namespace Catch + + + + +#include <algorithm> +#include <set> + +namespace Catch { std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) { switch (config.runOrder()) { @@ -5217,20 +5791,36 @@ namespace { case TestRunOrder::LexicographicallySorted: { std::vector<TestCaseHandle> sorted = unsortedTestCases; - std::sort(sorted.begin(), sorted.end()); + std::sort( + sorted.begin(), + sorted.end(), + []( TestCaseHandle const& lhs, TestCaseHandle const& rhs ) { + return lhs.getTestCaseInfo() < rhs.getTestCaseInfo(); + } + ); return sorted; } case TestRunOrder::Randomized: { seedRng(config); - HashTest h(rng()); - std::vector<std::pair<uint64_t, TestCaseHandle>> indexed_tests; + using TestWithHash = std::pair<TestCaseInfoHasher::hash_t, TestCaseHandle>; + + TestCaseInfoHasher h{ config.rngSeed() }; + std::vector<TestWithHash> 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::sort( indexed_tests.begin(), + indexed_tests.end(), + []( TestWithHash const& lhs, TestWithHash const& rhs ) { + if ( lhs.first == rhs.first ) { + return lhs.second.getTestCaseInfo() < + rhs.second.getTestCaseInfo(); + } + return lhs.first < rhs.first; + } ); std::vector<TestCaseHandle> randomized; randomized.reserve(indexed_tests.size()); @@ -5254,14 +5844,22 @@ namespace { 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 ); + void + enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& tests ) { + auto testInfoCmp = []( TestCaseInfo const* lhs, + TestCaseInfo const* rhs ) { + return *lhs < *rhs; + }; + std::set<TestCaseInfo const*, decltype(testInfoCmp)> seenTests(testInfoCmp); + for ( auto const& test : tests ) { + const auto infoPtr = &test.getTestCaseInfo(); + const auto prev = seenTests.insert( infoPtr ); + CATCH_ENFORCE( + prev.second, + "error: test case \"" << infoPtr->name << "\", with tags \"" + << infoPtr->tagsAsString() << "\" already defined.\n" + << "\tFirst seen at " << ( *prev.first )->lineInfo << "\n" + << "\tRedefined at " << infoPtr->lineInfo ); } } @@ -5274,7 +5872,7 @@ namespace { filtered.push_back(testCase); } } - return filtered; + return createShard(filtered, config.shardCount(), config.shardIndex()); } std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) { return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); @@ -5283,8 +5881,8 @@ namespace { 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)); + m_owned_test_infos.push_back(CATCH_MOVE(testInfo)); + m_invokers.push_back(CATCH_MOVE(testInvoker)); } std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const { @@ -5312,19 +5910,6 @@ namespace { 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 @@ -5332,7 +5917,6 @@ namespace { #include <algorithm> #include <cassert> -#include <memory> #if defined(__clang__) # pragma clang diagnostic push @@ -5350,11 +5934,15 @@ namespace TestCaseTracking { ITracker::~ITracker() = default; - void ITracker::addChild( ITrackerPtr const& child ) { - m_children.push_back( child ); + void ITracker::markAsNeedingAnotherRun() { + m_runState = NeedsAnotherRun; + } + + void ITracker::addChild( ITrackerPtr&& child ) { + m_children.push_back( CATCH_MOVE(child) ); } - ITrackerPtr ITracker::findChild( NameAndLocation const& nameAndLocation ) { + ITracker* ITracker::findChild( NameAndLocation const& nameAndLocation ) { auto it = std::find_if( m_children.begin(), m_children.end(), @@ -5363,14 +5951,37 @@ namespace TestCaseTracking { nameAndLocation.location && tracker->nameAndLocation().name == nameAndLocation.name; } ); - return ( it != m_children.end() ) ? *it : nullptr; + return ( it != m_children.end() ) ? it->get() : nullptr; } + bool ITracker::isSectionTracker() const { return false; } + bool ITracker::isGeneratorTracker() const { return false; } + bool ITracker::isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } + + bool ITracker::isOpen() const { + return m_runState != NotStarted && !isComplete(); + } + + bool ITracker::hasStarted() const { return m_runState != NotStarted; } + + void ITracker::openChild() { + if (m_runState != ExecutingChildren) { + m_runState = ExecutingChildren; + if (m_parent) { + m_parent->openChild(); + } + } + } ITracker& TrackerContext::startRun() { using namespace std::string_literals; - m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}"s, CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_rootTracker = Catch::Detail::make_unique<SectionTracker>( + NameAndLocation( "{root}"s, CATCH_INTERNAL_LINEINFO ), + *this, + nullptr ); m_currentTracker = nullptr; m_runState = Executing; return *m_rootTracker; @@ -5402,36 +6013,13 @@ namespace TestCaseTracking { TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): - ITracker(nameAndLocation), - m_ctx( ctx ), - m_parent( parent ) + ITracker(nameAndLocation, parent), + m_ctx( ctx ) {} 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; @@ -5476,9 +6064,6 @@ namespace TestCaseTracking { moveToParent(); m_ctx.completeCycle(); } - void TrackerBase::markAsNeedingAnotherRun() { - m_runState = NeedsAnotherRun; - } void TrackerBase::moveToParent() { assert( m_parent ); @@ -5494,7 +6079,7 @@ namespace TestCaseTracking { { if( parent ) { while( !parent->isSectionTracker() ) - parent = &parent->parent(); + parent = parent->parent(); SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); addNextFilters( parentSection.m_filters ); @@ -5505,7 +6090,7 @@ namespace TestCaseTracking { bool complete = true; if (m_filters.empty() - || m_filters[0] == "" + || m_filters[0].empty() || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) { complete = TrackerBase::isComplete(); } @@ -5515,17 +6100,19 @@ namespace TestCaseTracking { bool SectionTracker::isSectionTracker() const { return true; } SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { - std::shared_ptr<SectionTracker> section; + SectionTracker* section; ITracker& currentTracker = ctx.currentTracker(); - if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + if ( ITracker* 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 ); + section = static_cast<SectionTracker*>( childTracker ); + } else { + auto newSection = Catch::Detail::make_unique<SectionTracker>( + nameAndLocation, ctx, ¤tTracker ); + section = newSection.get(); + currentTracker.addChild( CATCH_MOVE( newSection ) ); } if( !ctx.completedCycle() ) section->tryOpen(); @@ -5540,21 +6127,25 @@ namespace TestCaseTracking { 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.emplace_back(StringRef{}); // Root - should never be consulted + m_filters.emplace_back(StringRef{}); // 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 ) { + void SectionTracker::addNextFilters( std::vector<StringRef> const& filters ) { if( filters.size() > 1 ) m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); } -} // namespace TestCaseTracking + std::vector<StringRef> const& SectionTracker::getFilters() const { + return m_filters; + } + + StringRef SectionTracker::trimmedName() const { + return m_trimmed_name; + } -using TestCaseTracking::ITracker; -using TestCaseTracking::TrackerContext; -using TestCaseTracking::SectionTracker; +} // namespace TestCaseTracking } // namespace Catch @@ -5564,13 +6155,46 @@ using TestCaseTracking::SectionTracker; +#include <algorithm> +#include <iterator> + namespace Catch { + namespace { + StringRef extractClassName( StringRef classOrMethodName ) { + if ( !startsWith( classOrMethodName, '&' ) ) { + return classOrMethodName; + } + + // Remove the leading '&' to avoid having to special case it later + const auto methodName = + classOrMethodName.substr( 1, classOrMethodName.size() ); + + auto reverseStart = std::make_reverse_iterator( methodName.end() ); + auto reverseEnd = std::make_reverse_iterator( methodName.begin() ); + + // We make a simplifying assumption that ":" is only present + // in the input as part of "::" from C++ typenames (this is + // relatively safe assumption because the input is generated + // as stringification of type through preprocessor). + auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1; + auto secondLastColons = + std::find( lastColons + 1, reverseEnd, ':' ); + + auto const startIdx = reverseEnd - secondLastColons; + auto const classNameSize = secondLastColons - lastColons - 1; + + return methodName.substr( + static_cast<std::size_t>( startIdx ), + static_cast<std::size_t>( classNameSize ) ); + } + } // namespace + Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) { - return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsFunction( testAsFunction )); + return Detail::make_unique<TestInvokerAsFunction>( testAsFunction ); } - AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept { CATCH_TRY { getMutableRegistryHub() .registerTest( @@ -5578,7 +6202,7 @@ namespace Catch { extractClassName( classOrMethod ), nameAndTags, lineInfo), - std::move(invoker) + CATCH_MOVE(invoker) ); } CATCH_CATCH_ALL { // Do not throw when constructing global objects, instead register the exception to be processed later @@ -5607,7 +6231,7 @@ namespace Catch { 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); + m_testSpec.m_invalidSpecs.push_back(arg); break; } endMode(); @@ -5615,7 +6239,7 @@ namespace Catch { } TestSpec TestSpecParser::testSpec() { addFilter(); - return std::move(m_testSpec); + return CATCH_MOVE(m_testSpec); } bool TestSpecParser::visitChar( char c ) { if( (m_mode != EscapedName) && (c == '\\') ) { @@ -5731,7 +6355,7 @@ namespace Catch { 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_testSpec.m_filters.push_back( CATCH_MOVE(m_currentFilter) ); m_currentFilter = TestSpec::Filter(); } } @@ -5824,6 +6448,8 @@ namespace Catch { } // namespace Catch + +#include <algorithm> #include <cstring> #include <ostream> @@ -5857,96 +6483,107 @@ namespace { namespace Catch { namespace TextFlow { - void Column::iterator::calcLength() { - m_suffix = false; - auto width = m_column.m_width - indent(); - m_end = m_pos; + void Column::const_iterator::calcLength() { + m_addHyphen = false; + m_parsedTo = m_lineStart; + std::string const& current_line = m_column.m_string; - if ( current_line[m_pos] == '\n' ) { - ++m_end; + if ( current_line[m_lineStart] == '\n' ) { + ++m_parsedTo; } - while ( m_end < current_line.size() && - current_line[m_end] != '\n' ) { - ++m_end; + + const auto maxLineLength = m_column.m_width - indentSize(); + const auto maxParseTo = std::min(current_line.size(), m_lineStart + maxLineLength); + while ( m_parsedTo < maxParseTo && + current_line[m_parsedTo] != '\n' ) { + ++m_parsedTo; } - if ( m_end < m_pos + width ) { - m_len = m_end - m_pos; + // If we encountered a newline before the column is filled, + // then we linebreak at the newline and consider this line + // finished. + if ( m_parsedTo < m_lineStart + maxLineLength ) { + m_lineLength = m_parsedTo - m_lineStart; } else { - size_t len = width; - while ( len > 0 && !isBoundary( current_line, m_pos + len ) ) { - --len; + // Look for a natural linebreak boundary in the column + // (We look from the end, so that the first found boundary is + // the right one) + size_t newLineLength = maxLineLength; + while ( newLineLength > 0 && !isBoundary( current_line, m_lineStart + newLineLength ) ) { + --newLineLength; } - while ( len > 0 && - isWhitespace( current_line[m_pos + len - 1] ) ) { - --len; + while ( newLineLength > 0 && + isWhitespace( current_line[m_lineStart + newLineLength - 1] ) ) { + --newLineLength; } - if ( len > 0 ) { - m_len = len; + // If we found one, then that is where we linebreak + if ( newLineLength > 0 ) { + m_lineLength = newLineLength; } else { - m_suffix = true; - m_len = width - 1; + // Otherwise we have to split text with a hyphen + m_addHyphen = true; + m_lineLength = maxLineLength - 1; } } } - size_t Column::iterator::indent() const { + size_t Column::const_iterator::indentSize() const { auto initial = - m_pos == 0 ? m_column.m_initialIndent : std::string::npos; + m_lineStart == 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, + Column::const_iterator::addIndentAndSuffix( size_t position, size_t length ) const { std::string ret; - const auto desired_indent = indent(); - ret.reserve( desired_indent + length + m_suffix ); + const auto desired_indent = indentSize(); + ret.reserve( desired_indent + length + m_addHyphen ); ret.append( desired_indent, ' ' ); ret.append( m_column.m_string, position, length ); - if ( m_suffix ) { + if ( m_addHyphen ) { ret.push_back( '-' ); } return ret; } - Column::iterator::iterator( Column const& column ): m_column( column ) { + Column::const_iterator::const_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(); + if ( m_lineLength == 0 ) { + m_lineStart = m_column.m_string.size(); } } - std::string Column::iterator::operator*() const { - assert( m_pos <= m_end ); - return addIndentAndSuffix( m_pos, m_len ); + std::string Column::const_iterator::operator*() const { + assert( m_lineStart <= m_parsedTo ); + return addIndentAndSuffix( m_lineStart, m_lineLength ); } - Column::iterator& Column::iterator::operator++() { - m_pos += m_len; + Column::const_iterator& Column::const_iterator::operator++() { + m_lineStart += m_lineLength; std::string const& current_line = m_column.m_string; - if ( m_pos < current_line.size() && current_line[m_pos] == '\n' ) { - m_pos += 1; + if ( m_lineStart < current_line.size() && current_line[m_lineStart] == '\n' ) { + m_lineStart += 1; } else { - while ( m_pos < current_line.size() && - isWhitespace( current_line[m_pos] ) ) { - ++m_pos; + while ( m_lineStart < current_line.size() && + isWhitespace( current_line[m_lineStart] ) ) { + ++m_lineStart; } } - if ( m_pos != current_line.size() ) { + if ( m_lineStart != current_line.size() ) { calcLength(); } return *this; } - Column::iterator Column::iterator::operator++( int ) { - iterator prev( *this ); + Column::const_iterator Column::const_iterator::operator++( int ) { + const_iterator prev( *this ); operator++(); return prev; } @@ -6061,6 +6698,23 @@ namespace Catch { + +#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 + + + namespace Catch { WildcardPattern::WildcardPattern( std::string const& pattern, @@ -6099,7 +6753,9 @@ namespace Catch { } - +// Note: swapping these two includes around causes MSVC to error out +// while in /permissive- mode. No, I don't know why. +// Tested on VS 2019, 18.{3, 4}.x #include <iomanip> #include <type_traits> @@ -6167,7 +6823,7 @@ namespace { } - XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) + XmlEncode::XmlEncode( StringRef str, ForWhat forWhat ) : m_str( str ), m_forWhat( forWhat ) {} @@ -6177,7 +6833,7 @@ namespace { // (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]; + unsigned char c = static_cast<unsigned char>(m_str[idx]); switch (c) { case '<': os << "<"; break; case '&': os << "&"; break; @@ -6237,7 +6893,7 @@ namespace { bool valid = true; uint32_t value = headerValue(c); for (std::size_t n = 1; n < encBytes; ++n) { - unsigned char nc = m_str[idx + n]; + unsigned char nc = static_cast<unsigned char>(m_str[idx + n]); valid &= ((nc & 0xC0) == 0x80); value = (value << 6) | (nc & 0x3F); } @@ -6301,11 +6957,20 @@ namespace { } } - XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { + XmlWriter::ScopedElement& + XmlWriter::ScopedElement::writeText( StringRef text, XmlFormatting fmt ) { m_writer->writeText( text, fmt ); return *this; } + XmlWriter::ScopedElement& + XmlWriter::ScopedElement::writeAttribute( StringRef name, + StringRef attribute ) { + m_writer->writeAttribute( name, attribute ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) { writeDeclaration(); @@ -6349,7 +7014,7 @@ namespace { if (shouldIndent(fmt)) { m_os << m_indent; } - m_os << "</" << m_tags.back() << ">"; + m_os << "</" << m_tags.back() << '>'; } m_os << std::flush; applyFormatting(fmt); @@ -6357,48 +7022,50 @@ namespace { return *this; } - XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { + XmlWriter& XmlWriter::writeAttribute( StringRef name, + StringRef 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" ) << '"'; + XmlWriter& XmlWriter::writeAttribute( StringRef name, bool attribute ) { + writeAttribute(name, (attribute ? "true"_sr : "false"_sr)); + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( StringRef name, + char const* attribute ) { + writeAttribute( name, StringRef( attribute ) ); return *this; } - XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) { + XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) { + CATCH_ENFORCE(!m_tags.empty(), "Cannot write text as top level element"); if( !text.empty() ){ bool tagWasOpen = m_tagIsOpen; ensureTagClosed(); if (tagWasOpen && shouldIndent(fmt)) { m_os << m_indent; } - m_os << XmlEncode( text ); + m_os << XmlEncode( text, XmlEncode::ForTextNodes ); applyFormatting(fmt); } return *this; } - XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { + XmlWriter& XmlWriter::writeComment( StringRef text, XmlFormatting fmt ) { ensureTagClosed(); if (shouldIndent(fmt)) { m_os << m_indent; } - m_os << "<!--" << text << "-->"; + 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::writeStylesheetRef( StringRef url ) { + m_os << R"(<?xml-stylesheet type="text/xsl" href=")" << url << R"("?>)" << '\n'; } void XmlWriter::ensureTagClosed() { @@ -6414,12 +7081,12 @@ namespace { } void XmlWriter::writeDeclaration() { - m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + m_os << R"(<?xml version="1.0" encoding="UTF-8"?>)" << '\n'; } void XmlWriter::newlineIfNecessary() { if( m_needsNewline ) { - m_os << std::endl; + m_os << '\n' << std::flush; m_needsNewline = false; } } @@ -6427,11 +7094,76 @@ namespace { + + +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 + + + + +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 + + + +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 <algorithm> #include <cmath> #include <cstdlib> #include <cstdint> -#include <cstring> #include <sstream> #include <iomanip> #include <limits> @@ -6440,20 +7172,6 @@ namespace { 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. @@ -6462,16 +7180,10 @@ namespace { 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; - } + // This should also handle positive and negative zeros, infinities + const auto ulpDist = ulpDistance(lhs, rhs); - auto ulpDiff = std::abs(lc - rc); - return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff; + return ulpDist <= maxUlpDiff; } #if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) @@ -6546,6 +7258,9 @@ namespace Detail { CATCH_ENFORCE(m_type == Detail::FloatingPointKind::Double || m_ulps < (std::numeric_limits<uint32_t>::max)(), "Provided ULP is impossibly large for a float comparison."); + CATCH_ENFORCE( std::numeric_limits<double>::is_iec559, + "WithinUlp matcher only supports platforms with " + "IEEE-754 compatible floating point representation" ); } #if defined(__clang__) @@ -6583,14 +7298,26 @@ namespace Detail { ret << " (["; if (m_type == Detail::FloatingPointKind::Double) { - write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps)); + write( ret, + step( m_target, + -std::numeric_limits<double>::infinity(), + m_ulps ) ); ret << ", "; - write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps)); + write( ret, + step( m_target, + std::numeric_limits<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)); + write( ret, + step( static_cast<float>( m_target ), + -std::numeric_limits<float>::infinity(), + m_ulps ) ); ret << ", "; - write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps)); + write( ret, + step( static_cast<float>( m_target ), + std::numeric_limits<float>::infinity(), + m_ulps ) ); } ret << "])"; @@ -6651,6 +7378,35 @@ WithinRelMatcher WithinRel(float target) { + +std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} + + + +namespace Catch { + namespace Matchers { + std::string AllTrueMatcher::describe() const { return "contains only true"; } + + AllTrueMatcher AllTrue() { return AllTrueMatcher{}; } + + std::string NoneTrueMatcher::describe() const { return "contains no true"; } + + NoneTrueMatcher NoneTrue() { return NoneTrueMatcher{}; } + + std::string AnyTrueMatcher::describe() const { return "contains at least one true"; } + + AnyTrueMatcher AnyTrue() { return AnyTrueMatcher{}; } + } // namespace Matchers +} // namespace Catch + + + #include <regex> namespace Catch { @@ -6672,7 +7428,7 @@ namespace Matchers { } - StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + StringMatcherBase::StringMatcherBase( StringRef operation, CasedString const& comparator ) : m_comparator( comparator ), m_operation( operation ) { } @@ -6684,33 +7440,33 @@ namespace Matchers { description += m_operation; description += ": \""; description += m_comparator.m_str; - description += "\""; + description += '"'; description += m_comparator.caseSensitivitySuffix(); return description; } - StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals"_sr, 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 ) {} + StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains"_sr, 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 ) {} + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with"_sr, 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 ) {} + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with"_sr, comparator ) {} bool EndsWithMatcher::match( std::string const& source ) const { return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); @@ -6718,7 +7474,7 @@ namespace Matchers { - RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(CATCH_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 @@ -6737,7 +7493,7 @@ namespace Matchers { StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity ) { return StringEqualsMatcher( CasedString( str, caseSensitivity) ); } - StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity ) { + StringContainsMatcher ContainsSubstring( std::string const& str, CaseSensitive caseSensitivity ) { return StringContainsMatcher( CasedString( str, caseSensitivity) ); } EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity ) { @@ -6768,7 +7524,7 @@ namespace Matchers { for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { combined_size += desc->size(); } - combined_size += (descriptions_end - descriptions_begin - 1) * combine.size(); + combined_size += static_cast<size_t>(descriptions_end - descriptions_begin - 1) * combine.size(); description.reserve(combined_size); @@ -6783,131 +7539,26 @@ namespace Matchers { } 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 + '"'; - } -} - + } + } // namespace Detail +} // namespace Matchers +} // namespace Catch -/////////////////////////////////////////////////// -// 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); -} + // 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 matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); + handler.handleExpr( expr ); + } -} // namespace Matchers } // namespace Catch @@ -6920,145 +7571,72 @@ namespace Catch { void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. - stream << ":test-result: "; + m_stream << ":test-result: "; if (_testCaseStats.totals.assertions.allPassed()) { - stream << "PASS"; + m_stream << "PASS"; } else if (_testCaseStats.totals.assertions.allOk()) { - stream << "XFAIL"; + m_stream << "XFAIL"; } else { - stream << "FAIL"; + m_stream << "FAIL"; } - stream << ' ' << _testCaseStats.testInfo->name << '\n'; + m_stream << ' ' << _testCaseStats.testInfo->name << '\n'; StreamingReporterBase::testCaseEnded(_testCaseStats); } void AutomakeReporter::skipTest(TestCaseInfo const& testInfo) { - stream << ":test-result: SKIP " << testInfo.name << '\n'; + m_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 { + ReporterBase::ReporterBase( ReporterConfig&& config ): + IEventListener( config.fullConfig() ), + m_wrapped_stream( CATCH_MOVE(config).takeStream() ), + m_stream( m_wrapped_stream->stream() ), + m_colour( makeColourImpl( config.colourMode(), m_wrapped_stream.get() ) ), + m_customOptions( config.customOptions() ) + {} - // 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]; + ReporterBase::~ReporterBase() = default; - // 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 ); + void ReporterBase::listReporters( + std::vector<ReporterDescription> const& descriptions ) { + defaultListReporters(m_stream, descriptions, m_config->verbosity()); } - 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; + void ReporterBase::listListeners( + std::vector<ListenerDescription> const& descriptions ) { + defaultListListeners( m_stream, descriptions ); } - 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; + void ReporterBase::listTests(std::vector<TestCaseHandle> const& tests) { + defaultListTests(m_stream, + m_colour.get(), + tests, + m_config->hasTestFilters(), + m_config->verbosity()); } - 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 ReporterBase::listTags(std::vector<TagInfo> const& tags) { + defaultListTags( m_stream, tags, m_config->hasTestFilters() ); } } // 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 ) { + constexpr Catch::StringRef bothOrAll( std::uint64_t count ) { switch (count) { case 1: return Catch::StringRef{}; @@ -7075,6 +7653,9 @@ namespace { namespace Catch { namespace { + // Colour::LightGrey + static constexpr Colour::Code compactDimColour = Colour::FileName; + #ifdef CATCH_PLATFORM_MAC static constexpr Catch::StringRef compactFailedString = "FAILED"_sr; static constexpr Catch::StringRef compactPassedString = "PASSED"_sr; @@ -7089,35 +7670,33 @@ namespace { // - 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) { +void printTotals(std::ostream& out, const Totals& totals, ColourImpl* colourImpl) { if (totals.testCases.total() == 0) { out << "No tests ran."; } else if (totals.testCases.failed == totals.testCases.total()) { - Colour colour(Colour::ResultError); + auto guard = colourImpl->guardColour( Colour::ResultError ).engage( out ); 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") << ", " + << pluralise(totals.testCases.failed, "test case"_sr) << ", " "failed " << qualify_assertions_failed << - pluralise(totals.assertions.failed, "assertion") << '.'; + pluralise(totals.assertions.failed, "assertion"_sr) << '.'; } else if (totals.assertions.total() == 0) { out << "Passed " << bothOrAll(totals.testCases.total()) - << pluralise(totals.testCases.total(), "test case") + << pluralise(totals.testCases.total(), "test case"_sr) << " (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") << '.'; + out << colourImpl->guardColour( Colour::ResultError ) << + "Failed " << pluralise(totals.testCases.failed, "test case"_sr) << ", " + "failed " << pluralise(totals.assertions.failed, "assertion"_sr) << '.'; } else { - Colour colour(Colour::ResultSuccess); - out << + out << colourImpl->guardColour( Colour::ResultSuccess ) << "Passed " << bothOrAll(totals.testCases.passed) - << pluralise(totals.testCases.passed, "test case") << - " with " << pluralise(totals.assertions.passed, "assertion") << '.'; + << pluralise(totals.testCases.passed, "test case"_sr) << + " with " << pluralise(totals.assertions.passed, "assertion"_sr) << '.'; } } @@ -7126,12 +7705,14 @@ class AssertionPrinter { public: AssertionPrinter& operator= (AssertionPrinter const&) = delete; AssertionPrinter(AssertionPrinter const&) = delete; - AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages, ColourImpl* colourImpl_) : stream(_stream) , result(_stats.assertionResult) , messages(_stats.infoMessages) , itMessage(_stats.infoMessages.begin()) - , printInfoMessages(_printInfoMessages) {} + , printInfoMessages(_printInfoMessages) + , colourImpl(colourImpl_) + {} void print() { printSourceInfo(); @@ -7203,16 +7784,13 @@ public: private: void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ':'; + stream << colourImpl->guardColour( Colour::FileName ) + << result.getSourceInfo() << ':'; } void printResultType(Colour::Code colour, StringRef passOrFail) const { if (!passOrFail.empty()) { - { - Colour colourGuard(colour); - stream << ' ' << passOrFail; - } + stream << colourImpl->guardColour(colour) << ' ' << passOrFail; stream << ':'; } } @@ -7225,8 +7803,7 @@ private: if (result.hasExpression()) { stream << ';'; { - Colour colour(dimColour()); - stream << " expression was:"; + stream << colourImpl->guardColour(compactDimColour) << " expression was:"; } printOriginalExpression(); } @@ -7240,10 +7817,7 @@ private: void printReconstructedExpression() const { if (result.hasExpandedExpression()) { - { - Colour colour(dimColour()); - stream << " for: "; - } + stream << colourImpl->guardColour(compactDimColour) << " for: "; stream << result.getExpandedExpression(); } } @@ -7255,25 +7829,22 @@ private: } } - void printRemainingMessages(Colour::Code colour = dimColour()) { + void printRemainingMessages(Colour::Code colour = compactDimColour) { 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") << ':'; - } + stream << colourImpl->guardColour( colour ) << " with " + << pluralise( N, "message"_sr ) << ':'; 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"; + stream << colourImpl->guardColour(compactDimColour) << " and"; } continue; } @@ -7287,6 +7858,7 @@ private: std::vector<MessageInfo> messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; + ColourImpl* colourImpl; }; } // anon namespace @@ -7295,13 +7867,21 @@ private: 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::noMatchingTestCases( StringRef unmatchedSpec ) { + m_stream << "No test cases matched '" << unmatchedSpec << "'\n"; } - void CompactReporter::assertionStarting( AssertionInfo const& ) {} + void CompactReporter::testRunStarting( TestRunInfo const& ) { + if ( m_config->testSpec().hasFilters() ) { + m_stream << m_colour->guardColour( Colour::BrightYellow ) + << "Filters: " + << serializeFilters( m_config->getTestsOrTags() ) + << '\n'; + } + m_stream << "RNG seed: " << m_config->rngSeed() << '\n'; + } - bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { + void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { AssertionResult const& result = _assertionStats.assertionResult; bool printInfoMessages = true; @@ -7309,27 +7889,26 @@ private: // 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; + return; printInfoMessages = false; } - AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + AssertionPrinter printer( m_stream, _assertionStats, printInfoMessages, m_colour.get() ); printer.print(); - stream << std::endl; - return true; + m_stream << '\n' << std::flush; } void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { double dur = _sectionStats.durationInSeconds; if ( shouldShowDuration( *m_config, dur ) ) { - stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl; + m_stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; } } void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( stream, _testRunStats.totals ); - stream << '\n' << std::endl; + printTotals( m_stream, _testRunStats.totals, m_colour.get() ); + m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded( _testRunStats ); } @@ -7340,7 +7919,6 @@ private: -#include <cfloat> #include <cstdio> #if defined(_MSC_VER) @@ -7366,18 +7944,19 @@ class ConsoleAssertionPrinter { public: ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; - ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, ColourImpl* colourImpl_, bool _printInfoMessages) : stream(_stream), stats(_stats), result(_stats.assertionResult), colour(Colour::None), message(result.getMessage()), messages(_stats.infoMessages), + colourImpl(colourImpl_), printInfoMessages(_printInfoMessages) { switch (result.getResultType()) { case ResultWas::Ok: colour = Colour::Success; - passOrFail = "PASSED"; + passOrFail = "PASSED"_sr; //if( result.hasMessage() ) if (_stats.infoMessages.size() == 1) messageLabel = "with message"; @@ -7387,10 +7966,10 @@ public: case ResultWas::ExpressionFailed: if (result.isOk()) { colour = Colour::Success; - passOrFail = "FAILED - but was ok"; + passOrFail = "FAILED - but was ok"_sr; } else { colour = Colour::Error; - passOrFail = "FAILED"; + passOrFail = "FAILED"_sr; } if (_stats.infoMessages.size() == 1) messageLabel = "with message"; @@ -7399,7 +7978,7 @@ public: break; case ResultWas::ThrewException: colour = Colour::Error; - passOrFail = "FAILED"; + passOrFail = "FAILED"_sr; messageLabel = "due to unexpected exception with "; if (_stats.infoMessages.size() == 1) messageLabel += "message"; @@ -7408,12 +7987,12 @@ public: break; case ResultWas::FatalErrorCondition: colour = Colour::Error; - passOrFail = "FAILED"; + passOrFail = "FAILED"_sr; messageLabel = "due to a fatal error condition"; break; case ResultWas::DidntThrowException: colour = Colour::Error; - passOrFail = "FAILED"; + passOrFail = "FAILED"_sr; messageLabel = "because no exception was thrown where one was expected"; break; case ResultWas::Info: @@ -7423,7 +8002,7 @@ public: messageLabel = "warning"; break; case ResultWas::ExplicitFailure: - passOrFail = "FAILED"; + passOrFail = "FAILED"_sr; colour = Colour::Error; if (_stats.infoMessages.size() == 1) messageLabel = "explicitly with message"; @@ -7434,7 +8013,7 @@ public: case ResultWas::Unknown: case ResultWas::FailureBit: case ResultWas::Exception: - passOrFail = "** internal error **"; + passOrFail = "** internal error **"_sr; colour = Colour::Error; break; } @@ -7455,23 +8034,22 @@ public: private: void printResultType() const { if (!passOrFail.empty()) { - Colour colourGuard(colour); - stream << passOrFail << ":\n"; + stream << colourImpl->guardColour(colour) << passOrFail << ":\n"; } } void printOriginalExpression() const { if (result.hasExpression()) { - Colour colourGuard(Colour::OriginalExpression); - stream << " "; - stream << result.getExpressionInMacro(); - stream << '\n'; + stream << colourImpl->guardColour( Colour::OriginalExpression ) + << " " << result.getExpressionInMacro() << '\n'; } } void printReconstructedExpression() const { if (result.hasExpandedExpression()) { stream << "with expansion:\n"; - Colour colourGuard(Colour::ReconstructedExpression); - stream << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; + stream << colourImpl->guardColour( Colour::ReconstructedExpression ) + << TextFlow::Column( result.getExpandedExpression() ) + .indent( 2 ) + << '\n'; } } void printMessage() const { @@ -7484,27 +8062,28 @@ private: } } void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ": "; + stream << colourImpl->guardColour( Colour::FileName ) + << result.getSourceInfo() << ": "; } std::ostream& stream; AssertionStats const& stats; AssertionResult const& result; Colour::Code colour; - std::string passOrFail; + StringRef passOrFail; std::string messageLabel; std::string message; std::vector<MessageInfo> messages; + ColourImpl* colourImpl; 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 makeRatio( std::uint64_t number, std::uint64_t total ) { + const auto ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; + return (ratio == 0 && number > 0) ? 1 : static_cast<std::size_t>(ratio); } -std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { +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) @@ -7517,7 +8096,7 @@ enum class Justification { Left, Right }; struct ColumnInfo { std::string name; - int width; + std::size_t width; Justification justification; }; struct ColumnBreak {}; @@ -7606,7 +8185,7 @@ class TablePrinter { public: TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos ) : m_os( os ), - m_columnInfos( std::move( columnInfos ) ) {} + m_columnInfos( CATCH_MOVE( columnInfos ) ) {} auto columnInfos() const -> std::vector<ColumnInfo> const& { return m_columnInfos; @@ -7620,7 +8199,8 @@ public: 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)); + assert(info.width > 2); + headerCols += TextFlow::Column(info.name).width(info.width - 2); headerCols += spacer; } m_os << headerCols << '\n'; @@ -7631,7 +8211,7 @@ public: void close() { if (m_isOpen) { *this << RowBreak(); - m_os << std::endl; + m_os << '\n' << std::flush; m_isOpen = false; } } @@ -7654,7 +8234,7 @@ public: tp.m_currentColumn++; auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; - auto padding = (strSize + 1 < static_cast<std::size_t>(colInfo.width)) + auto padding = (strSize + 1 < colInfo.width) ? std::string(colInfo.width - (strSize + 1), ' ') : std::string(); if (colInfo.justification == Justification::Left) @@ -7673,9 +8253,9 @@ public: } }; -ConsoleReporter::ConsoleReporter(ReporterConfig const& config) - : StreamingReporterBase(config), - m_tablePrinter(new TablePrinter(config.stream(), +ConsoleReporter::ConsoleReporter(ReporterConfig&& config): + StreamingReporterBase( CATCH_MOVE( config ) ), + m_tablePrinter(Detail::make_unique<TablePrinter>(m_stream, [&config]() -> std::vector<ColumnInfo> { if (config.fullConfig()->benchmarkNoAnalysis()) { @@ -7702,31 +8282,30 @@ 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::noMatchingTestCases( StringRef unmatchedSpec ) { + m_stream << "No test cases matched '" << unmatchedSpec << "'\n"; } -void ConsoleReporter::reportInvalidArguments(std::string const&arg){ - stream << "Invalid Filter: " << arg << std::endl; +void ConsoleReporter::reportInvalidTestSpec( StringRef arg ) { + m_stream << "Invalid Filter: " << arg << '\n'; } void ConsoleReporter::assertionStarting(AssertionInfo const&) {} -bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { +void 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; + return; lazyPrint(); - ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); + ConsoleAssertionPrinter printer(m_stream, _assertionStats, m_colour.get(), includeResults); printer.print(); - stream << std::endl; - return true; + m_stream << '\n' << std::flush; } void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { @@ -7738,16 +8317,17 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { m_tablePrinter->close(); if (_sectionStats.missingAssertions) { lazyPrint(); - Colour colour(Colour::ResultError); + auto guard = + m_colour->guardColour( Colour::ResultError ).engage( m_stream ); if (m_sectionStack.size() > 1) - stream << "\nNo assertions in section"; + m_stream << "\nNo assertions in section"; else - stream << "\nNo assertions in test case"; - stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; + m_stream << "\nNo assertions in test case"; + m_stream << " '" << _sectionStats.sectionInfo.name << "'\n\n" << std::flush; } double dur = _sectionStats.durationInSeconds; if (shouldShowDuration(*m_config, dur)) { - stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl; + m_stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; } if (m_headerPrinted) { m_headerPrinted = false; @@ -7755,10 +8335,11 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { StreamingReporterBase::sectionEnded(_sectionStats); } -void ConsoleReporter::benchmarkPreparing(std::string const& name) { +void ConsoleReporter::benchmarkPreparing( StringRef name ) { lazyPrintWithoutClosingBenchmarkTable(); - auto nameCol = TextFlow::Column(name).width(static_cast<std::size_t>(m_tablePrinter->columnInfos()[0].width - 2)); + auto nameCol = TextFlow::Column( static_cast<std::string>( name ) ) + .width( m_tablePrinter->columnInfos()[0].width - 2 ); bool firstLine = true; for (auto line : nameCol) { @@ -7794,8 +8375,8 @@ void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) { } } -void ConsoleReporter::benchmarkFailed(std::string const& error) { - Colour colour(Colour::Red); +void ConsoleReporter::benchmarkFailed( StringRef error ) { + auto guard = m_colour->guardColour( Colour::Red ).engage( m_stream ); (*m_tablePrinter) << "Benchmark failed (" << error << ')' << ColumnBreak() << RowBreak(); @@ -7806,24 +8387,19 @@ void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { 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; + m_stream << '\n' << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { StreamingReporterBase::testRunStarting(_testInfo); - printTestFilters(); + if ( m_config->testSpec().hasFilters() ) { + m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " + << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + } + m_stream << "Randomness seeded to: " << m_config->rngSeed() << '\n'; } void ConsoleReporter::lazyPrint() { @@ -7834,40 +8410,30 @@ void ConsoleReporter::lazyPrint() { void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { - if (!currentTestRunInfo.used) + if ( !m_testRunInfoPrinted ) { 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; - } + m_stream << '\n' + << lineOfChars( '~' ) << '\n' + << m_colour->guardColour( Colour::SecondaryText ) + << currentTestRunInfo.name << " is a Catch2 v" << libraryVersion() + << " host application.\n" + << "Run with -? for options\n\n"; + + m_testRunInfoPrinted = true; } void ConsoleReporter::printTestCaseAndSectionHeader() { assert(!m_sectionStack.empty()); printOpenHeader(currentTestCaseInfo->name); if (m_sectionStack.size() > 1) { - Colour colourGuard(Colour::Headers); + auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream ); auto it = m_sectionStack.begin() + 1, // Skip first section (test case) @@ -7879,41 +8445,63 @@ void ConsoleReporter::printTestCaseAndSectionHeader() { SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; - stream << lineOfChars('-') << '\n'; - Colour colourGuard(Colour::FileName); - stream << lineInfo << '\n'; - stream << lineOfChars('.') << '\n' << std::endl; + m_stream << lineOfChars( '-' ) << '\n' + << m_colour->guardColour( Colour::FileName ) << lineInfo << '\n' + << lineOfChars( '.' ) << "\n\n" + << std::flush; } void ConsoleReporter::printClosedHeader(std::string const& _name) { printOpenHeader(_name); - stream << lineOfChars('.') << '\n'; + m_stream << lineOfChars('.') << '\n'; } void ConsoleReporter::printOpenHeader(std::string const& _name) { - stream << lineOfChars('-') << '\n'; + m_stream << lineOfChars('-') << '\n'; { - Colour colourGuard(Colour::Headers); + auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream ); 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'; + // We want to get a bit fancy with line breaking here, so that subsequent + // lines start after ":" if one is present, e.g. + // ``` + // blablabla: Fancy + // linebreaking + // ``` + // but we also want to avoid problems with overly long indentation causing + // the text to take up too many lines, e.g. + // ``` + // blablabla: F + // a + // n + // c + // y + // . + // . + // . + // ``` + // So we limit the prefix indentation check to first quarter of the possible + // width + std::size_t idx = _string.find( ": " ); + if ( idx != std::string::npos && idx < CATCH_CONFIG_CONSOLE_WIDTH / 4 ) { + idx += 2; + } else { + idx = 0; + } + m_stream << TextFlow::Column( _string ) + .indent( indent + idx ) + .initialIndent( indent ) + << '\n'; } struct SummaryColumn { SummaryColumn( std::string _label, Colour::Code _colour ) - : label( std::move( _label ) ), + : label( CATCH_MOVE( _label ) ), colour( _colour ) {} - SummaryColumn addRow( std::size_t count ) { + SummaryColumn addRow( std::uint64_t count ) { ReusableStringStream rss; rss << count; std::string row = rss.str(); @@ -7935,12 +8523,14 @@ struct SummaryColumn { void ConsoleReporter::printTotals( Totals const& totals ) { if (totals.testCases.total() == 0) { - stream << Colour(Colour::Warning) << "No tests ran\n"; + m_stream << m_colour->guardColour( 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") << ')' + m_stream << m_colour->guardColour( Colour::ResultSuccess ) + << "All tests passed"; + m_stream << " (" + << pluralise(totals.assertions.passed, "assertion"_sr) << " in " + << pluralise(totals.testCases.passed, "test case"_sr) << ')' << '\n'; } else { @@ -7958,26 +8548,28 @@ void ConsoleReporter::printTotals( Totals const& totals ) { .addRow(totals.testCases.failedButOk) .addRow(totals.assertions.failedButOk)); - printSummaryRow("test cases", columns, 0); - printSummaryRow("assertions", columns, 1); + printSummaryRow("test cases"_sr, columns, 0); + printSummaryRow("assertions"_sr, columns, 1); } } -void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) { +void ConsoleReporter::printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row) { for (auto col : cols) { - std::string value = col.rows[row]; + std::string const& value = col.rows[row]; if (col.label.empty()) { - stream << label << ": "; - if (value != "0") - stream << value; - else - stream << Colour(Colour::Warning) << "- none -"; + m_stream << label << ": "; + if ( value != "0" ) { + m_stream << value; + } else { + m_stream << m_colour->guardColour( Colour::Warning ) + << "- none -"; + } } else if (value != "0") { - stream << Colour(Colour::LightGrey) << " | "; - stream << Colour(col.colour) - << value << ' ' << col.label; + m_stream << m_colour->guardColour( Colour::LightGrey ) << " | " + << m_colour->guardColour( col.colour ) << value << ' ' + << col.label; } } - stream << '\n'; + m_stream << '\n'; } void ConsoleReporter::printTotalsDivider(Totals const& totals) { @@ -7990,26 +8582,25 @@ void ConsoleReporter::printTotalsDivider(Totals const& totals) { 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, '='); + m_stream << m_colour->guardColour( Colour::Error ) + << std::string( failedRatio, '=' ) + << m_colour->guardColour( Colour::ResultExpectedFailure ) + << std::string( failedButOkRatio, '=' ); + if ( totals.testCases.allPassed() ) { + m_stream << m_colour->guardColour( Colour::ResultSuccess ) + << std::string( passedRatio, '=' ); + } else { + m_stream << m_colour->guardColour( Colour::Success ) + << std::string( passedRatio, '=' ); + } } else { - stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); + m_stream << m_colour->guardColour( Colour::Warning ) + << std::string( CATCH_CONFIG_CONSOLE_WIDTH - 1, '=' ); } - stream << '\n'; + m_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'; - } + m_stream << lineOfChars('-') << '\n'; } } // end namespace Catch @@ -8024,111 +8615,411 @@ void ConsoleReporter::printTestFilters() { + +#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 + + namespace Detail { + AssertionOrBenchmarkResult::AssertionOrBenchmarkResult( + AssertionStats const& assertion ): + m_assertion( assertion ) {} + + AssertionOrBenchmarkResult::AssertionOrBenchmarkResult( + BenchmarkStats<> const& benchmark ): + m_benchmark( benchmark ) {} + + bool AssertionOrBenchmarkResult::isAssertion() const { + return m_assertion.some(); + } + bool AssertionOrBenchmarkResult::isBenchmark() const { + return m_benchmark.some(); + } + + AssertionStats const& AssertionOrBenchmarkResult::asAssertion() const { + assert(m_assertion.some()); + + return *m_assertion; + } + BenchmarkStats<> const& AssertionOrBenchmarkResult::asBenchmark() const { + assert(m_benchmark.some()); + + return *m_benchmark; + } + + } + + CumulativeReporterBase::~CumulativeReporterBase() = default; + + void CumulativeReporterBase::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { + m_sectionStack.back()->assertionsAndBenchmarks.emplace_back(benchmarkStats); + } + + 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( CATCH_MOVE( newNode ) ); + } else { + node = it->get(); + } + } + + m_deepestSection = node; + m_sectionStack.push_back( node ); + } + + void 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. + if ( m_shouldStoreFailedAssertions && + !assertionStats.assertionResult.isOk() ) { + static_cast<void>( + assertionStats.assertionResult.getExpandedExpression() ); + } + if ( m_shouldStoreSuccesfulAssertions && + assertionStats.assertionResult.isOk() ) { + static_cast<void>( + assertionStats.assertionResult.getExpandedExpression() ); + } + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertionsAndBenchmarks.emplace_back( assertionStats ); + } + + 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( CATCH_MOVE(m_rootSection) ); + m_testCases.push_back( CATCH_MOVE(node) ); + + assert( m_deepestSection ); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + + + void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) { + assert(!m_testRun && "CumulativeReporterBase assumes there can only be one test run"); + m_testRun = Detail::make_unique<TestRunNode>( testRunStats ); + m_testRun->children.swap( m_testCases ); + testRunEndedCumulative(); + } + + bool CumulativeReporterBase::SectionNode::hasAnyAssertions() const { + return std::any_of( + assertionsAndBenchmarks.begin(), + assertionsAndBenchmarks.end(), + []( Detail::AssertionOrBenchmarkResult const& res ) { + return res.isAssertion(); + } ); + } + +} // end namespace Catch + + + + +namespace Catch { + + void EventListenerBase::fatalErrorEncountered( StringRef ) {} + + void EventListenerBase::benchmarkPreparing( StringRef ) {} + void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {} + void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {} + void EventListenerBase::benchmarkFailed( StringRef ) {} + + void EventListenerBase::assertionStarting( AssertionInfo const& ) {} + + void EventListenerBase::assertionEnded( AssertionStats const& ) {} + void EventListenerBase::listReporters( + std::vector<ReporterDescription> const& ) {} + void EventListenerBase::listListeners( + std::vector<ListenerDescription> const& ) {} + void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {} + void EventListenerBase::listTags( std::vector<TagInfo> const& ) {} + void EventListenerBase::noMatchingTestCases( StringRef ) {} + void EventListenerBase::reportInvalidTestSpec( StringRef ) {} + void EventListenerBase::testRunStarting( TestRunInfo const& ) {} + void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} + void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {} + void EventListenerBase::sectionStarting( SectionInfo const& ) {} + void EventListenerBase::sectionEnded( SectionStats const& ) {} + void EventListenerBase::testCasePartialEnded(TestCaseStats const&, uint64_t) {} + void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} + void EventListenerBase::testRunEnded( TestRunStats const& ) {} + void EventListenerBase::skipTest( TestCaseInfo const& ) {} +} // namespace Catch + + + + #include <algorithm> -#include <cassert> +#include <cfloat> +#include <cstdio> +#include <ostream> +#include <iomanip> 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 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'; } - void operator=( BySectionInfo const& ) = delete; + out << std::flush; + } + } // end unnamed namespace - private: - SectionInfo const& m_other; - }; - void prepareExpandedExpression( AssertionResult& result ) { - result.getExpandedExpression(); + // Because formatting using c++ streams is stateful, drop down to C is + // required Alternatively we could use stringstream, but its performance + // is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; +#ifdef _MSC_VER + size_t printedLength = static_cast<size_t>( + sprintf_s( buffer, "%.3f", duration ) ); +#else + size_t printedLength = static_cast<size_t>( + std::snprintf( buffer, maxDoubleSize, "%.3f", duration ) ); +#endif + return std::string( buffer, printedLength ); + } + + bool shouldShowDuration( IConfig const& config, double duration ) { + if ( config.showDurations() == ShowDurations::Always ) { + return true; } - } // namespace + 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(); + } - CumulativeReporterBase::~CumulativeReporterBase() = default; + std::string serialized; + serialized.reserve(serialized_size); + bool first = true; - 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; + for (auto const& filter : filters) { + if (!first) { + serialized.push_back(' '); } + first = false; + serialized.append(filter); } - m_sectionStack.push_back( node ); - m_deepestSection = std::move( node ); + + return serialized; } - 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; + 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 CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) { - assert( !m_sectionStack.empty() ); - SectionNode& node = *m_sectionStack.back(); - node.stats = sectionStats; - m_sectionStack.pop_back(); + 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 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(); + void defaultListListeners( std::ostream& out, + std::vector<ListenerDescription> const& descriptions ) { + out << "Registered listeners:\n"; - assert( m_deepestSection ); - m_deepestSection->stdOut = testCaseStats.stdOut; - m_deepestSection->stdErr = testCaseStats.stdErr; + if(descriptions.empty()) { + return; + } + + const auto maxNameLen = + std::max_element( descriptions.begin(), + descriptions.end(), + []( ListenerDescription const& lhs, + ListenerDescription const& rhs ) { + return lhs.name.size() < rhs.name.size(); + } ) + ->name.size(); + + for ( auto const& desc : descriptions ) { + out << TextFlow::Column( static_cast<std::string>( desc.name ) + + ':' ) + .indent( 2 ) + .width( maxNameLen + 5 ) + + TextFlow::Column( desc.description ) + .initialIndent( 0 ) + .indent( 2 ) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8 ) + << '\n'; + } + + out << '\n' << std::flush; } - void CumulativeReporterBase::testGroupEnded( - TestGroupStats const& testGroupStats ) { - auto node = std::make_shared<TestGroupNode>( testGroupStats ); - node->children.swap( m_testCases ); - m_testGroups.push_back( node ); + 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"_sr) << "\n\n" << std::flush; } - void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) { - auto node = std::make_shared<TestRunNode>( testRunStats ); - node->children.swap( m_testGroups ); - m_testRuns.push_back( node ); - testRunEndedCumulative(); + void defaultListTests(std::ostream& out, ColourImpl* streamColour, 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; + auto colourGuard = streamColour->guardColour( colour ).engage( out ); + + out << TextFlow::Column(testCaseInfo.name).indent(2) << '\n'; + if (verbosity >= Verbosity::High) { + out << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << '\n'; + } + if (!testCaseInfo.tags.empty() && + verbosity > Verbosity::Quiet) { + out << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; + } + } + + if (isFiltered) { + out << pluralise(tests.size(), "matching test case"_sr); + } else { + out << pluralise(tests.size(), "test case"_sr); + } + out << "\n\n" << std::flush; } -} // end namespace Catch +} // namespace Catch @@ -8136,34 +9027,29 @@ namespace Catch { #include <cassert> #include <ctime> #include <algorithm> +#include <iomanip> 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 = {}; +#if defined (_MSC_VER) || defined (__MINGW32__) gmtime_s(&timeInfo, &rawtime); #else - std::tm* timeInfo; - timeInfo = std::gmtime(&rawtime); + 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"; -#ifdef _MSC_VER std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); -#else - std::strftime(timeStamp, timeStampSize, fmt, timeInfo); -#endif - return std::string(timeStamp); + + return std::string(timeStamp, timeStampSize - 1); } std::string fileNameTag(std::vector<Tag> const& tags) { @@ -8179,45 +9065,58 @@ namespace Catch { } return std::string(); } + + // Formats the duration in seconds to 3 decimal places. + // This is done because some genius defined Maven Surefire schema + // in a way that only accepts 3 decimal places, and tools like + // Jenkins use that schema for validation JUnit reporter output. + std::string formatDuration( double seconds ) { + ReusableStringStream rss; + rss << std::fixed << std::setprecision( 3 ) << seconds; + return rss.str(); + } + + static void normalizeNamespaceMarkers(std::string& str) { + std::size_t pos = str.find( "::" ); + while ( pos != str.npos ) { + str.replace( pos, 2, "." ); + pos += 1; + pos = str.find( "::", pos ); + } + } + } // anonymous namespace - JunitReporter::JunitReporter( ReporterConfig const& _config ) - : CumulativeReporterBase( _config ), - xml( _config.stream() ) + JunitReporter::JunitReporter( ReporterConfig&& _config ) + : CumulativeReporterBase( CATCH_MOVE(_config) ), + xml( m_stream ) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; + m_shouldStoreSuccesfulAssertions = false; } - 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 ) { + void JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) unexpectedExceptions++; - return CumulativeReporterBase::assertionEnded( assertionStats ); + CumulativeReporterBase::assertionEnded( assertionStats ); } void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { @@ -8226,48 +9125,42 @@ namespace Catch { CumulativeReporterBase::testCaseEnded( testCaseStats ); } - void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - double suiteTime = suiteTimer.getElapsedSeconds(); - CumulativeReporterBase::testGroupEnded( testGroupStats ); - writeGroup( *m_testGroups.back(), suiteTime ); - } - void JunitReporter::testRunEndedCumulative() { + const auto suiteTime = suiteTimer.getElapsedSeconds(); + writeRun( *m_testRun, suiteTime ); xml.endElement(); } - void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { + void JunitReporter::writeRun( TestRunNode const& testRunNode, 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 + TestRunStats const& stats = testRunNode.value; + xml.writeAttribute( "name"_sr, stats.runInfo.name ); + xml.writeAttribute( "errors"_sr, unexpectedExceptions ); + xml.writeAttribute( "failures"_sr, stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "tests"_sr, stats.totals.assertions.total() ); + xml.writeAttribute( "hostname"_sr, "tbd"_sr ); // !TBD if( m_config->showDurations() == ShowDurations::Never ) - xml.writeAttribute( "time", "" ); + xml.writeAttribute( "time"_sr, ""_sr ); else - xml.writeAttribute( "time", suiteTime ); - xml.writeAttribute( "timestamp", getCurrentTimestamp() ); + xml.writeAttribute( "time"_sr, formatDuration( suiteTime ) ); + xml.writeAttribute( "timestamp"_sr, getCurrentTimestamp() ); - // Write properties if there are any - if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + // Write properties + { auto properties = xml.scopedElement("properties"); + xml.scopedElement("property") + .writeAttribute("name"_sr, "random-seed"_sr) + .writeAttribute("value"_sr, m_config->rngSeed()); 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()); + .writeAttribute("name"_sr, "filters"_sr) + .writeAttribute("value"_sr, serializeFilters(m_config->getTestsOrTags())); } } // Write test cases - for( auto const& child : groupNode.children ) + for( auto const& child : testRunNode.children ) writeTestCase( *child ); xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); @@ -8282,48 +9175,59 @@ namespace Catch { assert( testCaseNode.children.size() == 1 ); SectionNode const& rootSection = *testCaseNode.children.front(); - std::string className = stats.testInfo->className; + std::string className = + static_cast<std::string>( stats.testInfo->className ); if( className.empty() ) { className = fileNameTag(stats.testInfo->tags); - if ( className.empty() ) + if ( className.empty() ) { className = "global"; + } } if ( !m_config->name().empty() ) - className = m_config->name() + "." + className; + className = static_cast<std::string>(m_config->name()) + '.' + className; - writeSection( className, "", rootSection ); + normalizeNamespaceMarkers(className); + + writeSection( className, "", rootSection, stats.testInfo->okToFail() ); } - void JunitReporter::writeSection( std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode ) { + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode, + bool testOkToFail) { std::string name = trim( sectionNode.stats.sectionInfo.name ); if( !rootName.empty() ) name = rootName + '/' + name; - if( !sectionNode.assertions.empty() || - !sectionNode.stdOut.empty() || - !sectionNode.stdErr.empty() ) { + if( sectionNode.hasAnyAssertions() + || !sectionNode.stdOut.empty() + || !sectionNode.stdErr.empty() ) { XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); if( className.empty() ) { - xml.writeAttribute( "classname", name ); - xml.writeAttribute( "name", "root" ); + xml.writeAttribute( "classname"_sr, name ); + xml.writeAttribute( "name"_sr, "root"_sr ); } else { - xml.writeAttribute( "classname", className ); - xml.writeAttribute( "name", name ); + xml.writeAttribute( "classname"_sr, className ); + xml.writeAttribute( "name"_sr, name ); } - xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); + xml.writeAttribute( "time"_sr, formatDuration( 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" ); + xml.writeAttribute( "status"_sr, "run"_sr ); + + if (sectionNode.stats.assertions.failedButOk) { + xml.scopedElement("skipped") + .writeAttribute("message", "TEST_CASE tagged with !mayfail"); + } writeAssertions( sectionNode ); + if( !sectionNode.stdOut.empty() ) xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); if( !sectionNode.stdErr.empty() ) @@ -8331,14 +9235,17 @@ namespace Catch { } for( auto const& childNode : sectionNode.childSections ) if( className.empty() ) - writeSection( name, "", *childNode ); + writeSection( name, "", *childNode, testOkToFail ); else - writeSection( className, name, *childNode ); + writeSection( className, name, *childNode, testOkToFail ); } void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { - for( auto const& assertion : sectionNode.assertions ) - writeAssertion( assertion ); + for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) { + if (assertionOrBenchmark.isAssertion()) { + writeAssertion(assertionOrBenchmark.asAssertion()); + } + } } void JunitReporter::writeAssertion( AssertionStats const& stats ) { @@ -8369,8 +9276,8 @@ namespace Catch { XmlWriter::ScopedElement e = xml.scopedElement( elementName ); - xml.writeAttribute( "message", result.getExpression() ); - xml.writeAttribute( "type", result.getTestMacroName() ); + xml.writeAttribute( "message"_sr, result.getExpression() ); + xml.writeAttribute( "type"_sr, result.getTestMacroName() ); ReusableStringStream rss; if (stats.totals.assertions.total() > 0) { @@ -8403,164 +9310,189 @@ namespace Catch { -#include <cassert> + +#include <ostream> namespace Catch { + void MultiReporter::updatePreferences(IEventListener const& reporterish) { + m_preferences.shouldRedirectStdOut |= + reporterish.getPreferences().shouldRedirectStdOut; + m_preferences.shouldReportAllAssertions |= + reporterish.getPreferences().shouldReportAllAssertions; + } - ListeningReporter::ListeningReporter() { - // We will assume that listeners will always want all assertions - m_preferences.shouldReportAllAssertions = true; + void MultiReporter::addListener( IEventListenerPtr&& listener ) { + updatePreferences(*listener); + m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) ); + ++m_insertedListeners; } - void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { - m_listeners.push_back( std::move( listener ) ); + void MultiReporter::addReporter( IEventListenerPtr&& reporter ) { + updatePreferences(*reporter); + + // We will need to output the captured stdout if there are reporters + // that do not want it captured. + // We do not consider listeners, because it is generally assumed that + // listeners are output-transparent, even though they can ask for stdout + // capture to do something with it. + m_haveNoncapturingReporters |= !reporter->getPreferences().shouldRedirectStdOut; + + // Reporters can always be placed to the back without breaking the + // reporting order + m_reporterLikes.push_back( CATCH_MOVE( reporter ) ); } - 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 MultiReporter::noMatchingTestCases( StringRef unmatchedSpec ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->noMatchingTestCases( unmatchedSpec ); + } } - void ListeningReporter::noMatchingTestCases( std::string const& spec ) { - for ( auto const& listener : m_listeners ) { - listener->noMatchingTestCases( spec ); + void MultiReporter::fatalErrorEncountered( StringRef error ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->fatalErrorEncountered( error ); } - m_reporter->noMatchingTestCases( spec ); } - void ListeningReporter::reportInvalidArguments(std::string const&arg){ - for ( auto const& listener : m_listeners ) { - listener->reportInvalidArguments( arg ); + void MultiReporter::reportInvalidTestSpec( StringRef arg ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->reportInvalidTestSpec( arg ); } - m_reporter->reportInvalidArguments( arg ); } - void ListeningReporter::benchmarkPreparing( std::string const& name ) { - for (auto const& listener : m_listeners) { - listener->benchmarkPreparing(name); + void MultiReporter::benchmarkPreparing( StringRef name ) { + for (auto& reporterish : m_reporterLikes) { + reporterish->benchmarkPreparing(name); } - m_reporter->benchmarkPreparing(name); } - void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { - for ( auto const& listener : m_listeners ) { - listener->benchmarkStarting( benchmarkInfo ); + void MultiReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->benchmarkStarting( benchmarkInfo ); } - m_reporter->benchmarkStarting( benchmarkInfo ); } - void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { - for ( auto const& listener : m_listeners ) { - listener->benchmarkEnded( benchmarkStats ); + void MultiReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->benchmarkEnded( benchmarkStats ); } - m_reporter->benchmarkEnded( benchmarkStats ); } - void ListeningReporter::benchmarkFailed( std::string const& error ) { - for (auto const& listener : m_listeners) { - listener->benchmarkFailed(error); + void MultiReporter::benchmarkFailed( StringRef error ) { + for (auto& reporterish : m_reporterLikes) { + reporterish->benchmarkFailed(error); } - m_reporter->benchmarkFailed(error); } - void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testRunStarting( testRunInfo ); + void MultiReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testRunStarting( testRunInfo ); } - m_reporter->testRunStarting( testRunInfo ); } - void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupStarting( groupInfo ); + void MultiReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCaseStarting( testInfo ); } - m_reporter->testGroupStarting( groupInfo ); } - - void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseStarting( testInfo ); + void + MultiReporter::testCasePartialStarting( TestCaseInfo const& testInfo, + uint64_t partNumber ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCasePartialStarting( testInfo, partNumber ); } - m_reporter->testCaseStarting( testInfo ); } - void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->sectionStarting( sectionInfo ); + void MultiReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->sectionStarting( sectionInfo ); } - m_reporter->sectionStarting( sectionInfo ); } - void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->assertionStarting( assertionInfo ); + void MultiReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->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 ) ); + void MultiReporter::assertionEnded( AssertionStats const& assertionStats ) { + const bool reportByDefault = + assertionStats.assertionResult.getResultType() != ResultWas::Ok || + m_config->includeSuccessfulResults(); + + for ( auto & reporterish : m_reporterLikes ) { + if ( reportByDefault || + reporterish->getPreferences().shouldReportAllAssertions ) { + reporterish->assertionEnded( assertionStats ); + } } - return m_reporter->assertionEnded( assertionStats ); } - void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { - for ( auto const& listener : m_listeners ) { - listener->sectionEnded( sectionStats ); + void MultiReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->sectionEnded( sectionStats ); } - m_reporter->sectionEnded( sectionStats ); } - void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseEnded( testCaseStats ); + void MultiReporter::testCasePartialEnded( TestCaseStats const& testStats, + uint64_t partNumber ) { + if ( m_preferences.shouldRedirectStdOut && + m_haveNoncapturingReporters ) { + if ( !testStats.stdOut.empty() ) { + Catch::cout() << testStats.stdOut << std::flush; + } + if ( !testStats.stdErr.empty() ) { + Catch::cerr() << testStats.stdErr << std::flush; + } + } + + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCasePartialEnded( testStats, partNumber ); } - m_reporter->testCaseEnded( testCaseStats ); } - void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupEnded( testGroupStats ); + void MultiReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCaseEnded( testCaseStats ); } - m_reporter->testGroupEnded( testGroupStats ); } - void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { - for ( auto const& listener : m_listeners ) { - listener->testRunEnded( testRunStats ); + void MultiReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testRunEnded( testRunStats ); } - m_reporter->testRunEnded( testRunStats ); } - void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->skipTest( testInfo ); + void MultiReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->skipTest( testInfo ); + } + } + + void MultiReporter::listReporters(std::vector<ReporterDescription> const& descriptions) { + for (auto& reporterish : m_reporterLikes) { + reporterish->listReporters(descriptions); } - 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); + void MultiReporter::listListeners( + std::vector<ListenerDescription> const& descriptions ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->listListeners( descriptions ); } - 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); + void MultiReporter::listTests(std::vector<TestCaseHandle> const& tests) { + for (auto& reporterish : m_reporterLikes) { + reporterish->listTests(tests); } - 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); + void MultiReporter::listTags(std::vector<TagInfo> const& tags) { + for (auto& reporterish : m_reporterLikes) { + reporterish->listTags(tags); } - m_reporter->listTags(tags, config); } } // end namespace Catch @@ -8568,35 +9500,65 @@ namespace Catch { + +namespace Catch { + namespace Detail { + + void registerReporterImpl( std::string const& name, + IReporterFactoryPtr reporterPtr ) { + CATCH_TRY { + getMutableRegistryHub().registerReporter( + name, CATCH_MOVE( reporterPtr ) ); + } + CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead + // register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + + } // namespace Detail +} // namespace Catch + + + + #include <map> namespace Catch { - SonarQubeReporter::~SonarQubeReporter() {} + namespace { + std::string createRngSeedString(uint32_t seed) { + ReusableStringStream sstr; + sstr << "rng-seed=" << seed; + return sstr.str(); + } + } void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { CumulativeReporterBase::testRunStarting(testRunInfo); + + xml.writeComment( createRngSeedString( m_config->rngSeed() ) ); xml.startElement("testExecutions"); - xml.writeAttribute("version", '1'); + xml.writeAttribute("version"_sr, '1'); } - void SonarQubeReporter::testGroupEnded(TestGroupStats const& testGroupStats) { - CumulativeReporterBase::testGroupEnded(testGroupStats); - writeGroup(*m_testGroups.back()); - } + void SonarQubeReporter::writeRun( TestRunNode const& runNode ) { + std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile; - 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& child : runNode.children ) { + testsPerFile[child->value.testInfo->lineInfo.file].push_back( + child.get() ); + } - for (auto const& kv : testsPerFile) - writeTestFile(kv.first, kv.second); + for ( auto const& kv : testsPerFile ) { + writeTestFile( kv.first, kv.second ); + } } - void SonarQubeReporter::writeTestFile(std::string const& filename, TestGroupNode::ChildNodes const& testCaseNodes) { + void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) { XmlWriter::ScopedElement e = xml.scopedElement("file"); - xml.writeAttribute("path", filename); + xml.writeAttribute("path"_sr, filename); for (auto const& child : testCaseNodes) writeTestCase(*child); @@ -8615,10 +9577,12 @@ namespace Catch { if (!rootName.empty()) name = rootName + '/' + name; - if (!sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty()) { + if ( sectionNode.hasAnyAssertions() + || !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)); + xml.writeAttribute("name"_sr, name); + xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); writeAssertions(sectionNode, okToFail); } @@ -8628,8 +9592,11 @@ namespace Catch { } void SonarQubeReporter::writeAssertions(SectionNode const& sectionNode, bool okToFail) { - for (auto const& assertion : sectionNode.assertions) - writeAssertion(assertion, okToFail); + for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) { + if (assertionOrBenchmark.isAssertion()) { + writeAssertion(assertionOrBenchmark.asAssertion(), okToFail); + } + } } void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { @@ -8669,26 +9636,26 @@ namespace Catch { XmlWriter::ScopedElement e = xml.scopedElement(elementName); ReusableStringStream messageRss; - messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; - xml.writeAttribute("message", messageRss.str()); + messageRss << result.getTestMacroName() << '(' << result.getExpression() << ')'; + xml.writeAttribute("message"_sr, messageRss.str()); ReusableStringStream textRss; if (stats.totals.assertions.total() > 0) { textRss << "FAILED:\n"; if (result.hasExpression()) { - textRss << "\t" << result.getExpressionInMacro() << "\n"; + textRss << '\t' << result.getExpressionInMacro() << '\n'; } if (result.hasExpandedExpression()) { - textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; + textRss << "with expansion:\n\t" << result.getExpandedExpression() << '\n'; } } if (!result.getMessage().empty()) - textRss << result.getMessage() << "\n"; + textRss << result.getMessage() << '\n'; for (auto const& msg : stats.infoMessages) if (msg.type == ResultWas::Info) - textRss << msg.message << "\n"; + textRss << msg.message << '\n'; textRss << "at " << result.getSourceInfo(); xml.writeText(textRss.str(), XmlFormatting::Newline); @@ -8708,19 +9675,8 @@ namespace Catch { 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 @@ -8728,6 +9684,7 @@ namespace Catch { #include <algorithm> +#include <iterator> #include <ostream> namespace Catch { @@ -8737,18 +9694,20 @@ namespace Catch { // Making older compiler happy is hard. static constexpr StringRef tapFailedString = "not ok"_sr; static constexpr StringRef tapPassedString = "ok"_sr; + static constexpr Colour::Code tapDimColour = Colour::FileName; class TapAssertionPrinter { public: TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete; TapAssertionPrinter(TapAssertionPrinter const&) = delete; - TapAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter) + TapAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter, ColourImpl* colour_) : stream(_stream) , result(_stats.assertionResult) , messages(_stats.infoMessages) , itMessage(_stats.infoMessages.begin()) , printInfoMessages(true) - , counter(_counter) {} + , counter(_counter) + , colourImpl( colour_ ) {} void print() { itMessage = messages.begin(); @@ -8821,13 +9780,6 @@ namespace Catch { } 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 << " -"; @@ -8841,10 +9793,8 @@ namespace Catch { void printExpressionWas() { if (result.hasExpression()) { stream << ';'; - { - Colour colour(dimColour()); - stream << " expression was:"; - } + stream << colourImpl->guardColour( tapDimColour ) + << " expression was:"; printOriginalExpression(); } } @@ -8857,10 +9807,8 @@ namespace Catch { void printReconstructedExpression() const { if (result.hasExpandedExpression()) { - { - Colour colour(dimColour()); - stream << " for: "; - } + stream << colourImpl->guardColour( tapDimColour ) << " for: "; + std::string expr = result.getExpandedExpression(); std::replace(expr.begin(), expr.end(), '\n', ' '); stream << expr; @@ -8874,7 +9822,7 @@ namespace Catch { } } - void printRemainingMessages(Colour::Code colour = dimColour()) { + void printRemainingMessages(Colour::Code colour = tapDimColour) { if (itMessage == messages.end()) { return; } @@ -8883,18 +9831,15 @@ namespace Catch { 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") << ':'; - } + stream << colourImpl->guardColour( colour ) << " with " + << pluralise( N, "message"_sr ) << ':'; 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"; + stream << colourImpl->guardColour(tapDimColour) << " and"; } } } @@ -8907,33 +9852,35 @@ namespace Catch { std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; std::size_t counter; + ColourImpl* colourImpl; }; } // End anonymous namespace - TAPReporter::~TAPReporter() {} + void TAPReporter::testRunStarting( TestRunInfo const& ) { + m_stream << "# rng-seed: " << m_config->rngSeed() << '\n'; + } - void TAPReporter::noMatchingTestCases(std::string const& spec) { - stream << "# No test cases matched '" << spec << "'\n"; + void TAPReporter::noMatchingTestCases( StringRef unmatchedSpec ) { + m_stream << "# No test cases matched '" << unmatchedSpec << "'\n"; } - bool TAPReporter::assertionEnded(AssertionStats const& _assertionStats) { + void TAPReporter::assertionEnded(AssertionStats const& _assertionStats) { ++counter; - stream << "# " << currentTestCaseInfo->name << '\n'; - TapAssertionPrinter printer(stream, _assertionStats, counter); + m_stream << "# " << currentTestCaseInfo->name << '\n'; + TapAssertionPrinter printer(m_stream, _assertionStats, counter, m_colour.get()); printer.print(); - stream << '\n' << std::flush; - return true; + m_stream << '\n' << std::flush; } void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) { - stream << "1.." << _testRunStats.totals.assertions.total(); + m_stream << "1.." << _testRunStats.totals.assertions.total(); if (_testRunStats.totals.testCases.total() == 0) { - stream << " # Skipped: No tests ran."; + m_stream << " # Skipped: No tests ran."; } - stream << "\n\n" << std::flush; + m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } @@ -8946,6 +9893,7 @@ namespace Catch { #include <cassert> +#include <ostream> namespace Catch { @@ -8963,8 +9911,8 @@ namespace Catch { .initialIndent(indent) << '\n'; } - std::string escape(std::string const& str) { - std::string escaped = str; + std::string escape(StringRef str) { + std::string escaped = static_cast<std::string>(str); replaceInPlace(escaped, "|", "||"); replaceInPlace(escaped, "'", "|'"); replaceInPlace(escaped, "\n", "|n"); @@ -8978,19 +9926,17 @@ namespace Catch { TeamCityReporter::~TeamCityReporter() {} - void TeamCityReporter::testGroupStarting(GroupInfo const& groupInfo) { - StreamingReporterBase::testGroupStarting(groupInfo); - stream << "##teamcity[testSuiteStarted name='" - << escape(groupInfo.name) << "']\n"; + void TeamCityReporter::testRunStarting( TestRunInfo const& runInfo ) { + m_stream << "##teamcity[testSuiteStarted name='" << escape( runInfo.name ) + << "']\n"; } - void TeamCityReporter::testGroupEnded(TestGroupStats const& testGroupStats) { - StreamingReporterBase::testGroupEnded(testGroupStats); - stream << "##teamcity[testSuiteFinished name='" - << escape(testGroupStats.groupInfo.name) << "']\n"; + void TeamCityReporter::testRunEnded( TestRunStats const& runStats ) { + m_stream << "##teamcity[testSuiteFinished name='" + << escape( runStats.runInfo.name ) << "']\n"; } - bool TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { + void TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { AssertionResult const& result = assertionStats.assertionResult; if (!result.isOk()) { @@ -9046,44 +9992,43 @@ namespace Catch { if (currentTestCaseInfo->okToFail()) { msg << "- failure ignore as test marked as 'ok to fail'\n"; - stream << "##teamcity[testIgnored" + m_stream << "##teamcity[testIgnored" << " name='" << escape(currentTestCaseInfo->name) << '\'' << " message='" << escape(msg.str()) << '\'' << "]\n"; } else { - stream << "##teamcity[testFailed" + m_stream << "##teamcity[testFailed" << " name='" << escape(currentTestCaseInfo->name) << '\'' << " message='" << escape(msg.str()) << '\'' << "]\n"; } } - stream.flush(); - return true; + m_stream.flush(); } void TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) { m_testTimer.start(); StreamingReporterBase::testCaseStarting(testInfo); - stream << "##teamcity[testStarted name='" + m_stream << "##teamcity[testStarted name='" << escape(testInfo.name) << "']\n"; - stream.flush(); + m_stream.flush(); } void TeamCityReporter::testCaseEnded(TestCaseStats const& testCaseStats) { StreamingReporterBase::testCaseEnded(testCaseStats); auto const& testCaseInfo = *testCaseStats.testInfo; if (!testCaseStats.stdOut.empty()) - stream << "##teamcity[testStdOut name='" + m_stream << "##teamcity[testStdOut name='" << escape(testCaseInfo.name) << "' out='" << escape(testCaseStats.stdOut) << "']\n"; if (!testCaseStats.stdErr.empty()) - stream << "##teamcity[testStdErr name='" + m_stream << "##teamcity[testStdErr name='" << escape(testCaseInfo.name) << "' out='" << escape(testCaseStats.stdErr) << "']\n"; - stream << "##teamcity[testFinished name='" + m_stream << "##teamcity[testFinished name='" << escape(testCaseInfo.name) << "' duration='" << m_testTimer.getElapsedMilliseconds() << "']\n"; - stream.flush(); + m_stream.flush(); } void TeamCityReporter::printSectionHeader(std::ostream& os) { @@ -9119,9 +10064,9 @@ namespace Catch { #endif namespace Catch { - XmlReporter::XmlReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ), - m_xml(_config.stream()) + XmlReporter::XmlReporter( ReporterConfig&& _config ) + : StreamingReporterBase( CATCH_MOVE(_config) ), + m_xml(m_stream) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; @@ -9139,12 +10084,8 @@ namespace Catch { 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 ); + .writeAttribute( "filename"_sr, sourceInfo.file ) + .writeAttribute( "line"_sr, sourceInfo.line ); } void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { @@ -9152,27 +10093,19 @@ namespace Catch { 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() ); + m_xml.startElement("Catch2TestRun") + .writeAttribute("name"_sr, m_config->name()) + .writeAttribute("rng-seed"_sr, m_config->rngSeed()) + .writeAttribute("catch2-version"_sr, libraryVersion()); 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 ); + m_xml.writeAttribute( "filters"_sr, serializeFilters( m_config->getTestsOrTags() ) ); } void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) - .writeAttribute( "name", trim( testInfo.name ) ) - .writeAttribute( "tags", testInfo.tagsAsString() ); + .writeAttribute( "name"_sr, trim( testInfo.name ) ) + .writeAttribute( "tags"_sr, testInfo.tagsAsString() ); writeSourceInfo( testInfo.lineInfo ); @@ -9185,7 +10118,7 @@ namespace Catch { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name", trim( sectionInfo.name ) ); + .writeAttribute( "name"_sr, trim( sectionInfo.name ) ); writeSourceInfo( sectionInfo.lineInfo ); m_xml.ensureTagClosed(); } @@ -9193,7 +10126,7 @@ namespace Catch { void XmlReporter::assertionStarting( AssertionInfo const& ) { } - bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { + void XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { AssertionResult const& result = assertionStats.assertionResult; @@ -9214,14 +10147,14 @@ namespace Catch { // Drop out if result was successful but we're not printing them. if( !includeResults && result.getResultType() != ResultWas::Warning ) - return true; + return; // Print the expression if there is one. if( result.hasExpression() ) { m_xml.startElement( "Expression" ) - .writeAttribute( "success", result.succeeded() ) - .writeAttribute( "type", result.getTestMacroName() ); + .writeAttribute( "success"_sr, result.succeeded() ) + .writeAttribute( "type"_sr, result.getTestMacroName() ); writeSourceInfo( result.getSourceInfo() ); @@ -9247,7 +10180,7 @@ namespace Catch { break; case ResultWas::Info: m_xml.scopedElement( "Info" ) - .writeText( result.getMessage() ); + .writeText( result.getMessage() ); break; case ResultWas::Warning: // Warning will already have been written @@ -9264,20 +10197,18 @@ namespace Catch { 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 ); + e.writeAttribute( "successes"_sr, sectionStats.assertions.passed ); + e.writeAttribute( "failures"_sr, sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk ); if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds ); m_xml.endElement(); } @@ -9286,10 +10217,10 @@ namespace Catch { void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { StreamingReporterBase::testCaseEnded( testCaseStats ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); - e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + e.writeAttribute( "success"_sr, testCaseStats.totals.assertions.allOk() ); if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + e.writeAttribute( "durationInSeconds"_sr, m_testCaseTimer.getElapsedSeconds() ); if( !testCaseStats.stdOut.empty() ) m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); @@ -9299,77 +10230,63 @@ namespace Catch { 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 ); + .writeAttribute( "successes"_sr, testRunStats.totals.assertions.passed ) + .writeAttribute( "failures"_sr, testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures"_sr, 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 ); + .writeAttribute( "successes"_sr, testRunStats.totals.testCases.passed ) + .writeAttribute( "failures"_sr, testRunStats.totals.testCases.failed ) + .writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk ); m_xml.endElement(); } - void XmlReporter::benchmarkPreparing(std::string const& name) { + void XmlReporter::benchmarkPreparing( StringRef name ) { m_xml.startElement("BenchmarkResults") - .writeAttribute("name", name); + .writeAttribute("name"_sr, 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"); + m_xml.writeAttribute("samples"_sr, info.samples) + .writeAttribute("resamples"_sr, info.resamples) + .writeAttribute("iterations"_sr, info.iterations) + .writeAttribute("clockResolution"_sr, info.clockResolution) + .writeAttribute("estimatedDuration"_sr, info.estimatedDuration) + .writeComment("All values in nano seconds"_sr); } 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); + .writeAttribute("value"_sr, benchmarkStats.mean.point.count()) + .writeAttribute("lowerBound"_sr, benchmarkStats.mean.lower_bound.count()) + .writeAttribute("upperBound"_sr, benchmarkStats.mean.upper_bound.count()) + .writeAttribute("ci"_sr, 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); + .writeAttribute("value"_sr, benchmarkStats.standardDeviation.point.count()) + .writeAttribute("lowerBound"_sr, benchmarkStats.standardDeviation.lower_bound.count()) + .writeAttribute("upperBound"_sr, benchmarkStats.standardDeviation.upper_bound.count()) + .writeAttribute("ci"_sr, 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); + .writeAttribute("variance"_sr, benchmarkStats.outlierVariance) + .writeAttribute("lowMild"_sr, benchmarkStats.outliers.low_mild) + .writeAttribute("lowSevere"_sr, benchmarkStats.outliers.low_severe) + .writeAttribute("highMild"_sr, benchmarkStats.outliers.high_mild) + .writeAttribute("highSevere"_sr, benchmarkStats.outliers.high_severe); m_xml.endElement(); m_xml.endElement(); } - void XmlReporter::benchmarkFailed(std::string const &error) { + void XmlReporter::benchmarkFailed(StringRef error) { m_xml.scopedElement("failed"). - writeAttribute("message", error); + writeAttribute("message"_sr, error); m_xml.endElement(); } - void XmlReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const&) { + 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"); @@ -9382,7 +10299,20 @@ namespace Catch { } } - void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const&) { + void XmlReporter::listListeners(std::vector<ListenerDescription> const& descriptions) { + auto outerTag = m_xml.scopedElement( "RegisteredListeners" ); + for ( auto const& listener : descriptions ) { + auto inner = m_xml.scopedElement( "Listener" ); + m_xml.startElement( "Name", XmlFormatting::Indent ) + .writeText( listener.name, XmlFormatting::None ) + .endElement( XmlFormatting::Newline ); + m_xml.startElement( "Description", XmlFormatting::Indent ) + .writeText( listener.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"); @@ -9407,7 +10337,7 @@ namespace Catch { } } - void XmlReporter::listTags(std::vector<TagInfo> const& tags, IConfig const&) { + 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"); @@ -9417,7 +10347,7 @@ namespace Catch { 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) + .writeText(alias, XmlFormatting::None) .endElement(XmlFormatting::Newline); } } diff --git a/packages/Catch2/extras/catch_amalgamated.hpp b/packages/Catch2/extras/catch_amalgamated.hpp index dd77291a9d3df7f814954f75f66022d91ec05448..757e10c5ac5bb9fe164244c809edc189a931c40f 100644 --- a/packages/Catch2/extras/catch_amalgamated.hpp +++ b/packages/Catch2/extras/catch_amalgamated.hpp @@ -5,8 +5,8 @@ // SPDX-License-Identifier: BSL-1.0 -// Catch v3.0.0-preview.3 -// Generated: 2020-10-08 13:59:26.309308 +// Catch v3.1.0 +// Generated: 2022-07-17 20:14:04.055157 // ---------------------------------------------------------- // This file is an amalgamation of multiple different files. // You probably shouldn't edit it directly. @@ -86,6 +86,117 @@ namespace Catch { #endif // CATCH_NONCOPYABLE_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 other ) const noexcept -> bool; + auto operator != (StringRef 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 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 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 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 sr); + friend std::ostream& operator << (std::ostream& os, StringRef sr); + friend std::string operator+(StringRef lhs, StringRef rhs); + + /** + * Provides a three-way comparison with rhs + * + * Returns negative number if lhs < rhs, 0 if lhs == rhs, and a positive + * number if lhs > rhs + */ + int compare( StringRef rhs ) const; + }; + + + 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 + #include <chrono> #include <iosfwd> #include <string> @@ -101,8 +212,10 @@ namespace Catch { struct WarnAbout { enum What { Nothing = 0x00, + //! A test case or leaf section did not run any assertions NoAssertions = 0x01, - NoTests = 0x02 + //! A command line test spec matched no test cases + UnmatchedTestSpec = 0x02, }; }; enum class ShowDurations { @@ -115,10 +228,15 @@ namespace Catch { LexicographicallySorted, Randomized }; - enum class UseColour { - Auto, - Yes, - No + enum class ColourMode : std::uint8_t { + //! Let Catch2 pick implementation based on platform detection + PlatformDefault, + //! Use ANSI colour code escapes + ANSI, + //! Use Win32 console colour API + Win32, + //! Don't use any colour + None }; struct WaitForKeypress { enum When { Never, @@ -128,18 +246,19 @@ namespace Catch { }; }; class TestSpec; + class IStream; - struct IConfig : Detail::NonCopyable { - + class IConfig : public Detail::NonCopyable { + public: virtual ~IConfig(); virtual bool allowThrows() const = 0; - virtual std::ostream& stream() const = 0; - virtual std::string name() const = 0; + virtual StringRef name() const = 0; virtual bool includeSuccessfulResults() const = 0; virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; - virtual bool warnAboutNoTests() const = 0; + virtual bool warnAboutUnmatchedTestSpecs() const = 0; + virtual bool zeroTestsCountAsSuccess() const = 0; virtual int abortAfter() const = 0; virtual bool showInvisibles() const = 0; virtual ShowDurations showDurations() const = 0; @@ -148,13 +267,16 @@ namespace Catch { 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 uint32_t rngSeed() const = 0; + virtual unsigned int shardCount() const = 0; + virtual unsigned int shardIndex() const = 0; + virtual ColourMode defaultColourMode() const = 0; virtual std::vector<std::string> const& getSectionsToRun() const = 0; virtual Verbosity verbosity() const = 0; + virtual bool skipBenchmarks() const = 0; virtual bool benchmarkNoAnalysis() const = 0; - virtual int benchmarkSamples() const = 0; + virtual unsigned int benchmarkSamples() const = 0; virtual double benchmarkConfidenceInterval() const = 0; virtual unsigned int benchmarkResamples() const = 0; virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; @@ -164,82 +286,12 @@ namespace Catch { #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? @@ -258,13 +310,16 @@ namespace Catch { #ifndef CATCH_PLATFORM_HPP_INCLUDED #define CATCH_PLATFORM_HPP_INCLUDED +// See e.g.: +// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html #ifdef __APPLE__ -# include <TargetConditionals.h> -# if TARGET_OS_OSX == 1 -# define CATCH_PLATFORM_MAC -# elif TARGET_OS_IPHONE == 1 -# define CATCH_PLATFORM_IPHONE -# endif +# include <TargetConditionals.h> +# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ + (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) +# define CATCH_PLATFORM_MAC +# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) +# define CATCH_PLATFORM_IPHONE +# endif #elif defined(linux) || defined(__linux) || defined(__linux__) # define CATCH_PLATFORM_LINUX @@ -287,9 +342,9 @@ namespace Catch { #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__) +// Only GCC compiler should be used in this block, so other compilers trying to +// mask themselves as GCC should be ignored. +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) @@ -305,11 +360,23 @@ namespace Catch { #endif -#if defined(__clang__) +#if defined(__CUDACC__) && !defined(__clang__) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic pop" ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "nv_diag_suppress 177" ) +#endif + +// clang-cl defines _MSC_VER as well as __clang__, which could cause the +// start/stop internal suppression macros to be double defined. +#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" ) +#endif // __clang__ && !_MSC_VER + +#if defined(__clang__) + // 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 @@ -320,8 +387,13 @@ namespace Catch { // REQUIRE(std::string("12") + "34" == "1234") // ``` // +// Similarly, NVHPC's implementation of `__builtin_constant_p` has a bug which +// results in calls to the immediately evaluated lambda expressions to be +// reported as unevaluated lambdas. +// https://developer.nvidia.com/nvidia_bug/3321845. +// // Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) +# if !defined(__ibmxl__) && !defined(__CUDACC__) && !defined( __NVCOMPILER ) # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ # endif @@ -359,14 +431,12 @@ namespace Catch { #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 //////////////////////////////////////////////////////////////////////////////// @@ -408,7 +478,7 @@ namespace Catch { // 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 +# define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 # else # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH # endif @@ -435,11 +505,6 @@ namespace Catch { # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED #endif -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build @@ -447,18 +512,6 @@ namespace Catch { #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. @@ -467,7 +520,7 @@ namespace Catch { #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 + #define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 #endif #if !defined(_GLIBCXX_USE_C99_MATH_TR1) @@ -489,7 +542,7 @@ namespace Catch { // Check if byte is available and usable # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) # include <cstddef> - # if __cpp_lib_byte > 0 + # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) # define CATCH_INTERNAL_CONFIG_CPP17_BYTE # endif # endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) @@ -512,9 +565,6 @@ namespace Catch { #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 @@ -522,10 +572,6 @@ namespace Catch { #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 @@ -556,7 +602,9 @@ namespace Catch { # define CATCH_CONFIG_NEW_CAPTURE #endif -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#if !defined( CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED ) && \ + !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) && \ + !defined( CATCH_CONFIG_NO_DISABLE_EXCEPTIONS ) # define CATCH_CONFIG_DISABLE_EXCEPTIONS #endif @@ -568,10 +616,6 @@ namespace Catch { # 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 @@ -628,135 +672,98 @@ namespace Catch { #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #endif -#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED +#if defined( CATCH_PLATFORM_WINDOWS ) && \ + !defined( CATCH_CONFIG_COLOUR_WIN32 ) && \ + !defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) && \ + !defined( CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 ) +# define CATCH_CONFIG_COLOUR_WIN32 +#endif -#ifndef CATCH_STRINGREF_HPP_INCLUDED -#define CATCH_STRINGREF_HPP_INCLUDED +#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED -#include <cstddef> -#include <string> -#include <iosfwd> -#include <cassert> + +#ifndef CATCH_CONTEXT_HPP_INCLUDED +#define CATCH_CONTEXT_HPP_INCLUDED 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 { + class IResultCapture; + class IConfig; + + class IContext { public: - using size_type = std::size_t; - using const_iterator = const char*; + virtual ~IContext(); // = default + + virtual IResultCapture* getResultCapture() = 0; + virtual IConfig const* getConfig() const = 0; + }; + + class IMutableContext : public IContext { + public: + ~IMutableContext() override; // = default + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setConfig( IConfig const* config ) = 0; private: - static constexpr char const* const s_empty = ""; + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; - char const* m_start = s_empty; - size_type m_size = 0; + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *IMutableContext::currentContext; + } - public: // construction - constexpr StringRef() noexcept = default; + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } - StringRef( char const* rawChars ) noexcept; + void cleanUpContext(); - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} + class SimplePcg32; + SimplePcg32& sharedRng(); +} - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} +#endif // CATCH_CONTEXT_HPP_INCLUDED - 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); - } +#ifndef CATCH_INTERFACES_REPORTER_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_HPP_INCLUDED - 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; - } +#ifndef CATCH_SECTION_INFO_HPP_INCLUDED +#define CATCH_SECTION_INFO_HPP_INCLUDED - 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; } +#ifndef CATCH_MOVE_AND_FORWARD_HPP_INCLUDED +#define CATCH_MOVE_AND_FORWARD_HPP_INCLUDED - 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); - }; +#include <type_traits> +//! Replacement for std::move with better compile time performance +#define CATCH_MOVE(...) static_cast<std::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__) - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } -} // namespace Catch +//! Replacement for std::forward with better compile time performance +#define CATCH_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__) -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} +#endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED -#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 +#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED +#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED +#include <cstddef> #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 { @@ -775,39 +782,18 @@ namespace Catch { 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 +#endif // CATCH_SOURCE_LINE_INFO_HPP_INCLUDED #ifndef CATCH_TOTALS_HPP_INCLUDED #define CATCH_TOTALS_HPP_INCLUDED -#include <cstddef> +#include <cstdint> namespace Catch { @@ -815,13 +801,13 @@ namespace Catch { Counts operator - ( Counts const& other ) const; Counts& operator += ( Counts const& other ); - std::size_t total() const; + std::uint64_t total() const; bool allPassed() const; bool allOk() const; - std::size_t passed = 0; - std::size_t failed = 0; - std::size_t failedButOk = 0; + std::uint64_t passed = 0; + std::uint64_t failed = 0; + std::uint64_t failedButOk = 0; }; struct Totals { @@ -831,7 +817,6 @@ namespace Catch { Totals delta( Totals const& prevTotals ) const; - int error = 0; Counts assertions; Counts testCases; }; @@ -849,7 +834,7 @@ namespace Catch { // still use the `-c` flag comfortably. SectionInfo( SourceLineInfo const& _lineInfo, std::string _name, const char* const = nullptr ): - name(std::move(_name)), + name(CATCH_MOVE(_name)), lineInfo(_lineInfo) {} @@ -871,7 +856,6 @@ namespace Catch { #ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED #define CATCH_ASSERTION_RESULT_HPP_INCLUDED -#include <string> #ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED @@ -951,7 +935,7 @@ namespace Catch { namespace Catch { - struct ITransientExpression; + class ITransientExpression; class LazyExpression { friend class AssertionHandler; @@ -978,6 +962,8 @@ namespace Catch { #endif // CATCH_LAZY_EXPR_HPP_INCLUDED +#include <string> + namespace Catch { struct AssertionResultData @@ -1008,7 +994,7 @@ namespace Catch { std::string getExpressionInMacro() const; bool hasExpandedExpression() const; std::string getExpandedExpression() const; - std::string getMessage() const; + StringRef getMessage() const; SourceLineInfo getSourceInfo() const; StringRef getTestMacroName() const; @@ -1046,15 +1032,15 @@ namespace Catch { struct AssertionReaction; struct SourceLineInfo; - struct ITransientExpression; - struct IGeneratorTracker; + class ITransientExpression; + class IGeneratorTracker; struct BenchmarkInfo; template <typename Duration = std::chrono::duration<double, std::nano>> struct BenchmarkStats; - struct IResultCapture { - + class IResultCapture { + public: virtual ~IResultCapture(); virtual bool sectionStarted( SectionInfo const& sectionInfo, @@ -1064,10 +1050,10 @@ namespace Catch { virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; - virtual void benchmarkPreparing( std::string const& name ) = 0; + virtual void benchmarkPreparing( StringRef 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 benchmarkFailed( StringRef error ) = 0; virtual void pushScopedMessage( MessageInfo const& message ) = 0; virtual void popScopedMessage( MessageInfo const& message ) = 0; @@ -1083,7 +1069,7 @@ namespace Catch { virtual void handleMessage ( AssertionInfo const& info, ResultWas::OfType resultType, - StringRef const& message, + StringRef message, AssertionReaction& reaction ) = 0; virtual void handleUnexpectedExceptionNotThrown ( AssertionInfo const& info, @@ -1120,7 +1106,7 @@ namespace Catch { namespace Catch { struct MessageInfo { - MessageInfo( StringRef const& _macroName, + MessageInfo( StringRef _macroName, SourceLineInfo const& _lineInfo, ResultWas::OfType _type ); @@ -1151,11 +1137,14 @@ namespace Catch { #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 + /** + * A reimplementation of `std::unique_ptr` for improved compilation performance + * + * Does not support arrays nor custom deleters. + */ template <typename T> class unique_ptr { T* m_ptr; @@ -1204,7 +1193,11 @@ namespace Detail { assert(m_ptr); return *m_ptr; } - T* operator->() const noexcept { + T* operator->() noexcept { + assert(m_ptr); + return m_ptr; + } + T const* operator->() const noexcept { assert(m_ptr); return m_ptr; } @@ -1234,20 +1227,13 @@ namespace Detail { } }; - // 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? + //! Specialization to cause compile-time error for arrays 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)...)); + return unique_ptr<T>(new T(CATCH_FORWARD(args)...)); } @@ -1257,7 +1243,6 @@ namespace Detail { #endif // CATCH_UNIQUE_PTR_HPP_INCLUDED - // Adapted from donated nonius code. #ifndef CATCH_ESTIMATE_HPP_INCLUDED @@ -1307,6 +1292,7 @@ namespace Catch { #endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED +#include <map> #include <string> #include <vector> #include <iosfwd> @@ -1314,36 +1300,39 @@ namespace Catch { namespace Catch { struct ReporterDescription; + struct ListenerDescription; struct TagInfo; struct TestCaseInfo; class TestCaseHandle; - struct IConfig; + class IConfig; + class IStream; + enum class ColourMode : std::uint8_t; struct ReporterConfig { - explicit ReporterConfig( IConfig const* _fullConfig ); + ReporterConfig( IConfig const* _fullConfig, + Detail::unique_ptr<IStream> _stream, + ColourMode colourMode, + std::map<std::string, std::string> customOptions ); - ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ); + ReporterConfig( ReporterConfig&& ) = default; + ReporterConfig& operator=( ReporterConfig&& ) = default; + ~ReporterConfig(); // = default - std::ostream& stream() const; + Detail::unique_ptr<IStream> takeStream() &&; IConfig const* fullConfig() const; + ColourMode colourMode() const; + std::map<std::string, std::string> const& customOptions() const; private: - std::ostream* m_stream; + Detail::unique_ptr<IStream> m_stream; IConfig const* m_fullConfig; + ColourMode m_colourMode; + std::map<std::string, std::string> m_customOptions; }; 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; + constexpr TestRunInfo(StringRef _name) : name(_name) {} + StringRef name; }; struct AssertionStats { @@ -1387,17 +1376,6 @@ namespace Catch { 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, @@ -1413,7 +1391,7 @@ namespace Catch { std::string name; double estimatedDuration; int iterations; - int samples; + unsigned int samples; unsigned int resamples; double clockResolution; double clockCost; @@ -1430,7 +1408,7 @@ namespace Catch { double outlierVariance; template <typename Duration2> - explicit operator BenchmarkStats<Duration2>() const { + operator BenchmarkStats<Duration2>() const { std::vector<Duration2> samples2; samples2.reserve(samples.size()); for (auto const& sample : samples) { @@ -1438,7 +1416,7 @@ namespace Catch { } return { info, - std::move(samples2), + CATCH_MOVE(samples2), mean, standardDeviation, outliers, @@ -1459,13 +1437,29 @@ namespace Catch { bool shouldReportAllAssertions = false; }; - - struct IStreamingReporter { + /** + * The common base for all reporters and event listeners + * + * Implementing classes must also implement: + * + * //! User-friendly description of the reporter/listener type + * static std::string getDescription() + * + * Generally shouldn't be derived from by users of Catch2 directly, + * instead they should derive from one of the utility bases that + * derive from this class. + */ + class IEventListener { 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: - virtual ~IStreamingReporter() = default; + IEventListener( IConfig const* config ): m_config( config ) {} + + virtual ~IEventListener(); // = default; // Implementing class must also provide the following static methods: // static std::string getDescription(); @@ -1474,51 +1468,115 @@ namespace Catch { return m_preferences; } - virtual void noMatchingTestCases( std::string const& spec ) = 0; - - virtual void reportInvalidArguments(std::string const&) {} + //! Called when no test cases match provided test spec + virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0; + //! Called for all invalid test specs from the cli + virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0; + /** + * Called once in a testing run before tests are started + * + * Not called if tests won't be run (e.g. only listing will happen) + */ virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; - virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; + //! Called _once_ for each TEST_CASE, no matter how many times it is entered virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; + //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections) + virtual void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) = 0; + //! Called when a `SECTION` is being entered. Not called for skipped sections 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& ) {} + //! Called when user-code is being probed before the actual benchmark runs + virtual void benchmarkPreparing( StringRef benchmarkName ) = 0; + //! Called after probe but before the user-code is being benchmarked + virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0; + //! Called with the benchmark results if benchmark successfully finishes + virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0; + //! Called if running the benchmarks fails for any reason + virtual void benchmarkFailed( StringRef benchmarkName ) = 0; + //! Called before assertion success/failure is evaluated 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; + //! Called after assertion was fully evaluated + virtual void assertionEnded( AssertionStats const& assertionStats ) = 0; + //! Called after a `SECTION` has finished running virtual void sectionEnded( SectionStats const& sectionStats ) = 0; + //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections) + virtual void testCasePartialEnded(TestCaseStats const& testCaseStats, uint64_t partNumber ) = 0; + //! Called _once_ for each TEST_CASE, no matter how many times it is entered virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; + /** + * Called once after all tests in a testing run are finished + * + * Not called if tests weren't run (e.g. only listings happened) + */ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + //! Called with test cases that are skipped due to the test run aborting virtual void skipTest( TestCaseInfo const& testInfo ) = 0; - // Default empty implementation provided - virtual void fatalErrorEncountered( StringRef name ); + //! Called if a fatal error (signal/structured exception) occured + virtual void fatalErrorEncountered( StringRef error ) = 0; //! Writes out information about provided reporters using reporter-specific format - virtual void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config); + virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0; + //! Writes out the provided listeners descriptions using reporter-specific format + virtual void listListeners(std::vector<ListenerDescription> const& descriptions) = 0; //! Writes out information about provided tests using reporter-specific format - virtual void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config); + 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, IConfig const& config); - + virtual void listTags(std::vector<TagInfo> const& tags) = 0; }; - using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; } // end namespace Catch #endif // CATCH_INTERFACES_REPORTER_HPP_INCLUDED +#ifndef CATCH_UNIQUE_NAME_HPP_INCLUDED +#define CATCH_UNIQUE_NAME_HPP_INCLUDED + + + + +/** \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 +#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 + +#endif // CATCH_UNIQUE_NAME_HPP_INCLUDED + // Adapted from donated nonius code. @@ -1570,8 +1628,8 @@ namespace Catch { # include <atomic> // atomic_thread_fence #endif + #include <type_traits> -#include <utility> namespace Catch { namespace Benchmark { @@ -1612,13 +1670,13 @@ namespace Catch { } 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...))); + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t<!std::is_same<void, decltype(fn(args...))>::value> { + deoptimize_value(CATCH_FORWARD(fn) (CATCH_FORWARD(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...)); + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t<std::is_same<void, decltype(fn(args...))>::value> { + CATCH_FORWARD(fn) (CATCH_FORWARD(args)...); } } // namespace Benchmark } // namespace Catch @@ -1633,113 +1691,17 @@ namespace Catch { -#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> +#ifndef CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED +#define CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 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) + //! Used to signal that an assertion macro failed + struct TestFailureException{}; +} // namespace Catch -#endif // CATCH_ENFORCE_HPP_INCLUDED +#endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED #ifndef CATCH_META_HPP_INCLUDED @@ -1795,22 +1757,24 @@ namespace Catch { class TestCaseHandle; struct TestCaseInfo; - struct ITestCaseRegistry; - struct IExceptionTranslatorRegistry; - struct IExceptionTranslator; - struct IReporterRegistry; - struct IReporterFactory; - struct ITagAliasRegistry; - struct ITestInvoker; - struct IMutableEnumValuesRegistry; + class ITestCaseRegistry; + class IExceptionTranslatorRegistry; + class IExceptionTranslator; + class IReporterRegistry; + class IReporterFactory; + class ITagAliasRegistry; + class ITestInvoker; + class IMutableEnumValuesRegistry; struct SourceLineInfo; class StartupExceptionRegistry; + class EventListenerFactory; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; - struct IRegistryHub { - virtual ~IRegistryHub(); + class IRegistryHub { + public: + virtual ~IRegistryHub(); // = default virtual IReporterRegistry const& getReporterRegistry() const = 0; virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; @@ -1821,12 +1785,13 @@ namespace Catch { virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; }; - struct IMutableRegistryHub { - virtual ~IMutableRegistryHub(); + class IMutableRegistryHub { + public: + virtual ~IMutableRegistryHub(); // = default virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0; - virtual void registerListener( IReporterFactoryPtr factory ) = 0; + virtual void registerListener( Detail::unique_ptr<EventListenerFactory> 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 registerTranslator( Detail::unique_ptr<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; @@ -1842,7 +1807,6 @@ namespace Catch { #endif // CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED #include <type_traits> -#include <utility> namespace Catch { namespace Benchmark { @@ -1859,14 +1823,14 @@ namespace Catch { struct CompleteInvoker { template <typename Fun, typename... Args> static Result invoke(Fun&& fun, Args&&... args) { - return std::forward<Fun>(fun)(std::forward<Args>(args)...); + return CATCH_FORWARD(fun)(CATCH_FORWARD(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)...); + CATCH_FORWARD(fun)(CATCH_FORWARD(args)...); return {}; } }; @@ -1874,20 +1838,14 @@ namespace Catch { // 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)...); + return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(CATCH_FORWARD(fun), CATCH_FORWARD(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); - } + return Detail::complete_invoke(CATCH_FORWARD(fun)); } } // namespace Benchmark } // namespace Catch @@ -1921,7 +1879,7 @@ namespace Catch { struct Chronometer { public: template <typename Fun> - void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); } + void measure(Fun&& fun) { measure(CATCH_FORWARD(fun), is_callable<Fun(int)>()); } int runs() const { return repeats; } @@ -1996,18 +1954,14 @@ namespace Catch { #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>> {}; + : std::is_same<std::decay_t<T>, std::decay_t<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 @@ -2020,7 +1974,7 @@ namespace Catch { private: struct callable { virtual void call(Chronometer meter) const = 0; - virtual callable* clone() const = 0; + virtual Catch::Detail::unique_ptr<callable> clone() const = 0; virtual ~callable(); // = default; callable() = default; @@ -2029,10 +1983,12 @@ namespace Catch { }; template <typename Fun> struct model : public callable { - model(Fun&& fun_) : fun(std::move(fun_)) {} + model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {} model(Fun const& fun_) : fun(fun_) {} - model<Fun>* clone() const override { return new model<Fun>(*this); } + Catch::Detail::unique_ptr<callable> clone() const override { + return Catch::Detail::make_unique<model<Fun>>( *this ); + } void call(Chronometer meter) const override { call(meter, is_callable<Fun(Chronometer)>()); @@ -2057,24 +2013,24 @@ namespace Catch { : f(new model<do_nothing>{ {} }) {} template <typename Fun, - typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0> + std::enable_if_t<!is_related<Fun, BenchmarkFunction>::value, int> = 0> BenchmarkFunction(Fun&& fun) - : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {} + : f(new model<std::decay_t<Fun>>(CATCH_FORWARD(fun))) {} BenchmarkFunction( BenchmarkFunction&& that ) noexcept: - f( std::move( that.f ) ) {} + f( CATCH_MOVE( that.f ) ) {} BenchmarkFunction(BenchmarkFunction const& that) : f(that.f->clone()) {} BenchmarkFunction& operator=( BenchmarkFunction&& that ) noexcept { - f = std::move( that.f ); + f = CATCH_MOVE( that.f ); return *this; } BenchmarkFunction& operator=(BenchmarkFunction const& that) { - f.reset(that.f->clone()); + f = that.f->clone(); return *this; } @@ -2096,7 +2052,6 @@ namespace Catch { #define CATCH_REPEAT_HPP_INCLUDED #include <type_traits> -#include <utility> namespace Catch { namespace Benchmark { @@ -2111,8 +2066,8 @@ namespace Catch { Fun fun; }; template <typename Fun> - repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) { - return { std::forward<Fun>(fun) }; + repeater<std::decay_t<Fun>> repeat(Fun&& fun) { + return { CATCH_FORWARD(fun) }; } } // namespace Detail } // namespace Benchmark @@ -2158,18 +2113,16 @@ 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&& r = Detail::complete_invoke(fun, CATCH_FORWARD(args)...); auto end = Clock::now(); auto delta = end - start; - return { delta, std::forward<decltype(r)>(r), 1 }; + return { delta, CATCH_FORWARD(r), 1 }; } } // namespace Detail } // namespace Benchmark @@ -2177,7 +2130,6 @@ namespace Catch { #endif // CATCH_MEASURE_HPP_INCLUDED -#include <utility> #include <type_traits> namespace Catch { @@ -2192,24 +2144,27 @@ namespace Catch { Detail::ChronometerModel<Clock> meter; auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters)); - return { meter.elapsed(), std::move(result), iters }; + return { meter.elapsed(), CATCH_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; + using run_for_at_least_argument_t = std::conditional_t<is_callable<Fun(Chronometer)>::value, Chronometer, int>; [[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; + TimingOf<Clock, Fun, run_for_at_least_argument_t<Clock, Fun>> + run_for_at_least(ClockDuration<Clock> how_long, + const int initial_iterations, + Fun&& fun) { + auto iters = initial_iterations; 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 }; + return { Timing.elapsed, CATCH_MOVE(Timing.result), iters }; } iters *= 2; } @@ -2222,6 +2177,7 @@ namespace Catch { #endif // CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED #include <algorithm> +#include <iterator> namespace Catch { namespace Benchmark { @@ -2279,13 +2235,16 @@ namespace Catch { #include <numeric> #include <tuple> #include <cmath> -#include <utility> namespace Catch { namespace Benchmark { namespace Detail { using sample = std::vector<double>; + // Used when we know we want == comparison of two doubles + // to centralize warning suppression + bool directCompare( double lhs, double rhs ); + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); template <typename Iterator> @@ -2316,12 +2275,12 @@ namespace Catch { double mean(Iterator first, Iterator last) { auto count = last - first; double sum = std::accumulate(first, last, 0.); - return sum / count; + return sum / static_cast<double>(count); } template <typename Estimator, typename Iterator> sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { - auto n = last - first; + auto n = static_cast<size_t>(last - first); auto second = first; ++second; sample results; @@ -2362,23 +2321,26 @@ namespace Catch { }); 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; + long n = static_cast<long>(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 }; + if ( directCompare( 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 cumn = [n]( double x ) -> long { + return std::lround( normal_cdf( x ) * static_cast<double>(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); + auto lo = static_cast<size_t>((std::max)(cumn(a1), 0l)); + auto hi = static_cast<size_t>((std::min)(cumn(a2), n - 1)); return { point, resample[lo], resample[hi], confidence_level }; } @@ -2391,7 +2353,7 @@ namespace Catch { double outlier_variance; }; - bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + bootstrap_analysis analyse_samples(double confidence_level, unsigned int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); } // namespace Detail } // namespace Benchmark } // namespace Catch @@ -2409,11 +2371,11 @@ namespace Catch { template <typename Clock> std::vector<double> resolution(int k) { std::vector<TimePoint<Clock>> times; - times.reserve(k + 1); + times.reserve(static_cast<size_t>(k + 1)); std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); std::vector<double> deltas; - deltas.reserve(k); + deltas.reserve(static_cast<size_t>(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()); }); @@ -2447,7 +2409,9 @@ namespace Catch { } 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_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) { @@ -2461,7 +2425,7 @@ namespace Catch { 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); + times.reserve(static_cast<size_t>(nsamples)); std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); }); @@ -2473,7 +2437,14 @@ namespace Catch { template <typename Clock> Environment<FloatDuration<Clock>> measure_environment() { - static Environment<FloatDuration<Clock>>* env = nullptr; +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + static Catch::Detail::unique_ptr<Environment<FloatDuration<Clock>>> env; +#if defined(__clang__) +# pragma clang diagnostic pop +#endif if (env) { return *env; } @@ -2482,7 +2453,7 @@ namespace Catch { auto resolution = Detail::estimate_clock_resolution<Clock>(iters); auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean); - env = new Environment<FloatDuration<Clock>>{ resolution, cost }; + env = Catch::Detail::make_unique<Environment<FloatDuration<Clock>>>( Environment<FloatDuration<Clock>>{resolution, cost} ); return *env; } } // namespace Detail @@ -2507,7 +2478,6 @@ namespace Catch { #include <algorithm> #include <vector> -#include <string> #include <iterator> namespace Catch { @@ -2526,7 +2496,7 @@ namespace Catch { samples2.reserve(samples.size()); std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); return { - std::move(samples2), + CATCH_MOVE(samples2), mean, standard_deviation, outliers, @@ -2550,7 +2520,7 @@ namespace Catch { SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) { if (!cfg.benchmarkNoAnalysis()) { std::vector<double> samples; - samples.reserve(last - first); + samples.reserve(static_cast<size_t>(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()); @@ -2568,7 +2538,7 @@ namespace Catch { samples2.reserve(samples.size()); std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); return { - std::move(samples2), + CATCH_MOVE(samples2), wrap_estimate(analysis.mean), wrap_estimate(analysis.standard_deviation), outliers, @@ -2576,7 +2546,7 @@ namespace Catch { }; } else { std::vector<Duration> samples; - samples.reserve(last - first); + samples.reserve(static_cast<size_t>(last - first)); Duration mean = Duration(0); int i = 0; @@ -2587,7 +2557,7 @@ namespace Catch { mean /= i; return { - std::move(samples), + CATCH_MOVE(samples), Estimate<Duration>{mean, mean, mean, 0.0}, Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0}, OutlierClassification{}, @@ -2611,11 +2581,11 @@ namespace Catch { namespace Benchmark { struct Benchmark { Benchmark(std::string&& benchmarkName) - : name(std::move(benchmarkName)) {} + : name(CATCH_MOVE(benchmarkName)) {} template <class FUN> Benchmark(std::string&& benchmarkName , FUN &&func) - : fun(std::move(func)), name(std::move(benchmarkName)) {} + : fun(CATCH_MOVE(func)), name(CATCH_MOVE(benchmarkName)) {} template <typename Clock> ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { @@ -2657,19 +2627,24 @@ namespace Catch { 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_ANON (TestFailureException) { + getResultCapture().benchmarkFailed("Benchmark failed due to failed assertion"_sr); } CATCH_CATCH_ALL{ - if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow. - std::rethrow_exception(std::current_exception()); + getResultCapture().benchmarkFailed(translateActiveException()); + // We let the exception go further up so that the + // test case is marked as failed. + 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> + template <typename Fun, std::enable_if_t<!Detail::is_related<Fun, Benchmark>::value, int> = 0> Benchmark & operator=(Fun func) { - fun = Detail::BenchmarkFunction(func); - run(); + auto const* cfg = getCurrentContext().getConfig(); + if (!cfg->skipBenchmarks()) { + fun = Detail::BenchmarkFunction(func); + run(); + } return *this; } @@ -2698,16 +2673,16 @@ namespace Catch { #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__,,)) + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), 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) + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), 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__,,)) + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), 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) + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), name) #endif @@ -2719,6 +2694,7 @@ namespace Catch { #ifndef CATCH_CONSTRUCTOR_HPP_INCLUDED #define CATCH_CONSTRUCTOR_HPP_INCLUDED + #include <type_traits> namespace Catch { @@ -2727,9 +2703,7 @@ namespace Catch { template <typename T, bool Destruct> struct ObjectStorage { - using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; - - ObjectStorage() : data() {} + ObjectStorage() = default; ObjectStorage(const ObjectStorage& other) { @@ -2738,7 +2712,7 @@ namespace Catch { ObjectStorage(ObjectStorage&& other) { - new(&data) T(std::move(other.stored_object())); + new(data) T(CATCH_MOVE(other.stored_object())); } ~ObjectStorage() { destruct_on_exit<T>(); } @@ -2746,11 +2720,11 @@ namespace Catch { template <typename... Args> void construct(Args&&... args) { - new (&data) T(std::forward<Args>(args)...); + new (data) T(CATCH_FORWARD(args)...); } template <bool AllowManualDestruction = !Destruct> - typename std::enable_if<AllowManualDestruction>::type destruct() + std::enable_if_t<AllowManualDestruction> destruct() { stored_object().~T(); } @@ -2758,21 +2732,21 @@ namespace Catch { 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>(); } + void destruct_on_exit(std::enable_if_t<Destruct, U>* = nullptr) { destruct<true>(); } // Otherwise, don't template <typename U> - void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } + void destruct_on_exit(std::enable_if_t<!Destruct, U>* = nullptr) { } T& stored_object() { - return *static_cast<T*>(static_cast<void*>(&data)); + return *static_cast<T*>(static_cast<void*>(data)); } T const& stored_object() const { - return *static_cast<T*>(static_cast<void*>(&data)); + return *static_cast<T const*>(static_cast<void const*>(data)); } - TStorage data; + alignas( T ) unsigned char data[sizeof( T )]{}; }; } // namespace Detail @@ -2802,6 +2776,107 @@ namespace Catch { #include <cstddef> #include <type_traits> #include <string> +#include <string.h> + + + + +/** \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 + + +#ifndef CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED +#define CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED + + +#include <iosfwd> +#include <cstddef> +#include <ostream> +#include <string> + +namespace Catch { + + 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_REUSABLE_STRING_STREAM_HPP_INCLUDED + + +#ifndef CATCH_VOID_TYPE_HPP_INCLUDED +#define CATCH_VOID_TYPE_HPP_INCLUDED + + +namespace Catch { + namespace Detail { + + template <typename...> + struct make_void { using type = void; }; + + template <typename... Ts> + using void_t = typename make_void<Ts...>::type; + + } // namespace Detail +} // namespace Catch + + +#endif // CATCH_VOID_TYPE_HPP_INCLUDED #ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED @@ -2823,8 +2898,9 @@ namespace Catch { }; } // namespace Detail - struct IMutableEnumValuesRegistry { - virtual ~IMutableEnumValuesRegistry(); + class IMutableEnumValuesRegistry { + public: + virtual ~IMutableEnumValuesRegistry(); // = default; virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; @@ -2852,10 +2928,26 @@ namespace Catch { #pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless #endif +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy{}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + namespace Catch { + // Bring in global namespace operator<< for ADL lookup in + // `IsStreamInsertable` below. + using ::operator<<; + namespace Detail { - extern const std::string unprintableString; + + constexpr StringRef unprintableString = "{?}"_sr; + + //! Encases `string in quotes, and optionally escapes invisibles + std::string convertIntoString( StringRef string, bool escapeInvisibles ); + + //! Encases `string` in quotes, and escapes invisibles if user requested + //! it via CLI + std::string convertIntoString( StringRef string ); std::string rawMemoryToString( const void *object, std::size_t size ); @@ -2884,7 +2976,7 @@ namespace Catch { 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; + return std::string(Detail::unprintableString); } template<typename T> std::enable_if_t< @@ -2988,7 +3080,7 @@ namespace Catch { static std::string convert(char * str); }; -#ifdef CATCH_CONFIG_WCHAR +#if defined(CATCH_CONFIG_WCHAR) template<> struct StringMaker<std::wstring> { static std::string convert(const std::wstring& wstr); @@ -3009,26 +3101,33 @@ namespace Catch { struct StringMaker<wchar_t *> { static std::string convert(wchar_t * str); }; -#endif +#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> + template<size_t SZ> struct StringMaker<char[SZ]> { static std::string convert(char const* str) { - return ::Catch::Detail::stringify(std::string{ str }); + // Note that `strnlen` is not actually part of standard C++, + // but both POSIX and Windows cstdlib provide it. + return Detail::convertIntoString( + StringRef( str, strnlen( str, SZ ) ) ); } }; - template<int SZ> + template<size_t 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) }); + // See the plain `char const*` overload + auto reinterpreted = reinterpret_cast<char const*>(str); + return Detail::convertIntoString( + StringRef(reinterpreted, strnlen(reinterpreted, SZ))); } }; - template<int SZ> + template<size_t 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) }); + // See the plain `char const*` overload + auto reinterpreted = reinterpret_cast<char const*>(str); + return Detail::convertIntoString( + StringRef(reinterpreted, strnlen(reinterpreted, SZ))); } }; @@ -3189,13 +3288,11 @@ 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); + return ::Catch::Detail::stringify(*optional); } else { - rss << "{ }"; + return "{ }"; } - return rss.str(); } }; } @@ -3276,24 +3373,16 @@ namespace Catch { using std::begin; using std::end; - namespace detail { - template <typename...> - struct void_type { - using type = void; - }; - + namespace Detail { template <typename T, typename = void> - struct is_range_impl : std::false_type { - }; + 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 + struct is_range_impl<T, void_t<decltype(begin(std::declval<T>()))>> : std::true_type {}; + } // namespace Detail template <typename T> - struct is_range : detail::is_range_impl<T> { - }; + struct is_range : Detail::is_range_impl<T> {}; #if defined(_MANAGED) // Managed types are never ranges template <typename T> @@ -3331,7 +3420,7 @@ namespace Catch { } }; - template <typename T, int SZ> + template <typename T, size_t SZ> struct StringMaker<T[SZ]> { static std::string convert(T const(&arr)[SZ]) { return rangeToString(arr); @@ -3361,27 +3450,27 @@ struct ratio_string { template <> struct ratio_string<std::atto> { - static std::string symbol() { return "a"; } + static char symbol() { return 'a'; } }; template <> struct ratio_string<std::femto> { - static std::string symbol() { return "f"; } + static char symbol() { return 'f'; } }; template <> struct ratio_string<std::pico> { - static std::string symbol() { return "p"; } + static char symbol() { return 'p'; } }; template <> struct ratio_string<std::nano> { - static std::string symbol() { return "n"; } + static char symbol() { return 'n'; } }; template <> struct ratio_string<std::micro> { - static std::string symbol() { return "u"; } + static char symbol() { return 'u'; } }; template <> struct ratio_string<std::milli> { - static std::string symbol() { return "m"; } + static char symbol() { return 'm'; } }; //////////// @@ -3450,7 +3539,7 @@ struct ratio_string<std::milli> { #else std::strftime(timeStamp, timeStampSize, fmt, timeInfo); #endif - return std::string(timeStamp); + return std::string(timeStamp, timeStampSize - 1); } }; } @@ -3494,7 +3583,7 @@ namespace Catch { Approx operator-() const; template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> - Approx operator()( T const& value ) { + Approx operator()( T const& value ) const { Approx approx( static_cast<double>(value) ); approx.m_epsilon = m_epsilon; approx.m_margin = m_margin; @@ -3550,14 +3639,14 @@ namespace Catch { 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); + const auto 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); + const auto marginAsDouble = static_cast<double>(newMargin); setMargin(marginAsDouble); return *this; } @@ -3578,8 +3667,8 @@ namespace Catch { }; namespace literals { - Approx operator "" _a(long double val); - Approx operator "" _a(unsigned long long val); + Approx operator ""_a(long double val); + Approx operator ""_a(unsigned long long val); } // end namespace literals template<> @@ -3638,8 +3727,7 @@ namespace Catch public: WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity ); - virtual ~WildcardPattern() = default; - virtual bool matches( std::string const& str ) const; + bool matches( std::string const& str ) const; private: std::string normaliseString( std::string const& str ) const; @@ -3656,7 +3744,7 @@ namespace Catch namespace Catch { - struct IConfig; + class IConfig; struct TestCaseInfo; class TestCaseHandle; @@ -3707,11 +3795,11 @@ namespace Catch { bool hasFilters() const; bool matches( TestCaseInfo const& testCase ) const; Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const; - const vectorStrings & getInvalidArgs() const; + const vectorStrings & getInvalidSpecs() const; private: std::vector<Filter> m_filters; - std::vector<std::string> m_invalidArgs; + std::vector<std::string> m_invalidSpecs; friend class TestSpecParser; }; } @@ -3722,142 +3810,519 @@ namespace Catch { #endif // CATCH_TEST_SPEC_HPP_INCLUDED -#include <vector> -#include <string> + +#ifndef CATCH_OPTIONAL_HPP_INCLUDED +#define CATCH_OPTIONAL_HPP_INCLUDED + +#include <cassert> namespace Catch { - struct IStream; + // An optional type + template<typename T> + class Optional { + public: + Optional() : nullableValue( nullptr ) {} + Optional( T const& _value ) + : nullableValue( new( storage ) T( _value ) ) + {} + Optional( Optional const& _other ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) + {} - struct ConfigData { - bool listTests = false; - bool listTags = false; - bool listReporters = false; + ~Optional() { + reset(); + } - bool showSuccessfulTests = false; - bool shouldDebugBreak = false; - bool noThrow = false; - bool showHelp = false; - bool showInvisibles = false; - bool filenamesAsTags = false; - bool libIdentify = false; + Optional& operator= ( Optional const& _other ) { + if( &_other != this ) { + reset(); + if( _other ) + nullableValue = new( storage ) T( *_other ); + } + return *this; + } + Optional& operator = ( T const& _value ) { + reset(); + nullableValue = new( storage ) T( _value ); + return *this; + } - int abortAfter = -1; - unsigned int rngSeed = 0; + void reset() { + if( nullableValue ) + nullableValue->~T(); + nullableValue = nullptr; + } - bool benchmarkNoAnalysis = false; - unsigned int benchmarkSamples = 100; - double benchmarkConfidenceInterval = 0.95; - unsigned int benchmarkResamples = 100000; - std::chrono::milliseconds::rep benchmarkWarmupTime = 100; + T& operator*() { + assert(nullableValue); + return *nullableValue; + } + T const& operator*() const { + assert(nullableValue); + return *nullableValue; + } + T* operator->() { + assert(nullableValue); + return nullableValue; + } + const T* operator->() const { + assert(nullableValue); + return nullableValue; + } - 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; + T valueOr( T const& defaultValue ) const { + return nullableValue ? *nullableValue : defaultValue; + } - 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 + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } - std::vector<std::string> testsOrTags; - std::vector<std::string> sectionsToRun; - }; + bool operator !() const { return nullableValue == nullptr; } + explicit operator bool() const { + return some(); + } + friend bool operator==(Optional const& a, Optional const& b) { + if (a.none() && b.none()) { + return true; + } else if (a.some() && b.some()) { + return *a == *b; + } else { + return false; + } + } + friend bool operator!=(Optional const& a, Optional const& b) { + return !( a == b ); + } - class Config : public IConfig { - public: + private: + T *nullableValue; + alignas(alignof(T)) char storage[sizeof(T)]; + }; - Config() = default; - Config( ConfigData const& data ); - ~Config() override; // = default in the cpp file +} // end namespace Catch - std::string const& getFilename() const; +#endif // CATCH_OPTIONAL_HPP_INCLUDED - bool listTests() const; - bool listTags() const; - bool listReporters() const; - std::string getProcessName() const; - std::string const& getReporterName() const; +#ifndef CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED +#define CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED - std::vector<std::string> const& getTestsOrTags() const override; - std::vector<std::string> const& getSectionsToRun() const override; +#include <cstdint> - TestSpec const& testSpec() const override; - bool hasTestFilters() const override; +namespace Catch { - bool showHelp() const; + enum class GenerateFrom { + Time, + RandomDevice, + //! Currently equivalent to RandomDevice, but can change at any point + Default + }; - // 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; + std::uint32_t generateRandomSeed(GenerateFrom from); - private: +} // end namespace Catch - IStream const* openStream(); - ConfigData m_data; +#endif // CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED - Detail::unique_ptr<IStream const> m_stream; - TestSpec m_testSpec; - bool m_hasTestFilters = false; - }; -} // end namespace Catch +#ifndef CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED +#define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED -#endif // CATCH_CONFIG_HPP_INCLUDED -#ifndef CATCH_MESSAGE_HPP_INCLUDED -#define CATCH_MESSAGE_HPP_INCLUDED +#ifndef CATCH_CONSOLE_COLOUR_HPP_INCLUDED +#define CATCH_CONSOLE_COLOUR_HPP_INCLUDED -#include <string> -#include <vector> +#include <iosfwd> +#include <cstdint> namespace Catch { - struct MessageStream { + enum class ColourMode : std::uint8_t; + class IStream; - template<typename T> - MessageStream& operator << ( T const& value ) { - m_stream << value; - return *this; - } + struct Colour { + enum Code { + None = 0, - ReusableStringStream m_stream; - }; + 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 + }; + }; + + class ColourImpl { + protected: + //! The associated stream of this ColourImpl instance + IStream* m_stream; + public: + ColourImpl( IStream* stream ): m_stream( stream ) {} + + //! RAII wrapper around writing specific colour of text using specific + //! colour impl into a stream. + class ColourGuard { + ColourImpl const* m_colourImpl; + Colour::Code m_code; + bool m_engaged = false; + + public: + //! Does **not** engage the guard/start the colour + ColourGuard( Colour::Code code, + ColourImpl const* colour ); + + ColourGuard( ColourGuard const& rhs ) = delete; + ColourGuard& operator=( ColourGuard const& rhs ) = delete; + + ColourGuard( ColourGuard&& rhs ) noexcept; + ColourGuard& operator=( ColourGuard&& rhs ) noexcept; + + //! Removes colour _if_ the guard was engaged + ~ColourGuard(); + + /** + * Explicitly engages colour for given stream. + * + * The API based on operator<< should be preferred. + */ + ColourGuard& engage( std::ostream& stream ) &; + /** + * Explicitly engages colour for given stream. + * + * The API based on operator<< should be preferred. + */ + ColourGuard&& engage( std::ostream& stream ) &&; + + private: + //! Engages the guard and starts using colour + friend std::ostream& operator<<( std::ostream& lhs, + ColourGuard& guard ) { + guard.engageImpl( lhs ); + return lhs; + } + //! Engages the guard and starts using colour + friend std::ostream& operator<<( std::ostream& lhs, + ColourGuard&& guard) { + guard.engageImpl( lhs ); + return lhs; + } + + void engageImpl( std::ostream& stream ); + + }; + + virtual ~ColourImpl(); // = default + /** + * Creates a guard object for given colour and this colour impl + * + * **Important:** + * the guard starts disengaged, and has to be engaged explicitly. + */ + ColourGuard guardColour( Colour::Code colourCode ); + + private: + virtual void use( Colour::Code colourCode ) const = 0; + }; + + //! Provides ColourImpl based on global config and target compilation platform + Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection, + IStream* stream ); + + //! Checks if specific colour impl has been compiled into the binary + bool isColourImplAvailable( ColourMode colourSelection ); + +} // end namespace Catch + +#endif // CATCH_CONSOLE_COLOUR_HPP_INCLUDED + +#include <map> +#include <string> +#include <vector> + +namespace Catch { + + enum class ColourMode : std::uint8_t; + + namespace Detail { + //! Splits the reporter spec into reporter name and kv-pair options + std::vector<std::string> splitReporterSpec( StringRef reporterSpec ); + + Optional<ColourMode> stringToColourMode( StringRef colourMode ); + } + + /** + * Structured reporter spec that a reporter can be created from + * + * Parsing has been validated, but semantics have not. This means e.g. + * that the colour mode is known to Catch2, but it might not be + * compiled into the binary, and the output filename might not be + * openable. + */ + class ReporterSpec { + std::string m_name; + Optional<std::string> m_outputFileName; + Optional<ColourMode> m_colourMode; + std::map<std::string, std::string> m_customOptions; + + friend bool operator==( ReporterSpec const& lhs, + ReporterSpec const& rhs ); + friend bool operator!=( ReporterSpec const& lhs, + ReporterSpec const& rhs ) { + return !( lhs == rhs ); + } + + public: + ReporterSpec( + std::string name, + Optional<std::string> outputFileName, + Optional<ColourMode> colourMode, + std::map<std::string, std::string> customOptions ); + + std::string const& name() const { return m_name; } + + Optional<std::string> const& outputFile() const { + return m_outputFileName; + } + + Optional<ColourMode> const& colourMode() const { return m_colourMode; } + + std::map<std::string, std::string> const& customOptions() const { + return m_customOptions; + } + }; + + /** + * Parses provided reporter spec string into + * + * Returns empty optional on errors, e.g. + * * field that is not first and not a key+value pair + * * duplicated keys in kv pair + * * unknown catch reporter option + * * empty key/value in an custom kv pair + * * ... + */ + Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ); + +} + +#endif // CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED + +#include <chrono> +#include <map> +#include <string> +#include <vector> + +namespace Catch { + + class IStream; + + /** + * `ReporterSpec` but with the defaults filled in. + * + * Like `ReporterSpec`, the semantics are unchecked. + */ + struct ProcessedReporterSpec { + std::string name; + std::string outputFilename; + ColourMode colourMode; + std::map<std::string, std::string> customOptions; + friend bool operator==( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ); + friend bool operator!=( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ) { + return !( lhs == rhs ); + } + }; + + struct ConfigData { + + bool listTests = false; + bool listTags = false; + bool listReporters = false; + bool listListeners = false; + + bool showSuccessfulTests = false; + bool shouldDebugBreak = false; + bool noThrow = false; + bool showHelp = false; + bool showInvisibles = false; + bool filenamesAsTags = false; + bool libIdentify = false; + bool allowZeroTests = false; + + int abortAfter = -1; + uint32_t rngSeed = generateRandomSeed(GenerateFrom::Default); + + unsigned int shardCount = 1; + unsigned int shardIndex = 0; + + bool skipBenchmarks = false; + 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; + ColourMode defaultColourMode = ColourMode::PlatformDefault; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string defaultOutputFilename; + std::string name; + std::string processName; + std::vector<ReporterSpec> reporterSpecifications; + + 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 + + bool listTests() const; + bool listTags() const; + bool listReporters() const; + bool listListeners() const; + + std::vector<ReporterSpec> const& getReporterSpecs() const; + std::vector<ProcessedReporterSpec> const& + getProcessedReporterSpecs() 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; + StringRef name() const override; + bool includeSuccessfulResults() const override; + bool warnAboutMissingAssertions() const override; + bool warnAboutUnmatchedTestSpecs() const override; + bool zeroTestsCountAsSuccess() const override; + ShowDurations showDurations() const override; + double minDuration() const override; + TestRunOrder runOrder() const override; + uint32_t rngSeed() const override; + unsigned int shardCount() const override; + unsigned int shardIndex() const override; + ColourMode defaultColourMode() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + bool skipBenchmarks() const override; + bool benchmarkNoAnalysis() const override; + unsigned int benchmarkSamples() const override; + double benchmarkConfidenceInterval() const override; + unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; + + private: + ConfigData m_data; + std::vector<ProcessedReporterSpec> m_processedReporterSpecs; + 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 + + + +#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED +#define CATCH_STREAM_END_STOP_HPP_INCLUDED + + +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 + +#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 macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ): + m_info(macroName, lineInfo, type) {} - struct MessageBuilder : MessageStream { - MessageBuilder( StringRef const& macroName, - SourceLineInfo const& lineInfo, - ResultWas::OfType type ); template<typename T> MessageBuilder& operator << ( T const& value ) { @@ -3965,97 +4430,6 @@ namespace Catch { #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 @@ -4092,11 +4466,11 @@ namespace Catch { #include <cassert> -#include <cctype> #include <memory> #include <ostream> #include <sstream> #include <string> +#include <type_traits> #include <vector> namespace Catch { @@ -4113,7 +4487,25 @@ namespace Catch { ShortCircuitSame }; + struct accept_many_t {}; + constexpr accept_many_t accept_many {}; + namespace Detail { + struct fake_arg { + template <typename T> + operator T(); + }; + + template <typename F, typename = void> + struct is_unary_function : std::false_type {}; + + template <typename F> + struct is_unary_function< + F, + Catch::Detail::void_t<decltype( + std::declval<F>()( fake_arg() ) ) + > + > : std::true_type {}; // Traits for extracting arg and return type of lambdas (for single // argument lambdas) @@ -4129,8 +4521,7 @@ namespace Catch { 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 ArgType = std::remove_const_t<std::remove_reference_t<ArgT>>; using ReturnType = ReturnT; }; @@ -4264,20 +4655,20 @@ namespace Catch { return { ResultType::Ok, value }; } static auto ok() -> BasicResult { return { ResultType::Ok }; } - static auto logicError( std::string const& message ) + static auto logicError( std::string&& message ) -> BasicResult { - return { ResultType::LogicError, message }; + return { ResultType::LogicError, CATCH_MOVE(message) }; } - static auto runtimeError( std::string const& message ) + static auto runtimeError( std::string&& message ) -> BasicResult { - return { ResultType::RuntimeError, message }; + return { ResultType::RuntimeError, CATCH_MOVE(message) }; } explicit operator bool() const { return m_type == ResultType::Ok; } auto type() const -> ResultType { return m_type; } - auto errorMessage() const -> std::string { + auto errorMessage() const -> std::string const& { return m_errorMessage; } @@ -4296,8 +4687,8 @@ namespace Catch { m_errorMessage; // Only populated if resultType is an error BasicResult( ResultType type, - std::string const& message ): - ResultValueBase<T>( type ), m_errorMessage( message ) { + std::string&& message ): + ResultValueBase<T>( type ), m_errorMessage( CATCH_MOVE(message) ) { assert( m_type != ResultType::Ok ); } @@ -4353,7 +4744,7 @@ namespace Catch { T temp; auto result = convertInto( source, temp ); if ( result ) - target = std::move( temp ); + target = CATCH_MOVE( temp ); return result; } #endif // CLARA_CONFIG_OPTIONAL_TYPE @@ -4454,6 +4845,11 @@ namespace Catch { } }; + template <typename L> struct BoundManyLambda : BoundLambda<L> { + explicit BoundManyLambda( L const& lambda ): BoundLambda<L>( lambda ) {} + bool isContainer() const override { return true; } + }; + template <typename L> struct BoundFlagLambda : BoundFlagRefBase { L m_lambda; @@ -4508,12 +4904,23 @@ namespace Catch { m_ref( ref ) {} public: - template <typename T> + template <typename LambdaT> + ParserRefImpl( accept_many_t, + LambdaT const& ref, + std::string const& hint ): + m_ref( std::make_shared<BoundManyLambda<LambdaT>>( ref ) ), + m_hint( hint ) {} + + template <typename T, + typename = typename std::enable_if_t< + !Detail::is_unary_function<T>::value>> ParserRefImpl( T& ref, std::string const& hint ): m_ref( std::make_shared<BoundValueRef<T>>( ref ) ), m_hint( hint ) {} - template <typename LambdaT> + template <typename LambdaT, + typename = typename std::enable_if_t< + Detail::is_unary_function<LambdaT>::value>> ParserRefImpl( LambdaT const& ref, std::string const& hint ): m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ), m_hint( hint ) {} @@ -4554,6 +4961,7 @@ namespace Catch { class Arg : public Detail::ParserRefImpl<Arg> { public: using ParserRefImpl::ParserRefImpl; + using ParserBase::parse; Detail::InternalParseResult parse(std::string const&, @@ -4573,13 +4981,21 @@ namespace Catch { explicit Opt(bool& ref); + template <typename LambdaT, + typename = typename std::enable_if_t< + Detail::is_unary_function<LambdaT>::value>> + Opt( LambdaT const& ref, std::string const& hint ): + ParserRefImpl( ref, hint ) {} + template <typename LambdaT> - Opt(LambdaT const& ref, std::string const& hint) : - ParserRefImpl(ref, hint) {} + Opt( accept_many_t, LambdaT const& ref, std::string const& hint ): + ParserRefImpl( accept_many, ref, hint ) {} - template <typename T> - Opt(T& ref, std::string const& hint) : - ParserRefImpl(ref, hint) {} + template <typename T, + typename = typename std::enable_if_t< + !Detail::is_unary_function<T>::value>> + Opt( T& ref, std::string const& hint ): + ParserRefImpl( ref, hint ) {} auto operator[](std::string const& optName) -> Opt& { m_optNames.push_back(optName); @@ -4604,12 +5020,6 @@ namespace Catch { 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); @@ -4879,7 +5289,11 @@ namespace Catch { namespace Catch { - struct ITransientExpression { + class ITransientExpression { + bool m_isBinaryExpression; + bool m_result; + + public: auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } auto getResult() const -> bool { return m_result; } virtual void streamReconstructedExpression( std::ostream &os ) const = 0; @@ -4897,8 +5311,6 @@ namespace Catch { // 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; @@ -5029,60 +5441,53 @@ namespace Catch { 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 }; + template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> + friend auto operator == ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { + return { compareEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "=="_sr, rhs }; } - auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const { - return { m_lhs == rhs, m_lhs, "=="_sr, rhs }; + template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> + friend auto operator == ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { + return { compareEqual( lhs.m_lhs, rhs ), lhs.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 }; + template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> + friend auto operator != ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { + return { compareNotEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "!="_sr, rhs }; } - auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const { - return { m_lhs != rhs, m_lhs, "!="_sr, rhs }; + template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> + friend auto operator != ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { + return { compareNotEqual( lhs.m_lhs, rhs ), lhs.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 }; + #define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(op) \ + template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> \ + friend auto operator op ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { \ + return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> \ + friend auto operator op ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { \ + return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ } + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<=) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>=) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(&) + CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(^) + + #undef CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR + template<typename RhsT> - auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + friend auto operator && ( ExprLhs &&, RhsT && ) -> BinaryExpr<LhsT, RhsT 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 { + friend auto operator || ( ExprLhs &&, RhsT && ) -> BinaryExpr<LhsT, RhsT const&> { static_assert(always_false<RhsT>::value, "operator|| is not supported inside assertions, " "wrap the expression inside parentheses, or decompose it"); @@ -5093,21 +5498,15 @@ namespace Catch { } }; - 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 }; + template<typename T, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<T>>::value, int> = 0> + friend auto operator <= ( Decomposer &&, T && lhs ) -> ExprLhs<T const&> { + return ExprLhs<const T&>{ lhs }; } - auto operator <=( bool value ) -> ExprLhs<bool> { - return ExprLhs<bool>{ value }; + template<typename T, std::enable_if_t<std::is_arithmetic<T>::value, int> = 0> + friend auto operator <= ( Decomposer &&, T value ) -> ExprLhs<T> { + return ExprLhs<T>{ value }; } }; @@ -5124,12 +5523,11 @@ namespace Catch { #endif // CATCH_DECOMPOSER_HPP_INCLUDED +#include <string> + namespace Catch { - struct TestFailureException{}; - struct AssertionResultData; - struct IResultCapture; - class RunContext; + class IResultCapture; struct AssertionReaction { bool shouldDebugBreak = false; @@ -5144,7 +5542,7 @@ namespace Catch { public: AssertionHandler - ( StringRef const& macroName, + ( StringRef macroName, SourceLineInfo const& lineInfo, StringRef capturedExpression, ResultDisposition::Flags resultDisposition ); @@ -5161,7 +5559,7 @@ namespace Catch { } void handleExpr( ITransientExpression const& expr ); - void handleMessage(ResultWas::OfType resultType, StringRef const& message); + void handleMessage(ResultWas::OfType resultType, StringRef message); void handleExceptionThrownAsExpected(); void handleUnexpectedExceptionNotThrown(); @@ -5176,15 +5574,15 @@ namespace Catch { auto allowThrows() const -> bool; }; - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ); } // namespace Catch #endif // CATCH_ASSERTION_HANDLER_HPP_INCLUDED -// We need this suppression to leak, because it took until GCC 9 +// We need this suppression to leak, because it took until GCC 10 // for the front end to handle local suppression via _Pragma properly -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9 +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ <= 9 #pragma GCC diagnostic ignored "-Wparentheses" #endif @@ -5215,7 +5613,7 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ - do { \ + do { /* NOLINT(bugprone-infinite-loop) */ \ /* 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 ); \ @@ -5226,7 +5624,8 @@ namespace Catch { CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) + } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ @@ -5290,265 +5689,28 @@ namespace Catch { } 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 + +/////////////////////////////////////////////////////////////////////////////// +// 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_SECTION_HPP_INCLUDED @@ -5563,9 +5725,6 @@ namespace Catch { namespace Catch { - auto getCurrentNanosecondsSinceEpoch() -> uint64_t; - auto getEstimatedClockResolution() -> uint64_t; - class Timer { uint64_t m_nanoseconds = 0; public: @@ -5580,8 +5739,6 @@ namespace Catch { #endif // CATCH_TIMER_HPP_INCLUDED -#include <string> - namespace Catch { class Section : Detail::NonCopyable { @@ -5632,16 +5789,18 @@ namespace Catch { class TestSpec; struct TestCaseInfo; - struct ITestInvoker { + class ITestInvoker { + public: virtual void invoke () const = 0; - virtual ~ITestInvoker(); + virtual ~ITestInvoker(); // = default }; class TestCaseHandle; - struct IConfig; + class IConfig; - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); + class ITestCaseRegistry { + public: + virtual ~ITestCaseRegistry(); // = default // 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; @@ -5657,6 +5816,20 @@ namespace Catch { #endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED + +#ifndef CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED +#define CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED + +#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_REMOVE_PARENS( ... ) \ + INTERNAL_CATCH_EXPAND1( INTERNAL_CATCH_DEF __VA_ARGS__ ) + +#endif // CATCH_PREPROCESSOR_REMOVE_PARENS_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 :-( @@ -5684,19 +5857,19 @@ 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) ); + return Detail::make_unique<TestInvokerAsMethod<C>>( testAsMethod ); } struct NameAndTags { - NameAndTags(StringRef const& name_ = StringRef(), - StringRef const& tags_ = StringRef()) noexcept: - name(name_), tags(tags_) {} + constexpr NameAndTags( StringRef name_ = StringRef(), + StringRef 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; + AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept; }; } // end namespace Catch @@ -5718,16 +5891,18 @@ struct AutoReg : Detail::NonCopyable { static void TestName(); \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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__ ) + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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 @@ -5735,6 +5910,7 @@ struct AutoReg : Detail::NonCopyable { #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ namespace{ \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ void test(); \ @@ -5744,13 +5920,14 @@ struct AutoReg : Detail::NonCopyable { 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__ ) + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ do { \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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) @@ -5758,6 +5935,7 @@ struct AutoReg : Detail::NonCopyable { #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. @@ -5774,8 +5952,8 @@ struct AutoReg : Detail::NonCopyable { #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_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + #define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __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__ ) @@ -5796,9 +5974,13 @@ struct AutoReg : Detail::NonCopyable { #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__ ) + #define CATCH_STATIC_CHECK( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) + #define CATCH_STATIC_CHECK_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__ ) + #define CATCH_STATIC_CHECK( ... ) CATCH_CHECK( __VA_ARGS__ ) + #define CATCH_STATIC_CHECK_FALSE( ... ) CATCH_CHECK_FALSE( __VA_ARGS__ ) #endif @@ -5831,8 +6013,8 @@ struct AutoReg : Detail::NonCopyable { #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_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) + #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define CATCH_METHOD_AS_TEST_CASE( method, ... ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) #define CATCH_SECTION( ... ) @@ -5843,10 +6025,12 @@ struct AutoReg : Detail::NonCopyable { #define CATCH_STATIC_REQUIRE( ... ) (void)(0) #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + #define CATCH_STATIC_CHECK( ... ) (void)(0) + #define CATCH_STATIC_CHECK_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_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) + #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), className ) #define CATCH_GIVEN( desc ) #define CATCH_AND_GIVEN( desc ) #define CATCH_WHEN( desc ) @@ -5865,8 +6049,8 @@ struct AutoReg : Detail::NonCopyable { #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 CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + #define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __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__ ) @@ -5887,9 +6071,13 @@ struct AutoReg : Detail::NonCopyable { #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__ ")" ) + #define STATIC_CHECK( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) + #define STATIC_CHECK_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__ ) + #define STATIC_CHECK( ... ) CHECK( __VA_ARGS__ ) + #define STATIC_CHECK_FALSE( ... ) CHECK_FALSE( __VA_ARGS__ ) #endif // "BDD-style" convenience wrappers @@ -5921,8 +6109,8 @@ struct AutoReg : Detail::NonCopyable { #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 TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__) + #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) #define METHOD_AS_TEST_CASE( method, ... ) #define REGISTER_TEST_CASE( Function, ... ) (void)(0) #define SECTION( ... ) @@ -5933,10 +6121,12 @@ struct AutoReg : Detail::NonCopyable { #define STATIC_REQUIRE( ... ) (void)(0) #define STATIC_REQUIRE_FALSE( ... ) (void)(0) + #define STATIC_CHECK( ... ) (void)(0) + #define STATIC_CHECK_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 SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ) ) + #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), className ) #define GIVEN( desc ) #define AND_GIVEN( desc ) @@ -5952,8 +6142,240 @@ struct AutoReg : Detail::NonCopyable { #endif // CATCH_TEST_MACROS_HPP_INCLUDED -#ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED -#define CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED +#ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED +#define CATCH_TEMPLATE_TEST_REGISTRY_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_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) + +#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 // GCC 5 and older do not properly handle disabling unused-variable warning @@ -5976,34 +6398,34 @@ struct AutoReg : Detail::NonCopyable { #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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) #endif #endif @@ -6024,9 +6446,9 @@ struct AutoReg : Detail::NonCopyable { template<typename...Types> \ struct TestName{\ TestName(){\ - int index = 0; \ + size_t index = 0; \ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = int[];\ + using expander = size_t[];\ (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ @@ -6041,18 +6463,18 @@ struct AutoReg : Detail::NonCopyable { #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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) ) #endif #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ @@ -6069,12 +6491,12 @@ struct AutoReg : Detail::NonCopyable { template<typename... Types> \ struct TestName { \ void reg_tests() { \ - int index = 0; \ - using expander = int[]; \ + size_t index = 0; \ + using expander = size_t[]; \ 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 */\ + (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 ) = [](){ \ @@ -6091,18 +6513,18 @@ struct AutoReg : Detail::NonCopyable { #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__) + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__) + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) ) #endif #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ @@ -6117,8 +6539,8 @@ struct AutoReg : Detail::NonCopyable { template<typename... Types> \ struct TestName { \ void reg_tests() { \ - int index = 0; \ - using expander = int[]; \ + size_t index = 0; \ + using expander = size_t[]; \ (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 */\ } \ };\ @@ -6134,7 +6556,7 @@ struct AutoReg : Detail::NonCopyable { 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 ) + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, TmplList ) #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ @@ -6152,9 +6574,9 @@ struct AutoReg : Detail::NonCopyable { template<typename...Types> \ struct TestNameClass{\ TestNameClass(){\ - int index = 0; \ + size_t index = 0; \ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = int[];\ + using expander = size_t[];\ (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ @@ -6169,18 +6591,18 @@ struct AutoReg : Detail::NonCopyable { #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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) #endif #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ @@ -6200,12 +6622,12 @@ struct AutoReg : Detail::NonCopyable { template<typename...Types>\ struct TestNameClass{\ void reg_tests(){\ - int index = 0;\ - using expander = int[];\ + std::size_t index = 0;\ + using expander = std::size_t[];\ 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 */ \ + (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 ) = [](){\ @@ -6222,18 +6644,18 @@ struct AutoReg : Detail::NonCopyable { #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__ ) + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), 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__ ) ) + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) ) #endif #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ @@ -6251,8 +6673,8 @@ struct AutoReg : Detail::NonCopyable { template<typename...Types>\ struct TestNameClass{\ void reg_tests(){\ - int index = 0;\ - using expander = int[];\ + size_t index = 0;\ + using expander = size_t[];\ (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 */ \ }\ };\ @@ -6268,7 +6690,7 @@ struct AutoReg : Detail::NonCopyable { 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 ) + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, TmplList ) #endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED @@ -6391,14 +6813,24 @@ struct AutoReg : Detail::NonCopyable { namespace Catch { + /** + * A **view** of a tag string that provides case insensitive comparisons + * + * Note that in Catch2 internals, the square brackets around tags are + * not a part of tag's representation, so e.g. "[cool-tag]" is represented + * as "cool-tag" internally. + */ struct Tag { - Tag(StringRef original_, StringRef lowerCased_): - original(original_), lowerCased(lowerCased_) + constexpr Tag(StringRef original_): + original(original_) {} - StringRef original, lowerCased; + StringRef original; + + friend bool operator< ( Tag const& lhs, Tag const& rhs ); + friend bool operator==( Tag const& lhs, Tag const& rhs ); }; - struct ITestInvoker; + class ITestInvoker; enum class TestCaseProperties : uint8_t { None = 0, @@ -6410,10 +6842,18 @@ namespace Catch { Benchmark = 1 << 6 }; - + /** + * Various metadata about the test case. + * + * A test case is uniquely identified by its (class)name and tags + * combination, with source location being ignored, and other properties + * being determined from tags. + * + * Tags are kept sorted. + */ struct TestCaseInfo : Detail::NonCopyable { - TestCaseInfo(std::string const& _className, + TestCaseInfo(StringRef _className, NameAndTags const& _tags, SourceLineInfo const& _lineInfo); @@ -6425,13 +6865,17 @@ namespace Catch { // Adds the tag(s) with test's filename (for the -# flag) void addFilenameTag(); + //! Orders by name, classname and tags + friend bool operator<( TestCaseInfo const& lhs, + TestCaseInfo const& rhs ); + std::string tagsAsString() const; std::string name; - std::string className; + StringRef className; private: - std::string backingTags, backingLCaseTags; + std::string backingTags; // Internally we copy tags to the backing storage and then add // refs to this storage to the tags vector. void internalAppendTag(StringRef tagString); @@ -6441,6 +6885,12 @@ namespace Catch { TestCaseProperties properties = TestCaseProperties::None; }; + /** + * Wrapper over the test case information and the test case invoker + * + * Does not own either, and is specifically made to be cheap + * to copy around. + */ class TestCaseHandle { TestCaseInfo* m_info; ITestInvoker* m_invoker; @@ -6453,14 +6903,12 @@ namespace Catch { } 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 ); + Detail::unique_ptr<TestCaseInfo> + makeTestCaseInfo( StringRef className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); } #ifdef __clang__ @@ -6485,17 +6933,18 @@ namespace Catch { namespace Catch { using exceptionTranslateFunction = std::string(*)(); - struct IExceptionTranslator; + class IExceptionTranslator; using ExceptionTranslators = std::vector<Detail::unique_ptr<IExceptionTranslator const>>; - struct IExceptionTranslator { - virtual ~IExceptionTranslator(); + class IExceptionTranslator { + public: + virtual ~IExceptionTranslator(); // = default virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; }; - struct IExceptionTranslatorRegistry { - virtual ~IExceptionTranslatorRegistry(); - + class IExceptionTranslatorRegistry { + public: + virtual ~IExceptionTranslatorRegistry(); // = default virtual std::string translateActiveException() const = 0; }; @@ -6539,8 +6988,9 @@ namespace Catch { public: template<typename T> ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) { - getMutableRegistryHub().registerTranslator - ( new ExceptionTranslator<T>( translateFunction ) ); + getMutableRegistryHub().registerTranslator( + Detail::make_unique<ExceptionTranslator<T>>(translateFunction) + ); } }; @@ -6573,6 +7023,7 @@ namespace Catch { #endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED + #ifndef CATCH_VERSION_HPP_INCLUDED #define CATCH_VERSION_HPP_INCLUDED @@ -6611,7 +7062,7 @@ namespace Catch { #define CATCH_VERSION_MACROS_HPP_INCLUDED #define CATCH_VERSION_MAJOR 3 -#define CATCH_VERSION_MINOR 0 +#define CATCH_VERSION_MINOR 1 #define CATCH_VERSION_PATCH 0 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED @@ -6670,10 +7121,30 @@ namespace Catch { #define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED +#include <string> + namespace Catch { namespace Generators { class GeneratorUntypedBase { + // Caches result from `toStringImpl`, assume that when it is an + // empty string, the cache is invalidated. + mutable std::string m_stringReprCache; + + // Counts based on `next` returning true + std::size_t m_currentElementIndex = 0; + + /** + * 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; + + //! Customization point for `currentElementAsString` + virtual std::string stringifyImpl() const = 0; + public: GeneratorUntypedBase() = default; // Generation of copy ops is deprecated (and Clang will complain) @@ -6683,17 +7154,41 @@ namespace Catch { 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; + /** + * Attempts to move the generator to the next element + * + * Serves as a non-virtual interface to `next`, so that the + * top level interface can provide sanity checking and shared + * features. + * + * As with `next`, returns true iff the move succeeded and + * the generator has new valid element to provide. + */ + bool countedNext(); + + std::size_t currentElementIndex() const { return m_currentElementIndex; } + + /** + * Returns generator's current element as user-friendly string. + * + * By default returns string equivalent to calling + * `Catch::Detail::stringify` on the current element, but generators + * can customize their implementation as needed. + * + * Not thread-safe due to internal caching. + * + * The returned ref is valid only until the generator instance + * is destructed, or it moves onto the next element, whichever + * comes first. + */ + StringRef currentElementAsString() const; }; using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; } // namespace Generators - struct IGeneratorTracker { + class IGeneratorTracker { + public: virtual ~IGeneratorTracker(); // = default; virtual auto hasGenerator() const -> bool = 0; virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; @@ -6706,7 +7201,6 @@ namespace Catch { #include <vector> #include <tuple> -#include <utility> namespace Catch { @@ -6721,7 +7215,12 @@ namespace Detail { } // end namespace detail template<typename T> - struct IGenerator : GeneratorUntypedBase { + class IGenerator : public GeneratorUntypedBase { + std::string stringifyImpl() const override { + return ::Catch::Detail::stringify( get() ); + } + + public: ~IGenerator() override = default; IGenerator() = default; IGenerator(IGenerator const&) = default; @@ -6747,13 +7246,13 @@ namespace Detail { GeneratorWrapper(IGenerator<T>* generator): m_generator(generator) {} GeneratorWrapper(GeneratorPtr<T> generator): - m_generator(std::move(generator)) {} + m_generator(CATCH_MOVE(generator)) {} T const& get() const { return m_generator->get(); } bool next() { - return m_generator->next(); + return m_generator->countedNext(); } }; @@ -6762,8 +7261,11 @@ namespace Detail { class SingleValueGenerator final : public IGenerator<T> { T m_value; public: + SingleValueGenerator(T const& value) : + m_value(value) + {} SingleValueGenerator(T&& value): - m_value(std::forward<T>(value)) + m_value(CATCH_MOVE(value)) {} T const& get() const override { @@ -6793,9 +7295,11 @@ namespace Detail { } }; - template <typename T> - GeneratorWrapper<T> value(T&& value) { - return GeneratorWrapper<T>(Catch::Detail::make_unique<SingleValueGenerator<T>>(std::forward<T>(value))); + template <typename T, typename DecayedT = std::decay_t<T>> + GeneratorWrapper<DecayedT> value( T&& value ) { + return GeneratorWrapper<DecayedT>( + Catch::Detail::make_unique<SingleValueGenerator<DecayedT>>( + CATCH_FORWARD( value ) ) ); } template <typename T> GeneratorWrapper<T> values(std::initializer_list<T> values) { @@ -6807,27 +7311,36 @@ namespace Detail { std::vector<GeneratorWrapper<T>> m_generators; size_t m_current = 0; - void populate(GeneratorWrapper<T>&& generator) { - m_generators.emplace_back(std::move(generator)); + void add_generator( GeneratorWrapper<T>&& generator ) { + m_generators.emplace_back( CATCH_MOVE( generator ) ); + } + void add_generator( T const& val ) { + m_generators.emplace_back( value( val ) ); } - void populate(T&& val) { - m_generators.emplace_back(value(std::forward<T>(val))); + void add_generator( T&& val ) { + m_generators.emplace_back( value( CATCH_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( CATCH_FORWARD( val ) ) ); } - template<typename U> - void populate(U&& val) { - populate(T(std::forward<U>(val))); + + template <typename U> void add_generators( U&& valueOrGenerator ) { + add_generator( CATCH_FORWARD( valueOrGenerator ) ); } - template<typename U, typename... Gs> - void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { - populate(std::forward<U>(valueOrGenerator)); - populate(std::forward<Gs>(moreGenerators)...); + + template <typename U, typename... Gs> + void add_generators( U&& valueOrGenerator, Gs&&... moreGenerators ) { + add_generator( CATCH_FORWARD( valueOrGenerator ) ); + add_generators( CATCH_FORWARD( moreGenerators )... ); } public: template <typename... Gs> Generators(Gs &&... moreGenerators) { m_generators.reserve(sizeof...(Gs)); - populate(std::forward<Gs>(moreGenerators)...); + add_generators(CATCH_FORWARD(moreGenerators)...); } T const& get() const override { @@ -6847,8 +7360,9 @@ namespace Detail { }; - template<typename... Ts> - GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples ) { + 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 ); } @@ -6858,19 +7372,19 @@ namespace Detail { template<typename T, typename... Gs> auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> { - return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); + return Generators<T>(CATCH_MOVE(generator), CATCH_FORWARD(moreGenerators)...); } template<typename T> auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> { - return Generators<T>(std::move(generator)); + return Generators<T>(CATCH_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 )... ); + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<std::decay_t<T>> { + return makeGenerators( value( CATCH_FORWARD( val ) ), CATCH_FORWARD( 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 )... ); + return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... ); } auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; @@ -6914,6 +7428,8 @@ namespace Detail { #define CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED +#include <cassert> + namespace Catch { namespace Generators { @@ -6924,7 +7440,7 @@ namespace Generators { size_t m_target; public: TakeGenerator(size_t target, GeneratorWrapper<T>&& generator): - m_generator(std::move(generator)), + m_generator(CATCH_MOVE(generator)), m_target(target) { assert(target != 0 && "Empty generators are not allowed"); @@ -6950,7 +7466,7 @@ namespace Generators { 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))); + return GeneratorWrapper<T>(Catch::Detail::make_unique<TakeGenerator<T>>(target, CATCH_MOVE(generator))); } @@ -6961,8 +7477,8 @@ namespace Generators { public: template <typename P = Predicate> FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator): - m_generator(std::move(generator)), - m_predicate(std::forward<P>(pred)) + m_generator(CATCH_MOVE(generator)), + m_predicate(CATCH_FORWARD(pred)) { if (!m_predicate(m_generator.get())) { // It might happen that there are no values that pass the @@ -6991,7 +7507,7 @@ namespace Generators { 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))); + return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); } template <typename T> @@ -7006,7 +7522,7 @@ namespace Generators { size_t m_repeat_index = 0; public: RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator): - m_generator(std::move(generator)), + m_generator(CATCH_MOVE(generator)), m_target_repeats(repeats) { assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); @@ -7047,7 +7563,7 @@ namespace Generators { 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))); + return GeneratorWrapper<T>(Catch::Detail::make_unique<RepeatGenerator<T>>(repeats, CATCH_MOVE(generator))); } template <typename T, typename U, typename Func> @@ -7060,8 +7576,8 @@ namespace Generators { public: template <typename F2 = Func> MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) : - m_generator(std::move(generator)), - m_function(std::forward<F2>(function)), + m_generator(CATCH_MOVE(generator)), + m_function(CATCH_FORWARD(function)), m_cache(m_function(m_generator.get())) {} @@ -7080,14 +7596,14 @@ namespace Generators { 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)) + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(CATCH_FORWARD(function), CATCH_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)) + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(CATCH_FORWARD(function), CATCH_MOVE(generator)) ); } @@ -7099,7 +7615,7 @@ namespace Generators { bool m_used_up = false; public: ChunkGenerator(size_t size, GeneratorWrapper<T> generator) : - m_chunk_size(size), m_generator(std::move(generator)) + m_chunk_size(size), m_generator(CATCH_MOVE(generator)) { m_chunk.reserve(m_chunk_size); if (m_chunk_size != 0) { @@ -7130,7 +7646,7 @@ namespace Generators { 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)) + Catch::Detail::make_unique<ChunkGenerator<T>>(size, CATCH_MOVE(generator)) ); } @@ -7203,16 +7719,21 @@ namespace Catch { namespace Catch { namespace Generators { +namespace Detail { + // Returns a suitable seed for a random floating generator based off + // the primary internal rng. It does so by taking current value from + // the rng and returning it as the seed. + std::uint32_t getSeed(); +} template <typename Float> class RandomFloatingGenerator final : public IGenerator<Float> { - Catch::SimplePcg32& m_rng; + Catch::SimplePcg32 m_rng; std::uniform_real_distribution<Float> m_dist; Float m_current_number; public: - - RandomFloatingGenerator(Float a, Float b): - m_rng(rng()), + RandomFloatingGenerator( Float a, Float b, std::uint32_t seed ): + m_rng(seed), m_dist(a, b) { static_cast<void>(next()); } @@ -7228,13 +7749,12 @@ public: template <typename Integer> class RandomIntegerGenerator final : public IGenerator<Integer> { - Catch::SimplePcg32& m_rng; + Catch::SimplePcg32 m_rng; std::uniform_int_distribution<Integer> m_dist; Integer m_current_number; public: - - RandomIntegerGenerator(Integer a, Integer b): - m_rng(rng()), + RandomIntegerGenerator( Integer a, Integer b, std::uint32_t seed ): + m_rng(seed), m_dist(a, b) { static_cast<void>(next()); } @@ -7248,14 +7768,19 @@ public: } }; -// 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>> +std::enable_if_t<std::is_integral<T>::value, GeneratorWrapper<T>> random(T a, T b) { + static_assert( + !std::is_same<T, char>::value && + !std::is_same<T, int8_t>::value && + !std::is_same<T, uint8_t>::value && + !std::is_same<T, signed char>::value && + !std::is_same<T, unsigned char>::value && + !std::is_same<T, bool>::value, + "The requested type is not supported by the underlying random distributions from std" ); return GeneratorWrapper<T>( - Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b) + Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b, Detail::getSeed()) ); } @@ -7264,7 +7789,7 @@ 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) + Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b, Detail::getSeed()) ); } @@ -7401,29 +7926,94 @@ GeneratorWrapper<ResultType> from_range(Container const& cnt) { +#ifndef CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED + + +#include <string> + +namespace Catch { + + struct ReporterConfig; + class IConfig; + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + + + class IReporterFactory { + public: + virtual ~IReporterFactory(); // = default + + virtual IEventListenerPtr + create( ReporterConfig&& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; + + class EventListenerFactory { + public: + virtual ~EventListenerFactory(); // = default + virtual IEventListenerPtr create( IConfig const* config ) const = 0; + //! Return a meaningful name for the listener, e.g. its type name + virtual StringRef getName() const = 0; + //! Return listener's description if available + virtual std::string getDescription() const = 0; + }; +} // namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED + + #ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED #define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED + +#ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED +#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED + + +namespace Catch { + namespace Detail { + //! Provides case-insensitive `op<` semantics when called + struct CaseInsensitiveLess { + bool operator()( StringRef lhs, + StringRef rhs ) const; + }; + + //! Provides case-insensitive `op==` semantics when called + struct CaseInsensitiveEqualTo { + bool operator()( StringRef lhs, + StringRef rhs ) const; + }; + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED + #include <string> #include <vector> #include <map> namespace Catch { - struct IConfig; + class IConfig; - struct IStreamingReporter; - using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; - struct IReporterFactory; + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + class IReporterFactory; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; + struct ReporterConfig; + class EventListenerFactory; - struct IReporterRegistry { - using FactoryMap = std::map<std::string, IReporterFactoryPtr>; - using Listeners = std::vector<IReporterFactoryPtr>; + class IReporterRegistry { + public: + using FactoryMap = std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess>; + using Listeners = std::vector<Detail::unique_ptr<EventListenerFactory>>; - virtual ~IReporterRegistry(); - virtual IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const = 0; + virtual ~IReporterRegistry(); // = default + virtual IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const = 0; virtual FactoryMap const& getFactories() const = 0; virtual Listeners const& getListeners() const = 0; }; @@ -7433,20 +8023,6 @@ 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 @@ -7456,8 +8032,9 @@ namespace Catch { struct TagAlias; - struct ITagAliasRegistry { - virtual ~ITagAliasRegistry(); + class ITagAliasRegistry { + public: + virtual ~ITagAliasRegistry(); // = default // Nullptr if not present virtual TagAlias const* find( std::string const& alias ) const = 0; virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; @@ -7473,6 +8050,33 @@ namespace Catch { +/** \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 + + + /** \file * Wrapper for UNCAUGHT_EXCEPTIONS configuration option * @@ -7481,8 +8085,8 @@ namespace Catch { * in C++17, we want to use `std::uncaught_exceptions` if possible. */ -#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP -#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP +#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 @@ -7508,86 +8112,28 @@ namespace Catch { #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 +#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED #ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED #define CATCH_CONSOLE_WIDTH_HPP_INCLUDED +// This include must be kept so that user's configured value for CONSOLE_WIDTH +// is used before we attempt to provide a default value + #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 +#include <cstddef> +#include <initializer_list> // We want a simple polyfill over `std::empty`, `std::size` and so on // for C++14 or C++ libraries with incomplete support. @@ -7673,50 +8219,96 @@ namespace Catch { #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd43e0000") + #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_ENFORCE_HPP_INCLUDED +#define CATCH_ENFORCE_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() -#elif defined(CATCH_PLATFORM_IPHONE) +#define CATCH_INTERNAL_ERROR(...) \ + Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)) - // 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 +#define CATCH_ERROR(...) \ + Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )) -#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_RUNTIME_ERROR(...) \ + Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )) - #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 +#define CATCH_ENFORCE( condition, ... ) \ + do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) -#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 +#endif // CATCH_ENFORCE_HPP_INCLUDED #ifndef CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED @@ -7772,6 +8364,7 @@ namespace Catch { #ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED #define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED + #include <vector> #include <string> @@ -7779,8 +8372,8 @@ namespace Catch { class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { public: - ~ExceptionTranslatorRegistry(); - virtual void registerTranslator( const IExceptionTranslator* translator ); + ~ExceptionTranslatorRegistry() override; + void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ); std::string translateActiveException() const override; std::string tryTranslators() const; @@ -7796,91 +8389,217 @@ namespace Catch { #define CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED +#include <cassert> -#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED -#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +namespace Catch { + /** + * Wrapper for platform-specific fatal error (signals/SEH) handlers + * + * Tries to be cooperative with other handlers, and not step over + * other handlers. This means that unknown structured exceptions + * are passed on, previous signal handlers are called, and so on. + * + * Can only be instantiated once, and assumes that once a signal + * is caught, the binary will end up terminating. Thus, there + */ + class FatalConditionHandler { + bool m_started = false; + + // Install/disengage implementation for specific platform. + // Should be if-defed to work on current platform, can assume + // engage-disengage 1:1 pairing. + void engage_platform(); + void disengage_platform() noexcept; + public: + // Should also have platform-specific implementations as needed + FatalConditionHandler(); + ~FatalConditionHandler(); -#if defined(CATCH_PLATFORM_WINDOWS) + void engage() { + assert(!m_started && "Handler cannot be installed twice."); + m_started = true; + engage_platform(); + } -#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 + void disengage() noexcept { + assert(m_started && "Handler cannot be uninstalled without being installed first"); + m_started = false; + disengage_platform(); + } + }; -#ifdef __AFXDLL -#include <AfxWin.h> -#else -#include <windows.h> -#endif + //! Simple RAII guard for (dis)engaging the FatalConditionHandler + class FatalConditionHandlerGuard { + FatalConditionHandler* m_handler; + public: + FatalConditionHandlerGuard(FatalConditionHandler* handler): + m_handler(handler) { + m_handler->engage(); + } + ~FatalConditionHandlerGuard() { + m_handler->disengage(); + } + }; -#ifdef CATCH_DEFINED_NOMINMAX -# undef NOMINMAX -#endif -#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN -# undef WIN32_LEAN_AND_MEAN -#endif +} // end namespace Catch -#endif // defined(CATCH_PLATFORM_WINDOWS) +#endif // CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED -#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + +#ifndef CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED +#define CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED -#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +#ifndef CATCH_POLYFILLS_HPP_INCLUDED +#define CATCH_POLYFILLS_HPP_INCLUDED namespace Catch { + bool isnan(float f); + bool isnan(double d); +} - struct FatalConditionHandler { +#endif // CATCH_POLYFILLS_HPP_INCLUDED - static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); - FatalConditionHandler(); - static void reset(); - ~FatalConditionHandler() { reset(); } +#include <cassert> +#include <cmath> +#include <cstdint> +#include <utility> +#include <limits> - private: - static bool isSet; - static ULONG guaranteeSize; - static PVOID exceptionHandlerHandle; - }; +namespace Catch { + namespace Detail { -} // namespace Catch + uint32_t convertToBits(float f); + uint64_t convertToBits(double d); -#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + } // end namespace Detail -#include <signal.h> -namespace Catch { - struct FatalConditionHandler { +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push + // We do a bunch of direct compensations of floating point numbers, + // because we know what we are doing and actually do want the direct + // comparison behaviour. +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif - static bool isSet; - static struct sigaction oldSigActions[]; - static stack_t oldSigStack; - static char altStackMem[]; + /** + * Calculates the ULP distance between two floating point numbers + * + * The ULP distance of two floating point numbers is the count of + * valid floating point numbers representable between them. + * + * There are some exceptions between how this function counts the + * distance, and the interpretation of the standard as implemented. + * by e.g. `nextafter`. For this function it always holds that: + * * `(x == y) => ulpDistance(x, y) == 0` (so `ulpDistance(-0, 0) == 0`) + * * `ulpDistance(maxFinite, INF) == 1` + * * `ulpDistance(x, -x) == 2 * ulpDistance(x, 0)` + * + * \pre `!isnan( lhs )` + * \pre `!isnan( rhs )` + * \pre floating point numbers are represented in IEEE-754 format + */ + template <typename FP> + uint64_t ulpDistance( FP lhs, FP rhs ) { + assert( std::numeric_limits<FP>::is_iec559 && + "ulpDistance assumes IEEE-754 format for floating point types" ); + assert( !Catch::isnan( lhs ) && + "Distance between NaN and number is not meaningful" ); + assert( !Catch::isnan( rhs ) && + "Distance between NaN and number is not meaningful" ); + + // We want X == Y to imply 0 ULP distance even if X and Y aren't + // bit-equal (-0 and 0), or X - Y != 0 (same sign infinities). + if ( lhs == rhs ) { return 0; } + + // We need a properly typed positive zero for type inference. + static constexpr FP positive_zero{}; + + // We want to ensure that +/- 0 is always represented as positive zero + if ( lhs == positive_zero ) { lhs = positive_zero; } + if ( rhs == positive_zero ) { rhs = positive_zero; } + + // If arguments have different signs, we can handle them by summing + // how far are they from 0 each. + if ( std::signbit( lhs ) != std::signbit( rhs ) ) { + return ulpDistance( std::abs( lhs ), positive_zero ) + + ulpDistance( std::abs( rhs ), positive_zero ); + } + + // When both lhs and rhs are of the same sign, we can just + // read the numbers bitwise as integers, and then subtract them + // (assuming IEEE). + uint64_t lc = Detail::convertToBits( lhs ); + uint64_t rc = Detail::convertToBits( rhs ); + + // The ulp distance between two numbers is symmetric, so to avoid + // dealing with overflows we want the bigger converted number on the lhs + if ( lc < rc ) { + std::swap( lc, rc ); + } + + return lc - rc; + } - static void handleSignal( int sig ); +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif - FatalConditionHandler(); - ~FatalConditionHandler() { reset(); } - static void reset(); - }; -} // namespace Catch +} // end namespace Catch +#endif // CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED -#else + +#ifndef CATCH_ISTREAM_HPP_INCLUDED +#define CATCH_ISTREAM_HPP_INCLUDED + + +#include <iosfwd> +#include <cstddef> +#include <ostream> +#include <string> namespace Catch { - struct FatalConditionHandler {}; -} -#endif + class IStream { + public: + virtual ~IStream(); // = default + virtual std::ostream& stream() = 0; + /** + * Best guess on whether the instance is writing to a console (e.g. via stdout/stderr) + * + * This is useful for e.g. Win32 colour support, because the Win32 + * API manipulates console directly, unlike POSIX escape codes, + * that can be written anywhere. + * + * Due to variety of ways to change where the stdout/stderr is + * _actually_ being written, users should always assume that + * the answer might be wrong. + */ + virtual bool isConsole() const { return false; } + }; -#endif // CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED + /** + * Creates a stream wrapper that writes to specific file. + * + * Also recognizes 4 special filenames + * * `-` for stdout + * * `%stdout` for stdout + * * `%stderr` for stderr + * * `%debug` for platform specific debugging output + * + * \throws if passed an unrecognized %-prefixed stream + */ + auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream>; + +} + +#endif // CATCH_STREAM_HPP_INCLUDED #ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED @@ -7907,13 +8626,17 @@ namespace Catch { namespace Catch { - struct IStreamingReporter; + class IEventListener; class Config; struct ReporterDescription { std::string name, description; }; + struct ListenerDescription { + StringRef name; + std::string description; + }; struct TagInfo { void add(StringRef spelling); @@ -7923,81 +8646,13 @@ namespace Catch { std::size_t count = 0; }; - bool list( IStreamingReporter& reporter, Config const& config ); + bool list( IEventListener& 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 @@ -8108,17 +8763,6 @@ 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 @@ -8133,10 +8777,10 @@ namespace Catch { ReporterRegistry(); ~ReporterRegistry() override; // = default, out of line to allow fwd decl - IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const override; + IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const override; void registerReporter( std::string const& name, IReporterFactoryPtr factory ); - void registerListener( IReporterFactoryPtr factory ); + void registerListener( Detail::unique_ptr<EventListenerFactory> factory ); FactoryMap const& getFactories() const override; Listeners const& getListeners() const override; @@ -8161,7 +8805,6 @@ namespace Catch { #include <string> #include <vector> -#include <memory> namespace Catch { namespace TestCaseTracking { @@ -8179,19 +8822,31 @@ namespace TestCaseTracking { class ITracker; - using ITrackerPtr = std::shared_ptr<ITracker>; + using ITrackerPtr = Catch::Detail::unique_ptr<ITracker>; - class ITracker { + class ITracker { NameAndLocation m_nameAndLocation; using Children = std::vector<ITrackerPtr>; protected: + enum CycleState { + NotStarted, + Executing, + ExecutingChildren, + NeedsAnotherRun, + CompletedSuccessfully, + Failed + }; + + ITracker* m_parent = nullptr; Children m_children; + CycleState m_runState = NotStarted; public: - ITracker(NameAndLocation const& nameAndLoc) : - m_nameAndLocation(nameAndLoc) + ITracker( NameAndLocation const& nameAndLoc, ITracker* parent ): + m_nameAndLocation( nameAndLoc ), + m_parent( parent ) {} @@ -8199,42 +8854,60 @@ namespace TestCaseTracking { NameAndLocation const& nameAndLocation() const { return m_nameAndLocation; } + ITracker* parent() const { + return m_parent; + } - virtual ~ITracker(); + virtual ~ITracker(); // = default // 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; + //! Returns true if tracker run to completion (successfully or not) + virtual bool isComplete() const = 0; + //! Returns true if tracker run to completion succesfully + bool isSuccessfullyCompleted() const; + //! Returns true if tracker has started but hasn't been completed + bool isOpen() const; + //! Returns true iff tracker has started + bool hasStarted() const; // actions virtual void close() = 0; // Successfully complete virtual void fail() = 0; - virtual void markAsNeedingAnotherRun() = 0; + void markAsNeedingAnotherRun(); //! Register a nested ITracker - void addChild( ITrackerPtr const& child ); + void addChild( ITrackerPtr&& child ); /** * Returns ptr to specific child if register with this tracker. * * Returns nullptr if not found. */ - ITrackerPtr findChild( NameAndLocation const& nameAndLocation ); + ITracker* findChild( NameAndLocation const& nameAndLocation ); //! Have any children been added? bool hasChildren() const { return !m_children.empty(); } - virtual void openChild() = 0; + //! Marks tracker as executing a child, doing se recursively up the tree + void openChild(); - // Debug/ checking - virtual bool isSectionTracker() const = 0; - virtual bool isGeneratorTracker() const = 0; + /** + * Returns true if the instance is a section tracker + * + * Subclasses should override to true if they are, replaces RTTI + * for internal debug checks. + */ + virtual bool isSectionTracker() const; + /** + * Returns true if the instance is a generator tracker + * + * Subclasses should override to true if they are, replaces RTTI + * for internal debug checks. + */ + virtual bool isGeneratorTracker() const; }; class TrackerContext { @@ -8264,41 +8937,18 @@ namespace TestCaseTracking { 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(); @@ -8306,7 +8956,7 @@ namespace TestCaseTracking { }; class SectionTracker : public TrackerBase { - std::vector<std::string> m_filters; + std::vector<StringRef> m_filters; std::string m_trimmed_name; public: SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); @@ -8320,7 +8970,11 @@ namespace TestCaseTracking { void tryOpen(); void addInitialFilters( std::vector<std::string> const& filters ); - void addNextFilters( std::vector<std::string> const& filters ); + void addNextFilters( std::vector<StringRef> const& filters ); + //! Returns filters active in this tracker + std::vector<StringRef> const& getFilters() const; + //! Returns whitespace-trimmed name of the tracked section + StringRef trimmedName() const; }; } // namespace TestCaseTracking @@ -8337,25 +8991,22 @@ using TestCaseTracking::SectionTracker; namespace Catch { - struct IMutableContext; - struct IGeneratorTracker; - struct IConfig; + class IMutableContext; + class IGeneratorTracker; + class IConfig; /////////////////////////////////////////////////////////////////////////// - class RunContext : public IResultCapture, public IRunner { + class RunContext : public IResultCapture { public: RunContext( RunContext const& ) = delete; RunContext& operator =( RunContext const& ) = delete; - explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter ); + explicit RunContext( IConfig const* _config, IEventListenerPtr&& 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 @@ -8368,7 +9019,7 @@ namespace Catch { void handleMessage ( AssertionInfo const& info, ResultWas::OfType resultType, - StringRef const& message, + StringRef message, AssertionReaction& reaction ) override; void handleUnexpectedExceptionNotThrown ( AssertionInfo const& info, @@ -8391,10 +9042,10 @@ namespace Catch { auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; - void benchmarkPreparing( std::string const& name ) override; + void benchmarkPreparing( StringRef name ) override; void benchmarkStarting( BenchmarkInfo const& info ) override; void benchmarkEnded( BenchmarkStats<> const& stats ) override; - void benchmarkFailed( std::string const& error ) override; + void benchmarkFailed( StringRef error ) override; void pushScopedMessage( MessageInfo const& message ) override; void popScopedMessage( MessageInfo const& message ) override; @@ -8415,7 +9066,7 @@ namespace Catch { public: // !TBD We need to do this another way! - bool aborting() const override; + bool aborting() const; private: @@ -8442,27 +9093,63 @@ namespace Catch { IMutableContext& m_context; TestCaseHandle const* m_activeTestCase = nullptr; ITracker* m_testCaseTracker = nullptr; - Option<AssertionResult> m_lastResult; + Optional<AssertionResult> m_lastResult; IConfig const* m_config; Totals m_totals; - IStreamingReporterPtr m_reporter; + IEventListenerPtr 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; + FatalConditionHandler m_fatalConditionhandler; bool m_lastAssertionPassed = false; bool m_shouldReportUnexpected = true; bool m_includeSuccessfulResults; }; - void seedRng(IConfig const& config); - unsigned int rngSeed(); -} // end namespace Catch + void seedRng(IConfig const& config); + unsigned int rngSeed(); +} // end namespace Catch + +#endif // CATCH_RUN_CONTEXT_HPP_INCLUDED + + +#ifndef CATCH_SHARDING_HPP_INCLUDED +#define CATCH_SHARDING_HPP_INCLUDED + + +#include <cmath> + +namespace Catch { + + template<typename Container> + Container createShard(Container const& container, std::size_t const shardCount, std::size_t const shardIndex) { + assert(shardCount > shardIndex); + + if (shardCount == 1) { + return container; + } + + const std::size_t totalTestCount = container.size(); + + const std::size_t shardSize = totalTestCount / shardCount; + const std::size_t leftoverTests = totalTestCount % shardCount; + + const std::size_t startIndex = shardIndex * shardSize + (std::min)(shardIndex, leftoverTests); + const std::size_t endIndex = (shardIndex + 1) * shardSize + (std::min)(shardIndex + 1, leftoverTests); + + auto startIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(startIndex)); + auto endIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(endIndex)); + + return Container(startIterator, endIterator); + } -#endif // CATCH_RUN_CONTEXT_HPP_INCLUDED +} + +#endif // CATCH_SHARDING_HPP_INCLUDED #ifndef CATCH_SINGLETONS_HPP_INCLUDED @@ -8471,7 +9158,7 @@ namespace Catch { namespace Catch { struct ISingleton { - virtual ~ISingleton(); + virtual ~ISingleton(); // = default }; @@ -8529,6 +9216,23 @@ namespace Catch { #endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED + +#ifndef CATCH_STDSTREAMS_HPP_INCLUDED +#define CATCH_STDSTREAMS_HPP_INCLUDED + +#include <iosfwd> + +namespace Catch { + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + +} // namespace Catch + +#endif + + #ifndef CATCH_STRING_MANIP_HPP_INCLUDED #define CATCH_STRING_MANIP_HPP_INCLUDED @@ -8540,12 +9244,13 @@ namespace Catch { namespace Catch { bool startsWith( std::string const& s, std::string const& prefix ); - bool startsWith( std::string const& s, char prefix ); + bool startsWith( StringRef 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 ); + char toLower( char c ); //! 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! @@ -8555,13 +9260,27 @@ namespace Catch { 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 ); + /** + * Helper for streaming a "count [maybe-plural-of-label]" human-friendly string + * + * Usage example: + * ```cpp + * std::cout << "Found " << pluralise(count, "error") << '\n'; + * ``` + * + * **Important:** The provided string must outlive the instance + */ + class pluralise { + std::uint64_t m_count; + StringRef m_label; + + public: + constexpr pluralise(std::uint64_t count, StringRef label): + m_count(count), + m_label(label) + {} friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); - - std::size_t m_count; - std::string m_label; }; } @@ -8576,6 +9295,7 @@ namespace Catch { #include <string> namespace Catch { + struct SourceLineInfo; class TagAliasRegistry : public ITagAliasRegistry { public: @@ -8593,6 +9313,30 @@ namespace Catch { #endif // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED +#ifndef CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED +#define CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + + struct TestCaseInfo; + + class TestCaseInfoHasher { + public: + using hash_t = std::uint64_t; + TestCaseInfoHasher( hash_t seed ); + uint32_t operator()( TestCaseInfo const& t ) const; + + private: + hash_t m_seed; + }; + +} // namespace Catch + +#endif /* CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED */ + + #ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED #define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED @@ -8602,7 +9346,7 @@ namespace Catch { namespace Catch { class TestCaseHandle; - struct IConfig; + class IConfig; class TestSpec; std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ); @@ -8649,9 +9393,6 @@ namespace Catch { void invoke() const override; }; - - std::string extractClassName( StringRef const& classOrQualifiedMethodName ); - /////////////////////////////////////////////////////////////////////////// @@ -8675,7 +9416,7 @@ namespace Catch { namespace Catch { - struct ITagAliasRegistry; + class ITagAliasRegistry; class TestSpecParser { enum Mode{ None, Name, QuotedName, Tag, EscapedName }; @@ -8749,31 +9490,49 @@ namespace Catch { class Columns; + /** + * Represents a column of text with specific width and indentation + * + * When written out to a stream, it will perform linebreaking + * of the provided text so that the written lines fit within + * target width. + */ class Column { + // String to be written out std::string m_string; + // Width of the column for linebreaking size_t m_width = CATCH_CONFIG_CONSOLE_WIDTH - 1; + // Indentation of other lines (including first if initial indent is unset) size_t m_indent = 0; + // Indentation of the first line size_t m_initialIndent = std::string::npos; public: - class iterator { + /** + * Iterates "lines" in `Column` and return sthem + */ + class const_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() ) {} - + // Where does the current line start? + size_t m_lineStart = 0; + // How long should the current line be? + size_t m_lineLength = 0; + // How far have we checked the string to iterate? + size_t m_parsedTo = 0; + // Should a '-' be appended to the line? + bool m_addHyphen = false; + + const_iterator( Column const& column, EndTag ): + m_column( column ), m_lineStart( m_column.m_string.size() ) {} + + // Calculates the length of the current line void calcLength(); // Returns current indention width - size_t indent() const; + size_t indentSize() const; // Creates an indented and (optionally) suffixed string from // current iterator position, indentation and length. @@ -8787,21 +9546,21 @@ namespace Catch { using reference = value_type&; using iterator_category = std::forward_iterator_tag; - explicit iterator( Column const& column ); + explicit const_iterator( Column const& column ); std::string operator*() const; - iterator& operator++(); - iterator operator++( int ); + const_iterator& operator++(); + const_iterator operator++( int ); - bool operator==( iterator const& other ) const { - return m_pos == other.m_pos && &m_column == &other.m_column; + bool operator==( const_iterator const& other ) const { + return m_lineStart == other.m_lineStart && &m_column == &other.m_column; } - bool operator!=( iterator const& other ) const { + bool operator!=( const_iterator const& other ) const { return !operator==( other ); } }; - using const_iterator = iterator; + using iterator = const_iterator; explicit Column( std::string const& text ): m_string( text ) {} @@ -8820,8 +9579,8 @@ namespace Catch { } size_t width() const { return m_width; } - iterator begin() const { return iterator( *this ); } - iterator end() const { return { *this, iterator::EndTag{} }; } + const_iterator begin() const { return const_iterator( *this ); } + const_iterator end() const { return { *this, const_iterator::EndTag{} }; } friend std::ostream& operator<<( std::ostream& os, Column const& col ); @@ -8841,7 +9600,7 @@ namespace Catch { struct EndTag {}; std::vector<Column> const& m_columns; - std::vector<Column::iterator> m_iterators; + std::vector<Column::const_iterator> m_iterators; size_t m_activeIterators; iterator( Columns const& columns, EndTag ); @@ -8914,16 +9673,37 @@ namespace Catch { #endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED -#ifndef CATCH_XMLWRITER_HPP_INCLUDED -#define CATCH_XMLWRITER_HPP_INCLUDED +#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +#define CATCH_WINDOWS_H_PROXY_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. +#if defined(CATCH_PLATFORM_WINDOWS) + +// We might end up with the define made globally through the compiler, +// and we don't want to trigger warnings for this +#if !defined(NOMINMAX) +# define NOMINMAX +#endif +#if !defined(WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +#endif + +#ifdef __AFXDLL +#include <AfxWin.h> +#else +#include <windows.h> +#endif + +#endif // defined(CATCH_PLATFORM_WINDOWS) + +#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +#ifndef CATCH_XMLWRITER_HPP_INCLUDED +#define CATCH_XMLWRITER_HPP_INCLUDED + + +#include <iosfwd> #include <vector> namespace Catch { @@ -8936,18 +9716,24 @@ namespace Catch { XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); + /** + * Helper for XML-encoding text (escaping angle brackets, quotes, etc) + * + * Note: doesn't take ownership of passed strings, and thus the + * encoded string must outlive the encoding instance. + */ class XmlEncode { public: enum ForWhat { ForTextNodes, ForAttributes }; - XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); + XmlEncode( StringRef 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; + StringRef m_str; ForWhat m_forWhat; }; @@ -8963,20 +9749,32 @@ namespace Catch { ~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 ) { + ScopedElement& + writeText( StringRef text, + XmlFormatting fmt = XmlFormatting::Newline | + XmlFormatting::Indent ); + + ScopedElement& writeAttribute( StringRef name, + StringRef attribute ); + template <typename T, + // Without this SFINAE, this overload is a better match + // for `std::string`, `char const*`, `char const[N]` args. + // While it would still work, it would cause code bloat + // and multiple iteration over the strings + typename = typename std::enable_if_t< + !std::is_convertible<T, StringRef>::value>> + ScopedElement& writeAttribute( StringRef name, + T const& attribute ) { m_writer->writeAttribute( name, attribute ); return *this; } private: - mutable XmlWriter* m_writer = nullptr; + XmlWriter* m_writer = nullptr; XmlFormatting m_fmt; }; - XmlWriter( std::ostream& os = Catch::cout() ); + XmlWriter( std::ostream& os ); ~XmlWriter(); XmlWriter( XmlWriter const& ) = delete; @@ -8988,24 +9786,41 @@ namespace Catch { 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 ) { + //! The attribute content is XML-encoded + XmlWriter& writeAttribute( StringRef name, StringRef attribute ); + + //! Writes the attribute as "true/false" + XmlWriter& writeAttribute( StringRef name, bool attribute ); + + //! The attribute content is XML-encoded + XmlWriter& writeAttribute( StringRef name, char const* attribute ); + + //! The attribute value must provide op<<(ostream&, T). The resulting + //! serialization is XML-encoded + template <typename T, + // Without this SFINAE, this overload is a better match + // for `std::string`, `char const*`, `char const[N]` args. + // While it would still work, it would cause code bloat + // and multiple iteration over the strings + typename = typename std::enable_if_t< + !std::is_convertible<T, StringRef>::value>> + XmlWriter& writeAttribute( StringRef 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); + //! Writes escaped `text` in a element + XmlWriter& writeText( StringRef text, + XmlFormatting fmt = XmlFormatting::Newline | + XmlFormatting::Indent ); - void writeStylesheetRef( std::string const& url ); + //! Writes XML comment as "<!-- text -->" + XmlWriter& writeComment( StringRef text, + XmlFormatting fmt = XmlFormatting::Newline | + XmlFormatting::Indent ); - XmlWriter& writeBlankLine(); + void writeStylesheetRef( StringRef url ); void ensureTagClosed(); @@ -9063,35 +9878,32 @@ namespace Catch { MatcherT const& m_matcher; StringRef m_matcherString; public: - MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef const& matcherString ) + MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose - m_arg( std::forward<ArgT>(arg) ), + m_arg( CATCH_FORWARD(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; + void streamReconstructedExpression( std::ostream& os ) const override { + os << Catch::Detail::stringify( m_arg ) + << ' ' + << m_matcher.toString(); } }; namespace Matchers { template <typename ArgT> - struct MatcherBase; + class MatcherBase; } using StringMatcher = Matchers::MatcherBase<std::string>; - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef 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 ); + auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher, matcherString ); } } // namespace Catch @@ -9155,27 +9967,20 @@ namespace Matchers { 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> {}; + class MatcherBase : public MatcherUntypedBase { + public: + virtual bool match( T const& arg ) const = 0; + }; namespace Detail { template<typename ArgT> - struct MatchAllOf final : MatcherBase<ArgT> { + class MatchAllOf final : public MatcherBase<ArgT> { + std::vector<MatcherBase<ArgT> const*> m_matchers; + + public: MatchAllOf() = default; MatchAllOf(MatchAllOf const&) = delete; MatchAllOf& operator=(MatchAllOf const&) = delete; @@ -9208,15 +10013,12 @@ namespace Matchers { friend MatchAllOf operator&& (MatchAllOf&& lhs, MatcherBase<ArgT> const& rhs) { lhs.m_matchers.push_back(&rhs); - return std::move(lhs); + return CATCH_MOVE(lhs); } friend MatchAllOf operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf&& rhs) { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); - return std::move(rhs); + return CATCH_MOVE(rhs); } - - private: - std::vector<MatcherBase<ArgT> const*> m_matchers; }; //! lvalue overload is intentionally deleted, users should @@ -9229,7 +10031,9 @@ namespace Matchers { MatchAllOf<ArgT> operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf<ArgT> const& rhs) = delete; template<typename ArgT> - struct MatchAnyOf final : MatcherBase<ArgT> { + class MatchAnyOf final : public MatcherBase<ArgT> { + std::vector<MatcherBase<ArgT> const*> m_matchers; + public: MatchAnyOf() = default; MatchAnyOf(MatchAnyOf const&) = delete; MatchAnyOf& operator=(MatchAnyOf const&) = delete; @@ -9261,15 +10065,12 @@ namespace Matchers { friend MatchAnyOf operator|| (MatchAnyOf&& lhs, MatcherBase<ArgT> const& rhs) { lhs.m_matchers.push_back(&rhs); - return std::move(lhs); + return CATCH_MOVE(lhs); } friend MatchAnyOf operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf&& rhs) { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); - return std::move(rhs); + return CATCH_MOVE(rhs); } - - private: - std::vector<MatcherBase<ArgT> const*> m_matchers; }; //! lvalue overload is intentionally deleted, users should @@ -9282,8 +10083,10 @@ namespace Matchers { MatchAnyOf<ArgT> operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf<ArgT> const& rhs) = delete; template<typename ArgT> - struct MatchNotOf final : MatcherBase<ArgT> { + class MatchNotOf final : public MatcherBase<ArgT> { + MatcherBase<ArgT> const& m_underlyingMatcher; + public: explicit MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ): m_underlyingMatcher( underlyingMatcher ) {} @@ -9295,9 +10098,6 @@ namespace Matchers { std::string describe() const override { return "not " + m_underlyingMatcher.toString(); } - - private: - MatcherBase<ArgT> const& m_underlyingMatcher; }; } // namespace Detail @@ -9382,13 +10182,13 @@ namespace Matchers { #include <algorithm> #include <string> #include <type_traits> -#include <utility> namespace Catch { namespace Matchers { - struct MatcherGenericBase : MatcherUntypedBase { + class MatcherGenericBase : public MatcherUntypedBase { + public: MatcherGenericBase() = default; - virtual ~MatcherGenericBase(); // = default; + ~MatcherGenericBase() override; // = default; MatcherGenericBase(MatcherGenericBase&) = default; MatcherGenericBase(MatcherGenericBase&&) = default; @@ -9422,11 +10222,11 @@ namespace Matchers { return arr; } - #ifdef CATCH_CPP17_OR_GREATER +#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 using std::conjunction; - #else // CATCH_CPP17_OR_GREATER +#else // __cpp_lib_logical_traits template<typename... Cond> struct conjunction : std::true_type {}; @@ -9434,7 +10234,7 @@ namespace Matchers { template<typename Cond, typename... Rest> struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {}; - #endif // CATCH_CPP17_OR_GREATER +#endif // __cpp_lib_logical_traits template<typename T> using is_generic_matcher = std::is_base_of< @@ -9486,7 +10286,8 @@ namespace Matchers { template<typename... MatcherTs> - struct MatchAllOfGeneric final : MatcherGenericBase { + class MatchAllOfGeneric final : public MatcherGenericBase { + public: MatchAllOfGeneric(MatchAllOfGeneric const&) = delete; MatchAllOfGeneric& operator=(MatchAllOfGeneric const&) = delete; MatchAllOfGeneric(MatchAllOfGeneric&&) = default; @@ -9504,7 +10305,11 @@ namespace Matchers { return describe_multi_matcher<MatcherTs...>(" and "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); } - std::array<void const*, sizeof...(MatcherTs)> m_matchers; + // Has to be public to enable the concatenating operators + // below, because they are not friend of the RHS, only LHS, + // and thus cannot access private fields of RHS + std::array<void const*, sizeof...( MatcherTs )> m_matchers; + //! Avoids type nesting for `GenericAllOf && GenericAllOf` case template<typename... MatchersRHS> @@ -9512,7 +10317,7 @@ namespace Matchers { 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))}; + return MatchAllOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))}; } //! Avoids type nesting for `GenericAllOf && some matcher` case @@ -9521,7 +10326,7 @@ namespace Matchers { 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))}; + return MatchAllOfGeneric<MatcherTs..., MatcherRHS>{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast<void const*>(&rhs))}; } //! Avoids type nesting for `some matcher && GenericAllOf` case @@ -9530,13 +10335,14 @@ namespace Matchers { 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))}; + return MatchAllOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))}; } }; template<typename... MatcherTs> - struct MatchAnyOfGeneric final : MatcherGenericBase { + class MatchAnyOfGeneric final : public MatcherGenericBase { + public: MatchAnyOfGeneric(MatchAnyOfGeneric const&) = delete; MatchAnyOfGeneric& operator=(MatchAnyOfGeneric const&) = delete; MatchAnyOfGeneric(MatchAnyOfGeneric&&) = default; @@ -9554,14 +10360,18 @@ namespace Matchers { return describe_multi_matcher<MatcherTs...>(" or "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); } - std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + // Has to be public to enable the concatenating operators + // below, because they are not friend of the RHS, only LHS, + // and thus cannot access private fields of RHS + 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))}; + return MatchAnyOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))}; } //! Avoids type nesting for `GenericAnyOf || some matcher` case @@ -9570,7 +10380,7 @@ namespace Matchers { 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)))}; + return MatchAnyOfGeneric<MatcherTs..., MatcherRHS>{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast<void const*>(std::addressof(rhs)))}; } //! Avoids type nesting for `some matcher || GenericAnyOf` case @@ -9579,13 +10389,16 @@ namespace Matchers { 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))}; + return MatchAnyOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))}; } }; template<typename MatcherT> - struct MatchNotOfGeneric final : MatcherGenericBase { + class MatchNotOfGeneric final : public MatcherGenericBase { + MatcherT const& m_matcher; + + public: MatchNotOfGeneric(MatchNotOfGeneric const&) = delete; MatchNotOfGeneric& operator=(MatchNotOfGeneric const&) = delete; MatchNotOfGeneric(MatchNotOfGeneric&&) = default; @@ -9606,8 +10419,6 @@ namespace Matchers { friend MatcherT const& operator ! (MatchNotOfGeneric<MatcherT> const& matcher) { return matcher.m_matcher; } - private: - MatcherT const& m_matcher; }; } // namespace Detail @@ -9668,7 +10479,6 @@ namespace Catch { 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) @@ -9707,7 +10517,7 @@ namespace Catch { Matcher m_matcher; public: explicit SizeMatchesMatcher(Matcher m): - m_matcher(std::move(m)) + m_matcher(CATCH_MOVE(m)) {} template <typename RangeLike> @@ -9733,7 +10543,7 @@ namespace Catch { template <typename Matcher> std::enable_if_t<Detail::is_matcher<Matcher>::value, SizeMatchesMatcher<Matcher>> SizeIs(Matcher&& m) { - return SizeMatchesMatcher<Matcher>{std::forward<Matcher>(m)}; + return SizeMatchesMatcher<Matcher>{CATCH_FORWARD(m)}; } } // end namespace Matchers @@ -9748,7 +10558,6 @@ namespace Catch { #include <algorithm> #include <functional> -#include <utility> namespace Catch { namespace Matchers { @@ -9760,8 +10569,8 @@ namespace Catch { public: template <typename T2, typename Equality2> ContainsElementMatcher(T2&& target, Equality2&& predicate): - m_desired(std::forward<T2>(target)), - m_eq(std::forward<Equality2>(predicate)) + m_desired(CATCH_FORWARD(target)), + m_eq(CATCH_FORWARD(predicate)) {} std::string describe() const override { @@ -9788,12 +10597,11 @@ namespace Catch { // constructor (and also avoid some perfect forwarding failure // cases) ContainsMatcherMatcher(Matcher matcher): - m_matcher(std::move(matcher)) + m_matcher(CATCH_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; @@ -9815,14 +10623,14 @@ namespace Catch { 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<>{} }; + return { CATCH_FORWARD(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) }; + return { CATCH_FORWARD(matcher) }; } /** @@ -9832,7 +10640,7 @@ namespace Catch { */ template <typename T, typename Equality> ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) { - return { std::forward<T>(elem), std::forward<Equality>(eq) }; + return { CATCH_FORWARD(elem), CATCH_FORWARD(eq) }; } } @@ -9870,8 +10678,8 @@ ExceptionMessageMatcher Message(std::string const& message); #endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED -#ifndef CATCH_MATCHERS_FLOATING_HPP_INCLUDED -#define CATCH_MATCHERS_FLOATING_HPP_INCLUDED +#ifndef CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED +#define CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED namespace Catch { @@ -9881,7 +10689,8 @@ namespace Matchers { enum class FloatingPointKind : uint8_t; } - struct WithinAbsMatcher final : MatcherBase<double> { + class WithinAbsMatcher final : public MatcherBase<double> { + public: WithinAbsMatcher(double target, double margin); bool match(double const& matchee) const override; std::string describe() const override; @@ -9890,8 +10699,11 @@ namespace Matchers { double m_margin; }; - struct WithinUlpsMatcher final : MatcherBase<double> { - WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType); + class WithinUlpsMatcher final : public MatcherBase<double> { + public: + WithinUlpsMatcher( double target, + uint64_t ulps, + Detail::FloatingPointKind baseType ); bool match(double const& matchee) const override; std::string describe() const override; private: @@ -9906,8 +10718,9 @@ namespace Matchers { // |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); + class WithinRelMatcher final : public MatcherBase<double> { + public: + WithinRelMatcher( double target, double epsilon ); bool match(double const& matchee) const override; std::string describe() const override; private: @@ -9934,7 +10747,7 @@ namespace Matchers { } // namespace Matchers } // namespace Catch -#endif // CATCH_MATCHERS_FLOATING_HPP_INCLUDED +#endif // CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED #ifndef CATCH_MATCHERS_PREDICATE_HPP_INCLUDED @@ -9942,7 +10755,6 @@ namespace Matchers { #include <string> -#include <utility> namespace Catch { namespace Matchers { @@ -9958,7 +10770,7 @@ class PredicateMatcher final : public MatcherBase<T> { public: PredicateMatcher(Predicate&& elem, std::string const& descr) - :m_predicate(std::forward<Predicate>(elem)), + :m_predicate(CATCH_FORWARD(elem)), m_description(Detail::finalizeDescription(descr)) {} @@ -9980,7 +10792,7 @@ public: 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); + return PredicateMatcher<T, Pred>(CATCH_FORWARD(predicate), description); } } // namespace Matchers @@ -9989,6 +10801,164 @@ public: #endif // CATCH_MATCHERS_PREDICATE_HPP_INCLUDED +#ifndef CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED +#define CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED + + +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(CATCH_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(CATCH_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(CATCH_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; + } + }; + + // Matcher for checking that all elements in range are true. + class AllTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (!elem) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that no element in range is true. + class NoneTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (elem) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that any element in range is true. + class AnyTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (elem) { + return true; + } + } + return false; + } + }; + + // Creates a matcher that checks whether all elements in a range match a matcher + template <typename Matcher> + AllMatchMatcher<Matcher> AllMatch(Matcher&& matcher) { + return { CATCH_FORWARD(matcher) }; + } + + // Creates a matcher that checks whether no element in a range matches a matcher. + template <typename Matcher> + NoneMatchMatcher<Matcher> NoneMatch(Matcher&& matcher) { + return { CATCH_FORWARD(matcher) }; + } + + // Creates a matcher that checks whether any element in a range matches a matcher. + template <typename Matcher> + AnyMatchMatcher<Matcher> AnyMatch(Matcher&& matcher) { + return { CATCH_FORWARD(matcher) }; + } + + // Creates a matcher that checks whether all elements in a range are true + AllTrueMatcher AllTrue(); + + // Creates a matcher that checks whether no element in a range is true + NoneTrueMatcher NoneTrue(); + + // Creates a matcher that checks whether any element in a range is true + AnyTrueMatcher AnyTrue(); + } +} + +#endif // CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED + + #ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED #define CATCH_MATCHERS_STRING_HPP_INCLUDED @@ -10007,45 +10977,52 @@ namespace Matchers { std::string m_str; }; - struct StringMatcherBase : MatcherBase<std::string> { - StringMatcherBase( std::string const& operation, CasedString const& comparator ); - std::string describe() const override; - + class StringMatcherBase : public MatcherBase<std::string> { + protected: CasedString m_comparator; - std::string m_operation; + StringRef m_operation; + + public: + StringMatcherBase( StringRef operation, + CasedString const& comparator ); + std::string describe() const override; }; - struct StringEqualsMatcher final : StringMatcherBase { + class StringEqualsMatcher final : public StringMatcherBase { + public: StringEqualsMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct StringContainsMatcher final : StringMatcherBase { + class StringContainsMatcher final : public StringMatcherBase { + public: StringContainsMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct StartsWithMatcher final : StringMatcherBase { + class StartsWithMatcher final : public StringMatcherBase { + public: StartsWithMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct EndsWithMatcher final : StringMatcherBase { + class EndsWithMatcher final : public StringMatcherBase { + public: EndsWithMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct RegexMatcher final : MatcherBase<std::string> { + class RegexMatcher final : public MatcherBase<std::string> { + std::string m_regex; + CaseSensitive m_caseSensitivity; + + public: 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 ); + StringContainsMatcher ContainsSubstring( 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` @@ -10069,8 +11046,10 @@ namespace Catch { namespace Matchers { template<typename T, typename Alloc> - struct VectorContainsElementMatcher final : MatcherBase<std::vector<T, Alloc>> { + class VectorContainsElementMatcher final : public MatcherBase<std::vector<T, Alloc>> { + T const& m_comparator; + public: VectorContainsElementMatcher(T const& comparator): m_comparator(comparator) {} @@ -10087,13 +11066,13 @@ namespace Matchers { 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>> { + class ContainsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + public: ContainsMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -10119,13 +11098,13 @@ namespace Matchers { 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>> { + class EqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + public: EqualsMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -10145,12 +11124,14 @@ namespace Matchers { 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>> { + class ApproxMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + mutable Catch::Approx approx = Catch::Approx::custom(); + public: ApproxMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -10181,13 +11162,13 @@ namespace Matchers { 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>> { + class UnorderedEqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_target; + + public: UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target): m_target(target) {} @@ -10201,15 +11182,12 @@ namespace Matchers { 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 ) { @@ -10276,58 +11254,120 @@ namespace Matchers { -#include <iosfwd> +#ifndef CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED +#define CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED + + +#include <map> #include <string> -#include <vector> namespace Catch { + class ColourImpl; - 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; - }; + /** + * This is the base class for all reporters. + * + * If are writing a reporter, you must derive from this type, or one + * of the helper reporter bases that are derived from this type. + * + * ReporterBase centralizes handling of various common tasks in reporters, + * like storing the right stream for the reporters to write to, and + * providing the default implementation of the different listing events. + */ + class ReporterBase : public IEventListener { + protected: + //! The stream wrapper as passed to us by outside code + Detail::unique_ptr<IStream> m_wrapped_stream; + //! Cached output stream from `m_wrapped_stream` to reduce + //! number of indirect calls needed to write output. + std::ostream& m_stream; + //! Colour implementation this reporter was configured for + Detail::unique_ptr<ColourImpl> m_colour; + //! The custom reporter options user passed down to the reporter + std::map<std::string, std::string> m_customOptions; + + public: + ReporterBase( ReporterConfig&& config ); + ~ReporterBase() override; // = default; + /** + * Provides a simple default listing of reporters. + * + * Should look roughly like the reporter listing in v2 and earlier + * versions of Catch2. + */ + void listReporters( + std::vector<ReporterDescription> const& descriptions ) override; + /** + * Provides a simple default listing of listeners + * + * Looks similarly to listing of reporters, but with listener type + * instead of reporter name. + */ + void listListeners( + std::vector<ListenerDescription> const& descriptions ) override; + /** + * Provides a simple default listing of tests. + * + * Should look roughly like the test listing in v2 and earlier versions + * of Catch2. Especially supports low-verbosity listing that mimics the + * old `--list-test-names-only` output. + */ + void listTests( std::vector<TestCaseHandle> const& tests ) override; + /** + * Provides a simple default listing of tags. + * + * Should look roughly like the tag listing in v2 and earlier versions + * of Catch2. + */ + void listTags( std::vector<TagInfo> const& tags ) override; + }; +} // namespace Catch - struct StreamingReporterBase : IStreamingReporter { +#endif // CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED - StreamingReporterBase( ReporterConfig const& _config ): - m_config( _config.fullConfig() ), stream( _config.stream() ) { - } +#include <vector> +namespace Catch { + class StreamingReporterBase : public ReporterBase { + public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + StreamingReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~StreamingReporterBase() override; - void noMatchingTestCases(std::string const&) override {} + void benchmarkPreparing( StringRef ) override {} + void benchmarkStarting( BenchmarkInfo const& ) override {} + void benchmarkEnded( BenchmarkStats<> const& ) override {} + void benchmarkFailed( StringRef ) override {} - void reportInvalidArguments(std::string const&) override {} + void fatalErrorEncountered( StringRef /*error*/ ) override {} + void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {} + void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {} void testRunStarting( TestRunInfo const& _testRunInfo ) override; - void testGroupStarting( GroupInfo const& _groupInfo ) override; - void testCaseStarting(TestCaseInfo const& _testInfo) override { currentTestCaseInfo = &_testInfo; } + void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {} void sectionStarting(SectionInfo const& _sectionInfo) override { m_sectionStack.push_back(_sectionInfo); } + void assertionStarting( AssertionInfo const& ) override {} + void assertionEnded( AssertionStats const& ) override {} + void sectionEnded(SectionStats const& /* _sectionStats */) override { m_sectionStack.pop_back(); } + void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {} void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { currentTestCaseInfo = nullptr; } - void testGroupEnded( TestGroupStats const& ) override; void testRunEnded( TestRunStats const& /* _testRunStats */ ) override; void skipTest(TestCaseInfo const&) override { @@ -10335,13 +11375,11 @@ namespace Catch { // It can optionally be overridden in the derived class. } - IConfig const* m_config; - std::ostream& stream; - - LazyStat<TestRunInfo> currentTestRunInfo; - LazyStat<GroupInfo> currentGroupInfo; + protected: + TestRunInfo currentTestRunInfo{ "test run has not started yet"_sr }; TestCaseInfo const* currentTestCaseInfo = nullptr; + //! Stack of all _active_ sections in the _current_ test case std::vector<SectionInfo> m_sectionStack; }; @@ -10349,13 +11387,17 @@ namespace Catch { #endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED +#include <string> + namespace Catch { - struct AutomakeReporter : StreamingReporterBase { - AutomakeReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ) + class AutomakeReporter final : public StreamingReporterBase { + public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + AutomakeReporter(ReporterConfig&& _config): + StreamingReporterBase(CATCH_MOVE(_config)) {} - ~AutomakeReporter() override; static std::string getDescription() { @@ -10363,14 +11405,8 @@ namespace Catch { 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 @@ -10386,19 +11422,19 @@ namespace Catch { namespace Catch { - struct CompactReporter : StreamingReporterBase { - + class CompactReporter final : public StreamingReporterBase { + public: using StreamingReporterBase::StreamingReporterBase; ~CompactReporter() override; static std::string getDescription(); - void noMatchingTestCases(std::string const& spec) override; + void noMatchingTestCases( StringRef unmatchedSpec ) override; - void assertionStarting(AssertionInfo const&) override; + void testRunStarting( TestRunInfo const& _testInfo ) override; - bool assertionEnded(AssertionStats const& _assertionStats) override; + void assertionEnded(AssertionStats const& _assertionStats) override; void sectionEnded(SectionStats const& _sectionStats) override; @@ -10415,53 +11451,43 @@ namespace Catch { #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 { + class ConsoleReporter final : public StreamingReporterBase { Detail::unique_ptr<TablePrinter> m_tablePrinter; - ConsoleReporter(ReporterConfig const& config); + public: + ConsoleReporter(ReporterConfig&& config); ~ConsoleReporter() override; static std::string getDescription(); - void noMatchingTestCases(std::string const& spec) override; - - void reportInvalidArguments(std::string const&arg) override; + void noMatchingTestCases( StringRef unmatchedSpec ) override; + void reportInvalidTestSpec( StringRef arg ) override; void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const& _assertionStats) override; + void 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 benchmarkPreparing( StringRef name ) override; void benchmarkStarting(BenchmarkInfo const& info) override; void benchmarkEnded(BenchmarkStats<> const& stats) override; - void benchmarkFailed(std::string const& error) override; + void benchmarkFailed( StringRef 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: + private: void lazyPrint(); void lazyPrintWithoutClosingBenchmarkTable(); void lazyPrintRunInfo(); - void lazyPrintGroupInfo(); void printTestCaseAndSectionHeader(); void printClosedHeader(std::string const& _name); @@ -10473,22 +11499,17 @@ namespace Catch { void printTotals(Totals const& totals); - void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row); + void printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row); void printTotalsDivider(Totals const& totals); void printSummaryDivider(); - void printTestFilters(); - private: bool m_headerPrinted = false; + bool m_testRunInfoPrinted = false; }; } // end namespace Catch -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - #endif // CATCH_REPORTER_CONSOLE_HPP_INCLUDED @@ -10496,20 +11517,59 @@ namespace Catch { #define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED -#include <iosfwd> -#include <memory> #include <string> #include <vector> namespace Catch { - struct CumulativeReporterBase : IStreamingReporter { + namespace Detail { + + //! Represents either an assertion or a benchmark result to be handled by cumulative reporter later + class AssertionOrBenchmarkResult { + // This should really be a variant, but this is much faster + // to write and the data layout here is already terrible + // enough that we do not have to care about the object size. + Optional<AssertionStats> m_assertion; + Optional<BenchmarkStats<>> m_benchmark; + public: + AssertionOrBenchmarkResult(AssertionStats const& assertion); + AssertionOrBenchmarkResult(BenchmarkStats<> const& benchmark); + + bool isAssertion() const; + bool isBenchmark() const; + + AssertionStats const& asAssertion() const; + BenchmarkStats<> const& asBenchmark() const; + }; + } + + /** + * Utility base for reporters that need to handle all results at once + * + * It stores tree of all test cases, sections and assertions, and after the + * test run is finished, calls into `testRunEndedCumulative` to pass the + * control to the deriving class. + * + * If you are deriving from this class and override any testing related + * member functions, you should first call into the base's implementation to + * avoid breaking the tree construction. + * + * Due to the way this base functions, it has to expand assertions up-front, + * even if they are later unused (e.g. because the deriving reporter does + * not report successful assertions, or because the deriving reporter does + * not use assertion expansion at all). Derived classes can use two + * customization points, `m_shouldStoreSuccesfulAssertions` and + * `m_shouldStoreFailedAssertions`, to disable the expansion and gain extra + * performance. **Accessing the assertion expansions if it wasn't stored is + * UB.** + */ + class CumulativeReporterBase : public ReporterBase { + public: template<typename T, typename ChildNodeT> struct Node { explicit Node( T const& _value ) : value( _value ) {} - virtual ~Node() {} - using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>; + using ChildNodes = std::vector<Detail::unique_ptr<ChildNodeT>>; T value; ChildNodes children; }; @@ -10520,54 +11580,74 @@ namespace Catch { return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; } + bool hasAnyAssertions() const; + SectionStats stats; - using ChildSections = std::vector<std::shared_ptr<SectionNode>>; - using Assertions = std::vector<AssertionStats>; - ChildSections childSections; - Assertions assertions; + std::vector<Detail::unique_ptr<SectionNode>> childSections; + std::vector<Detail::AssertionOrBenchmarkResult> assertionsAndBenchmarks; std::string stdOut; std::string stdErr; }; using TestCaseNode = Node<TestCaseStats, SectionNode>; - using TestGroupNode = Node<TestGroupStats, TestCaseNode>; - using TestRunNode = Node<TestRunStats, TestGroupNode>; + using TestRunNode = Node<TestRunStats, TestCaseNode>; - CumulativeReporterBase( ReporterConfig const& _config ): - m_config( _config.fullConfig() ), stream( _config.stream() ) {} + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + CumulativeReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~CumulativeReporterBase() override; + void benchmarkPreparing( StringRef ) override {} + void benchmarkStarting( BenchmarkInfo const& ) override {} + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; + void benchmarkFailed( StringRef ) override {} + + void noMatchingTestCases( StringRef ) override {} + void reportInvalidTestSpec( StringRef ) override {} + void fatalErrorEncountered( StringRef /*error*/ ) override {} + void testRunStarting( TestRunInfo const& ) override {} - void testGroupStarting( GroupInfo const& ) override {} void testCaseStarting( TestCaseInfo const& ) override {} - + void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {} void sectionStarting( SectionInfo const& sectionInfo ) override; void assertionStarting( AssertionInfo const& ) override {} - bool assertionEnded( AssertionStats const& assertionStats ) override; + void assertionEnded( AssertionStats const& assertionStats ) override; void sectionEnded( SectionStats const& sectionStats ) override; + void testCasePartialEnded( TestCaseStats const&, uint64_t ) 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 {} - 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; + protected: + //! Should the cumulative base store the assertion expansion for succesful assertions? + bool m_shouldStoreSuccesfulAssertions = true; + //! Should the cumulative base store the assertion expansion for failed assertions? + bool m_shouldStoreFailedAssertions = true; - std::vector<std::shared_ptr<TestRunNode>> m_testRuns; + // We need lazy construction here. We should probably refactor it + // later, after the events are redone. + //! The root node of the test run tree. + Detail::unique_ptr<TestRunNode> m_testRun; - std::shared_ptr<SectionNode> m_rootSection; - std::shared_ptr<SectionNode> m_deepestSection; - std::vector<std::shared_ptr<SectionNode>> m_sectionStack; + private: + // Note: We rely on pointer identity being stable, which is why + // we store pointers to the nodes rather than the values. + std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases; + // Root section of the _current_ test case + Detail::unique_ptr<SectionNode> m_rootSection; + // Deepest section of the _current_ test case + SectionNode* m_deepestSection = nullptr; + // Stack of _active_ sections in the _current_ test case + std::vector<SectionNode*> m_sectionStack; }; } // end namespace Catch @@ -10582,38 +11662,44 @@ namespace Catch { namespace Catch { /** - * Base class identifying listeners. + * Base class to simplify implementing listeners. * - * Provides default implementation for all IStreamingReporter member - * functions, so that listeners implementations can pick which + * Provides empty default implementation for all IEventListener member + * functions, so that a listener implementation can pick which * member functions it actually cares about. */ - class EventListenerBase : public IStreamingReporter { - IConfig const* m_config; - + class EventListenerBase : public IEventListener { public: - EventListenerBase( ReporterConfig const& config ): - m_config( config.fullConfig() ) {} + using IEventListener::IEventListener; + + void reportInvalidTestSpec( StringRef unmatchedSpec ) override; + void fatalErrorEncountered( StringRef error ) override; + + void benchmarkPreparing( StringRef name ) override; + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; + void benchmarkFailed( StringRef error ) override; void assertionStarting( AssertionInfo const& assertionInfo ) override; - bool assertionEnded( AssertionStats const& assertionStats ) override; + void 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 listReporters( + std::vector<ReporterDescription> const& descriptions ) override; + void listListeners( + std::vector<ListenerDescription> 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 noMatchingTestCases( StringRef unmatchedSpec ) override; void testRunStarting( TestRunInfo const& testRunInfo ) override; - void testGroupStarting( GroupInfo const& groupInfo ) override; void testCaseStarting( TestCaseInfo const& testInfo ) override; + void testCasePartialStarting( TestCaseInfo const& testInfo, + uint64_t partNumber ) override; void sectionStarting( SectionInfo const& sectionInfo ) override; void sectionEnded( SectionStats const& sectionStats ) override; + void testCasePartialEnded( TestCaseStats const& testCaseStats, + uint64_t partNumber ) 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; }; @@ -10630,9 +11716,12 @@ namespace Catch { #include <string> #include <vector> + namespace Catch { - struct IConfig; + class IConfig; + class TestCaseHandle; + class ColourImpl; // Returns double formatted as %.3f (format expected on output) std::string getFormattedDuration( double duration ); @@ -10649,6 +11738,50 @@ namespace Catch { 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 listeners descriptions to the provided stream in user-friendly + * format + */ + void defaultListListeners( std::ostream& out, + std::vector<ListenerDescription> const& descriptions ); + + /** + * 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, + ColourImpl* streamColour, + std::vector<TestCaseHandle> const& tests, + bool isFiltered, + Verbosity verbosity ); + } // end namespace Catch #endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED @@ -10661,36 +11794,32 @@ namespace Catch { namespace Catch { - class JunitReporter : public CumulativeReporterBase { + class JunitReporter final : public CumulativeReporterBase { public: - JunitReporter(ReporterConfig const& _config); + JunitReporter(ReporterConfig&& _config); - ~JunitReporter() override; + ~JunitReporter() override = default; 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 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); + private: + void writeRun(TestRunNode const& testRunNode, double suiteTime); void writeTestCase(TestCaseNode const& testCaseNode); - void writeSection(std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode); + void writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode, + bool testOkToFail ); void writeAssertions(SectionNode const& sectionNode); void writeAssertion(AssertionStats const& stats); @@ -10708,59 +11837,189 @@ namespace Catch { #endif // CATCH_REPORTER_JUNIT_HPP_INCLUDED -#ifndef CATCH_REPORTER_LISTENING_HPP_INCLUDED -#define CATCH_REPORTER_LISTENING_HPP_INCLUDED +#ifndef CATCH_REPORTER_MULTI_HPP_INCLUDED +#define CATCH_REPORTER_MULTI_HPP_INCLUDED namespace Catch { - class ListeningReporter final : public IStreamingReporter { - using Reporters = std::vector<IStreamingReporterPtr>; - Reporters m_listeners; - IStreamingReporterPtr m_reporter = nullptr; + class MultiReporter final : public IEventListener { + /* + * Stores all added reporters and listeners + * + * All Listeners are stored before all reporters, and individual + * listeners/reporters are stored in order of insertion. + */ + std::vector<IEventListenerPtr> m_reporterLikes; + bool m_haveNoncapturingReporters = false; - public: - ListeningReporter(); + // Keep track of how many listeners we have already inserted, + // so that we can insert them into the main vector at the right place + size_t m_insertedListeners = 0; + + void updatePreferences(IEventListener const& reporterish); - void addListener( IStreamingReporterPtr&& listener ); - void addReporter( IStreamingReporterPtr&& reporter ); + public: + using IEventListener::IEventListener; - public: // IStreamingReporter + void addListener( IEventListenerPtr&& listener ); + void addReporter( IEventListenerPtr&& reporter ); - void noMatchingTestCases( std::string const& spec ) override; + public: // IEventListener - void reportInvalidArguments(std::string const&arg) override; + void noMatchingTestCases( StringRef unmatchedSpec ) override; + void fatalErrorEncountered( StringRef error ) override; + void reportInvalidTestSpec( StringRef arg ) override; - void benchmarkPreparing(std::string const& name) override; + void benchmarkPreparing( StringRef name ) override; void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; - void benchmarkFailed(std::string const&) override; + void benchmarkFailed( StringRef error ) override; void testRunStarting( TestRunInfo const& testRunInfo ) override; - void testGroupStarting( GroupInfo const& groupInfo ) override; void testCaseStarting( TestCaseInfo const& testInfo ) override; + void testCasePartialStarting(TestCaseInfo const& testInfo, uint64_t partNumber) 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 assertionEnded( AssertionStats const& assertionStats ) override; void sectionEnded( SectionStats const& sectionStats ) override; + void testCasePartialEnded(TestCaseStats const& testInfo, uint64_t partNumber) 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; + void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listListeners(std::vector<ListenerDescription> 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 +#endif // CATCH_REPORTER_MULTI_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED +#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED + + +#include <type_traits> + +namespace Catch { + + namespace Detail { + + template <typename T, typename = void> + struct has_description : std::false_type {}; + + template <typename T> + struct has_description< + T, + void_t<decltype( T::getDescription() )>> + : std::true_type {}; + + //! Indirection for reporter registration, so that the error handling is + //! independent on the reporter's concrete type + void registerReporterImpl( std::string const& name, + IReporterFactoryPtr reporterPtr ); + + } // namespace Detail + + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + + template <typename T> + class ReporterFactory : public IReporterFactory { + + IEventListenerPtr create( ReporterConfig&& config ) const override { + return Detail::make_unique<T>( CATCH_MOVE(config) ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; + + + template<typename T> + class ReporterRegistrar { + public: + explicit ReporterRegistrar( std::string const& name ) { + registerReporterImpl( name, + Detail::make_unique<ReporterFactory<T>>() ); + } + }; + + template<typename T> + class ListenerRegistrar { + + class TypedListenerFactory : public EventListenerFactory { + StringRef m_listenerName; + + std::string getDescriptionImpl( std::true_type ) const { + return T::getDescription(); + } + + std::string getDescriptionImpl( std::false_type ) const { + return "(No description provided)"; + } + + public: + TypedListenerFactory( StringRef listenerName ): + m_listenerName( listenerName ) {} + + IEventListenerPtr create( IConfig const* config ) const override { + return Detail::make_unique<T>( config ); + } + + StringRef getName() const override { + return m_listenerName; + } + + std::string getDescription() const override { + return getDescriptionImpl( Detail::has_description<T>{} ); + } + }; + + public: + ListenerRegistrar(StringRef listenerName) { + getMutableRegistryHub().registerListener( Detail::make_unique<TypedListenerFactory>(listenerName) ); + } + }; +} + +#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> INTERNAL_CATCH_UNIQUE_NAME( \ + catch_internal_RegistrarFor )( 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> INTERNAL_CATCH_UNIQUE_NAME( \ + 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_REPORTER_SONARQUBE_HPP_INCLUDED @@ -10770,35 +12029,33 @@ namespace Catch { namespace Catch { - struct SonarQubeReporter : CumulativeReporterBase { - - SonarQubeReporter(ReporterConfig const& config) - : CumulativeReporterBase(config) - , xml(config.stream()) { + class SonarQubeReporter final : public CumulativeReporterBase { + public: + SonarQubeReporter(ReporterConfig&& config) + : CumulativeReporterBase(CATCH_MOVE(config)) + , xml(m_stream) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; + m_shouldStoreSuccesfulAssertions = false; } - ~SonarQubeReporter() override; + ~SonarQubeReporter() override = default; 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 testRunStarting( TestRunInfo const& testRunInfo ) override; void testRunEndedCumulative() override { + writeRun( *m_testRun ); xml.endElement(); } - void writeGroup(TestGroupNode const& groupNode); + void writeRun( TestRunNode const& groupNode ); - void writeTestFile(std::string const& filename, TestGroupNode::ChildNodes const& testCaseNodes); + void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes); void writeTestCase(TestCaseNode const& testCaseNode); @@ -10824,24 +12081,24 @@ namespace Catch { namespace Catch { - struct TAPReporter : StreamingReporterBase { - - TAPReporter( ReporterConfig const& config ): - StreamingReporterBase( config ) { + class TAPReporter final : public StreamingReporterBase { + public: + TAPReporter( ReporterConfig&& config ): + StreamingReporterBase( CATCH_MOVE(config) ) { m_preferences.shouldReportAllAssertions = true; } - ~TAPReporter() override; + ~TAPReporter() override = default; 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 testRunStarting( TestRunInfo const& testInfo ) override; - void assertionStarting( AssertionInfo const& ) override {} + void noMatchingTestCases( StringRef unmatchedSpec ) override; - bool assertionEnded(AssertionStats const& _assertionStats) override; + void assertionEnded(AssertionStats const& _assertionStats) override; void testRunEnded(TestRunStats const& _testRunStats) override; @@ -10867,9 +12124,10 @@ namespace Catch { namespace Catch { - struct TeamCityReporter : StreamingReporterBase { - TeamCityReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ) + class TeamCityReporter final : public StreamingReporterBase { + public: + TeamCityReporter( ReporterConfig&& _config ) + : StreamingReporterBase( CATCH_MOVE(_config) ) { m_preferences.shouldRedirectStdOut = true; } @@ -10881,17 +12139,11 @@ namespace Catch { 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 testRunStarting( TestRunInfo const& groupInfo ) override; + void testRunEnded( TestRunStats const& testGroupStats ) override; - void assertionStarting(AssertionInfo const&) override {} - bool assertionEnded(AssertionStats const& assertionStats) override; + void assertionEnded(AssertionStats const& assertionStats) override; void sectionStarting(SectionInfo const& sectionInfo) override { m_headerPrintedForThisSection = false; @@ -10905,7 +12157,6 @@ namespace Catch { private: void printSectionHeader(std::ostream& os); - private: bool m_headerPrintedForThisSection = false; Timer m_testTimer; }; @@ -10928,7 +12179,7 @@ namespace Catch { namespace Catch { class XmlReporter : public StreamingReporterBase { public: - XmlReporter(ReporterConfig const& _config); + XmlReporter(ReporterConfig&& _config); ~XmlReporter() override; @@ -10940,36 +12191,31 @@ namespace Catch { 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 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 benchmarkPreparing( StringRef name ) override; void benchmarkStarting(BenchmarkInfo const&) override; void benchmarkEnded(BenchmarkStats<> const&) override; - void benchmarkFailed(std::string const&) override; + void benchmarkFailed( StringRef error ) 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; + void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listListeners(std::vector<ListenerDescription> const& descriptions) override; + void listTests(std::vector<TestCaseHandle> const& tests) override; + void listTags(std::vector<TagInfo> const& tags) override; private: Timer m_testCaseTimer; diff --git a/packages/Catch2/src/CMakeLists.txt b/packages/Catch2/src/CMakeLists.txt index 7e30c1a479805e6ebd0820ae8426029ffb4a0f7c..c76a96d528c1a48a5049474e17c3fe715ae1d2fc 100644 --- a/packages/Catch2/src/CMakeLists.txt +++ b/packages/Catch2/src/CMakeLists.txt @@ -1,4 +1,11 @@ -include(MiscFunctions) +include(CatchMiscFunctions) + +# CMake derives a Visual Studio project GUID from the file path but can be overridden via a property +# (see https://gitlab.kitware.com/cmake/cmake/-/commit/c85367f4). Using a non-constant GUID +# can cause problems if other projects/repos want to reference the vcxproj file, +# so we force a constant GUID here. +set(Catch2_GUID_CMAKE "8d538cbe-01bf-4a2e-a98a-6c368fdf13d7" CACHE INTERNAL "Project GUID") +set(Catch2WithMain_GUID_CMAKE "8bd3552a-2cfb-4a59-ab15-2031b97ada1e" CACHE INTERNAL "Project GUID") # Please keep these ordered alphabetically set(BENCHMARK_HEADERS @@ -24,18 +31,23 @@ set(BENCHMARK_HEADERS ${SOURCES_DIR}/benchmark/detail/catch_timing.hpp ) set(BENCHMARK_SOURCES - ${SOURCES_DIR}/benchmark/internal/catch_benchmark_combined_tu.cpp + ${SOURCES_DIR}/benchmark/catch_chronometer.cpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.cpp + ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.cpp ${SOURCES_DIR}/benchmark/detail/catch_stats.cpp ) SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) set(INTERNAL_HEADERS + "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + "${SOURCES_DIR}/catch_user_config.hpp.in" ${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_case_insensitive_comparisons.hpp ${SOURCES_DIR}/internal/catch_console_width.hpp ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp ${SOURCES_DIR}/internal/catch_noncopyable.hpp @@ -66,7 +78,9 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp ${SOURCES_DIR}/internal/catch_floating_point_helpers.hpp + ${SOURCES_DIR}/internal/catch_istream.hpp ${SOURCES_DIR}/internal/catch_unique_name.hpp + ${SOURCES_DIR}/internal/catch_sharding.hpp ${SOURCES_DIR}/generators/catch_generator_exception.hpp ${SOURCES_DIR}/generators/catch_generators.hpp ${SOURCES_DIR}/generators/catch_generators_adapters.hpp @@ -100,26 +114,30 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/internal/catch_message_info.hpp ${SOURCES_DIR}/internal/catch_meta.hpp ${SOURCES_DIR}/internal/catch_move_and_forward.hpp - ${SOURCES_DIR}/internal/catch_option.hpp + ${SOURCES_DIR}/internal/catch_optional.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_preprocessor_remove_parens.hpp ${SOURCES_DIR}/internal/catch_random_number_generator.hpp - ${SOURCES_DIR}/catch_reporter_registrars.hpp + ${SOURCES_DIR}/internal/catch_random_seed_generation.hpp ${SOURCES_DIR}/internal/catch_reporter_registry.hpp + ${SOURCES_DIR}/internal/catch_reporter_spec_parser.hpp ${SOURCES_DIR}/internal/catch_result_type.hpp ${SOURCES_DIR}/internal/catch_run_context.hpp ${SOURCES_DIR}/internal/catch_section.hpp + ${SOURCES_DIR}/internal/catch_stdstreams.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_reusable_string_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_get_random_seed.hpp ${SOURCES_DIR}/catch_tag_alias_autoregistrar.hpp ${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp ${SOURCES_DIR}/catch_test_case_info.hpp @@ -139,21 +157,23 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/catch_translate_exception.hpp ${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp ${SOURCES_DIR}/internal/catch_unique_ptr.hpp + ${SOURCES_DIR}/internal/catch_void_type.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 + ${SOURCES_DIR}/internal/catch_test_case_info_hasher.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_case_insensitive_comparisons.cpp ${SOURCES_DIR}/internal/catch_console_colour.cpp ${SOURCES_DIR}/internal/catch_context.cpp ${SOURCES_DIR}/internal/catch_debug_console.cpp @@ -163,25 +183,28 @@ set(IMPL_SOURCES ${SOURCES_DIR}/internal/catch_exception_translator_registry.cpp ${SOURCES_DIR}/internal/catch_fatal_condition_handler.cpp ${SOURCES_DIR}/internal/catch_floating_point_helpers.cpp - ${SOURCES_DIR}/generators/internal/catch_generators_combined_tu.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_combined_tu.cpp + ${SOURCES_DIR}/internal/catch_istream.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.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_quantifiers.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_random_seed_generation.cpp ${SOURCES_DIR}/internal/catch_reporter_registry.cpp + ${SOURCES_DIR}/internal/catch_reporter_spec_parser.cpp ${SOURCES_DIR}/internal/catch_result_type.cpp ${SOURCES_DIR}/internal/catch_run_context.cpp ${SOURCES_DIR}/internal/catch_section.cpp + ${SOURCES_DIR}/internal/catch_stdstreams.cpp ${SOURCES_DIR}/catch_session.cpp ${SOURCES_DIR}/internal/catch_singletons.cpp - ${SOURCES_DIR}/internal/catch_stream.cpp + ${SOURCES_DIR}/internal/catch_reusable_string_stream.cpp ${SOURCES_DIR}/internal/catch_stringref.cpp ${SOURCES_DIR}/internal/catch_string_manip.cpp ${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp @@ -198,6 +221,32 @@ set(IMPL_SOURCES ${SOURCES_DIR}/catch_version.cpp ${SOURCES_DIR}/internal/catch_wildcard_pattern.cpp ${SOURCES_DIR}/internal/catch_xmlwriter.cpp + ${SOURCES_DIR}/internal/catch_test_case_info_hasher.cpp + ${SOURCES_DIR}/generators/catch_generators_random.cpp + ${SOURCES_DIR}/generators/catch_generator_exception.cpp + ${SOURCES_DIR}/generators/catch_generators.cpp + ${SOURCES_DIR}/matchers/catch_matchers.cpp + ${SOURCES_DIR}/matchers/catch_matchers_container_properties.cpp + ${SOURCES_DIR}/matchers/catch_matchers_exception.cpp + ${SOURCES_DIR}/matchers/catch_matchers_predicate.cpp + ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.cpp + ${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp + ${SOURCES_DIR}/catch_get_random_seed.cpp + ${SOURCES_DIR}/internal/catch_decomposer.cpp + ${SOURCES_DIR}/internal/catch_errno_guard.cpp + ${SOURCES_DIR}/internal/catch_lazy_expr.cpp + ${SOURCES_DIR}/internal/catch_leak_detector.cpp + ${SOURCES_DIR}/internal/catch_message_info.cpp + ${SOURCES_DIR}/internal/catch_polyfills.cpp + ${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp + ${SOURCES_DIR}/internal/catch_uncaught_exceptions.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_capture.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_config.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_exception.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_registry.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.cpp ) set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) @@ -205,13 +254,15 @@ set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) set(REPORTER_HEADERS ${SOURCES_DIR}/reporters/catch_reporters_all.hpp ${SOURCES_DIR}/reporters/catch_reporter_automake.hpp + ${SOURCES_DIR}/reporters/catch_reporter_common_base.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_multi.hpp + ${SOURCES_DIR}/reporters/catch_reporter_registrars.hpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp @@ -220,12 +271,15 @@ set(REPORTER_HEADERS ) set(REPORTER_SOURCES ${SOURCES_DIR}/reporters/catch_reporter_automake.cpp - ${SOURCES_DIR}/reporters/catch_reporter_combined_tu.cpp + ${SOURCES_DIR}/reporters/catch_reporter_common_base.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_event_listener.cpp + ${SOURCES_DIR}/reporters/catch_reporter_helpers.cpp ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp - ${SOURCES_DIR}/reporters/catch_reporter_listening.cpp + ${SOURCES_DIR}/reporters/catch_reporter_multi.cpp + ${SOURCES_DIR}/reporters/catch_reporter_registrars.cpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp @@ -234,9 +288,7 @@ set(REPORTER_SOURCES ) 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 +add_library(Catch2 ${REPORTER_FILES} ${INTERNAL_FILES} ${BENCHMARK_HEADERS} @@ -276,14 +328,20 @@ target_compile_features(Catch2 cxx_variadic_macros ) +configure_file( + "${SOURCES_DIR}/catch_user_config.hpp.in" + "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" +) + target_include_directories(Catch2 PUBLIC $<BUILD_INTERFACE:${SOURCES_DIR}/..> + $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated-includes> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) -add_library(Catch2WithMain STATIC +add_library(Catch2WithMain ${SOURCES_DIR}/internal/catch_main.cpp ) add_build_reproducibility_settings(Catch2WithMain) @@ -303,8 +361,12 @@ if (NOT_SUBPROJECT) Catch2WithMain EXPORT Catch2Targets - DESTINATION + LIBRARY DESTINATION + ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION + ${CMAKE_INSTALL_BINDIR} ) @@ -317,7 +379,15 @@ if (NOT_SUBPROJECT) ${CATCH_CMAKE_CONFIG_DESTINATION} ) # Install the headers - install(DIRECTORY ${SOURCES_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*") + install( + DIRECTORY + "${SOURCES_DIR}" + "${CMAKE_BINARY_DIR}/generated-includes/catch2" # Also install the generated header + DESTINATION + "${CMAKE_INSTALL_INCLUDEDIR}" + FILES_MATCHING + PATTERN "*.hpp" + ) endif() # Some tests require a full recompilation of Catch2 lib with different @@ -336,6 +406,7 @@ if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) target_include_directories(Catch2_buildall_interface INTERFACE $<BUILD_INTERFACE:${SOURCES_DIR}/..> + $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated-includes> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) target_compile_features(Catch2_buildall_interface @@ -365,3 +436,27 @@ endif() list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain) set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) + + +# We still do not support building dynamic library with hidden visibility +# so we want to check & warn users if they do this. However, we won't abort +# the configuration step so that we don't have to also provide an override. +if (BUILD_SHARED_LIBS) + if (MSVC) + set_target_properties(Catch2 Catch2WithMain + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) + endif() + + get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET) + if (NOT MSVC AND _VisPreset STREQUAL "hidden") + set_target_properties(Catch2 Catch2WithMain + PROPERTIES + CXX_VISIBILITY_PRESET "default" + VISIBILITY_INLINES_HIDDEN OFF + ) + message(WARNING "Setting Catch2's visibility to default." + " Hidden visibility is not supported.") + endif() +endif() diff --git a/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp index 28664b613e2484bd62bd9b96b1ac3e001b3256be..66e3670f602aef04e237fcc0e4aa02eedf30107e 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp @@ -95,8 +95,11 @@ namespace Catch { // sets lambda to be used in fun *and* executes benchmark! template <typename Fun, std::enable_if_t<!Detail::is_related<Fun, Benchmark>::value, int> = 0> Benchmark & operator=(Fun func) { - fun = Detail::BenchmarkFunction(func); - run(); + auto const* cfg = getCurrentContext().getConfig(); + if (!cfg->skipBenchmarks()) { + fun = Detail::BenchmarkFunction(func); + run(); + } return *this; } diff --git a/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp b/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..459a26c7e4fe2b8be52ce0bf6211a9d568448748 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp @@ -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 + +#include <catch2/benchmark/catch_chronometer.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + ChronometerConcept::~ChronometerConcept() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch diff --git a/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp index 9da1eaaf8c015b53a6e096eef4e992927934bfa6..86bbfb00de21dd5f38824533be962a77cf724aad 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp @@ -20,9 +20,7 @@ namespace Catch { template <typename T, bool Destruct> struct ObjectStorage { - using TStorage = std::aligned_storage_t<sizeof(T), std::alignment_of<T>::value>; - - ObjectStorage() : data() {} + ObjectStorage() = default; ObjectStorage(const ObjectStorage& other) { @@ -31,7 +29,7 @@ namespace Catch { ObjectStorage(ObjectStorage&& other) { - new(&data) T(CATCH_MOVE(other.stored_object())); + new(data) T(CATCH_MOVE(other.stored_object())); } ~ObjectStorage() { destruct_on_exit<T>(); } @@ -39,7 +37,7 @@ namespace Catch { template <typename... Args> void construct(Args&&... args) { - new (&data) T(CATCH_FORWARD(args)...); + new (data) T(CATCH_FORWARD(args)...); } template <bool AllowManualDestruction = !Destruct> @@ -51,21 +49,21 @@ namespace Catch { private: // If this is a constructor benchmark, destruct the underlying object template <typename U> - void destruct_on_exit(std::enable_if_t<Destruct, U>* = 0) { destruct<true>(); } + void destruct_on_exit(std::enable_if_t<Destruct, U>* = nullptr) { destruct<true>(); } // Otherwise, don't template <typename U> - void destruct_on_exit(std::enable_if_t<!Destruct, U>* = 0) { } + void destruct_on_exit(std::enable_if_t<!Destruct, U>* = nullptr) { } T& stored_object() { - return *static_cast<T*>(static_cast<void*>(&data)); + return *static_cast<T*>(static_cast<void*>(data)); } T const& stored_object() const { - return *static_cast<T*>(static_cast<void*>(&data)); + return *static_cast<T const*>(static_cast<void const*>(data)); } - TStorage data; + alignas( T ) unsigned char data[sizeof( T )]{}; }; } // namespace Detail diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp index cf96a3d28b9628d755b361a92df15469720c6d53..6652f5f4d85fdbeb36bebaa3fc8e92584642a14a 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp @@ -28,7 +28,7 @@ namespace Catch { SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) { if (!cfg.benchmarkNoAnalysis()) { std::vector<double> samples; - samples.reserve(last - first); + samples.reserve(static_cast<size_t>(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()); @@ -54,7 +54,7 @@ namespace Catch { }; } else { std::vector<Duration> samples; - samples.reserve(last - first); + samples.reserve(static_cast<size_t>(last - first)); Duration mean = Duration(0); int i = 0; diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9562d29e7c9bf1509c045c841ae7be98399bb8e0 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp @@ -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 + +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + BenchmarkFunction::callable::~callable() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp index 3bba791e4091de6a6f999d76323d8235e9e35ad5..c392ca4f7e9ea00bbe04cda50f9ff9edb29dcfe0 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp @@ -29,11 +29,11 @@ namespace Catch { template <typename Clock> std::vector<double> resolution(int k) { std::vector<TimePoint<Clock>> times; - times.reserve(k + 1); + times.reserve(static_cast<size_t>(k + 1)); std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); std::vector<double> deltas; - deltas.reserve(k); + deltas.reserve(static_cast<size_t>(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()); }); @@ -83,7 +83,7 @@ namespace Catch { 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); + times.reserve(static_cast<size_t>(nsamples)); std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); }); diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c246d6a5c537b4110d188fefa158991246b3ee9 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp @@ -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 + +#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/benchmark/detail/catch_stats.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp index 45190da86e15194545a111926fea5a570174d567..023508064ab5d09f64c9076fb1aea5dd919836f2 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp @@ -12,6 +12,7 @@ #include <catch2/internal/catch_compiler_capabilities.hpp> #include <cassert> +#include <cstddef> #include <iterator> #include <random> @@ -25,8 +26,8 @@ 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; + sample resample(URng& rng, unsigned int resamples, std::vector<double>::iterator first, std::vector<double>::iterator last, Estimator& estimator) { + auto n = static_cast<size_t>(last - first); std::uniform_int_distribution<decltype(n)> dist(0, n - 1); sample out; @@ -34,7 +35,7 @@ using Catch::Benchmark::Detail::sample; 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)]; }); + std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[static_cast<std::ptrdiff_t>(dist(rng))]; }); return estimator(resampled.begin(), resampled.end()); }); std::sort(out.begin(), out.end()); @@ -119,11 +120,15 @@ using Catch::Benchmark::Detail::sample; 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); + 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 ); } } @@ -132,6 +137,15 @@ namespace Catch { namespace Benchmark { namespace Detail { +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + bool directCompare( double lhs, double rhs ) { return lhs == rhs; } +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif + 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); @@ -139,7 +153,9 @@ namespace Catch { double g = idx - j; std::nth_element(first, first + j, last); auto xj = first[j]; - if (g == 0) return xj; + if ( directCompare( g, 0 ) ) { + return xj; + } auto xj1 = *std::min_element(first + (j + 1), last); return xj + g * (xj1 - xj); @@ -194,7 +210,7 @@ namespace Catch { } - bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + bootstrap_analysis analyse_samples(double confidence_level, unsigned 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; diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp index 8985670f0892a9eb7c5558b4dc24d30cb5d988b9..bfeace2c127d8ea220b74aca13eeebc5f80d50e7 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp @@ -24,6 +24,10 @@ namespace Catch { namespace Detail { using sample = std::vector<double>; + // Used when we know we want == comparison of two doubles + // to centralize warning suppression + bool directCompare( double lhs, double rhs ); + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); template <typename Iterator> @@ -54,12 +58,12 @@ namespace Catch { double mean(Iterator first, Iterator last) { auto count = last - first; double sum = std::accumulate(first, last, 0.); - return sum / count; + return sum / static_cast<double>(count); } template <typename Estimator, typename Iterator> sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { - auto n = last - first; + auto n = static_cast<size_t>(last - first); auto second = first; ++second; sample results; @@ -100,23 +104,26 @@ namespace Catch { }); double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5)); - int n = static_cast<int>(resample.size()); + long n = static_cast<long>(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 }; + if ( directCompare( 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 cumn = [n]( double x ) -> long { + return std::lround( normal_cdf( x ) * static_cast<double>(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); + auto lo = static_cast<size_t>((std::max)(cumn(a1), 0l)); + auto hi = static_cast<size_t>((std::min)(cumn(a2), n - 1)); return { point, resample[lo], resample[hi], confidence_level }; } @@ -129,7 +136,7 @@ namespace Catch { double outlier_variance; }; - bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + bootstrap_analysis analyse_samples(double confidence_level, unsigned int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); } // namespace Detail } // namespace Benchmark } // namespace Catch 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 deleted file mode 100644 index ffbae6962821927d6813e8ac6e4d57498da13942..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/benchmark/internal/catch_benchmark_combined_tu.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// 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_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 index 35bd9741ac947f63bc0ff5e4cd616bc69a37deb2..94f552237afb5245c4588925d57d18bb20cdd024 100644 --- a/packages/Catch2/src/catch2/catch_all.hpp +++ b/packages/Catch2/src/catch2/catch_all.hpp @@ -27,8 +27,8 @@ #include <catch2/catch_assertion_info.hpp> #include <catch2/catch_assertion_result.hpp> #include <catch2/catch_config.hpp> +#include <catch2/catch_get_random_seed.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> @@ -46,6 +46,7 @@ #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_insensitive_comparisons.hpp> #include <catch2/internal/catch_case_sensitive.hpp> #include <catch2/internal/catch_clara.hpp> #include <catch2/internal/catch_commandline.hpp> @@ -67,6 +68,7 @@ #include <catch2/internal/catch_exception_translator_registry.hpp> #include <catch2/internal/catch_fatal_condition_handler.hpp> #include <catch2/internal/catch_floating_point_helpers.hpp> +#include <catch2/internal/catch_istream.hpp> #include <catch2/internal/catch_lazy_expr.hpp> #include <catch2/internal/catch_leak_detector.hpp> #include <catch2/internal/catch_list.hpp> @@ -74,25 +76,31 @@ #include <catch2/internal/catch_meta.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_noncopyable.hpp> -#include <catch2/internal/catch_option.hpp> +#include <catch2/internal/catch_optional.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_preprocessor_remove_parens.hpp> #include <catch2/internal/catch_random_number_generator.hpp> +#include <catch2/internal/catch_random_seed_generation.hpp> #include <catch2/internal/catch_reporter_registry.hpp> +#include <catch2/internal/catch_reporter_spec_parser.hpp> #include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/internal/catch_run_context.hpp> #include <catch2/internal/catch_section.hpp> +#include <catch2/internal/catch_sharding.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_stdstreams.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_info_hasher.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> @@ -104,6 +112,7 @@ #include <catch2/internal/catch_uncaught_exceptions.hpp> #include <catch2/internal/catch_unique_name.hpp> #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_void_type.hpp> #include <catch2/internal/catch_wildcard_pattern.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp> #include <catch2/internal/catch_xmlwriter.hpp> diff --git a/packages/Catch2/src/catch2/catch_approx.cpp b/packages/Catch2/src/catch2/catch_approx.cpp index 3dfebf46601426fb41f602c6e9dfc7e7deb4598b..b477d6ed985afa4064583d497ed3a550f3f8c555 100644 --- a/packages/Catch2/src/catch2/catch_approx.cpp +++ b/packages/Catch2/src/catch2/catch_approx.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_approx.hpp> #include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <cmath> #include <limits> @@ -24,7 +25,7 @@ bool marginComparison(double lhs, double rhs, double margin) { namespace Catch { Approx::Approx ( double value ) - : m_epsilon( std::numeric_limits<float>::epsilon()*100 ), + : m_epsilon( std::numeric_limits<float>::epsilon()*100. ), m_margin( 0.0 ), m_scale( 0.0 ), m_value( value ) diff --git a/packages/Catch2/src/catch2/catch_approx.hpp b/packages/Catch2/src/catch2/catch_approx.hpp index 7c3a17c031d88e8ee90adc99d77b52b01c47a4dd..a46caeb53b49083cd2998498e6ec7d9d54d76cbb 100644 --- a/packages/Catch2/src/catch2/catch_approx.hpp +++ b/packages/Catch2/src/catch2/catch_approx.hpp @@ -86,14 +86,14 @@ namespace Catch { 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); + const auto 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); + const auto marginAsDouble = static_cast<double>(newMargin); setMargin(marginAsDouble); return *this; } diff --git a/packages/Catch2/src/catch2/catch_assertion_result.cpp b/packages/Catch2/src/catch2/catch_assertion_result.cpp index 04e00d265c7c00a5db6dd580c7318ba315623534..2912c8d305e043aa8f6eae6cc7035a5316cebba3 100644 --- a/packages/Catch2/src/catch2/catch_assertion_result.cpp +++ b/packages/Catch2/src/catch2/catch_assertion_result.cpp @@ -6,7 +6,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_assertion_result.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> namespace Catch { diff --git a/packages/Catch2/src/catch2/catch_config.cpp b/packages/Catch2/src/catch2/catch_config.cpp index 92fcff2063cd040e6cdca0198b7bebe122573cb7..4cb3627db542a2da243b7deb7673a702be3c76ae 100644 --- a/packages/Catch2/src/catch2/catch_config.cpp +++ b/packages/Catch2/src/catch2/catch_config.cpp @@ -6,20 +6,51 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_config.hpp> +#include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_enforce.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_platform.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 { + bool provideBazelReporterOutput() { +#if defined(CATCH_CONFIG_BAZEL_SUPPORT) + return true; +#elif defined(CATCH_PLATFORM_WINDOWS_UWP) + // UWP does not support environment variables + return false; +#else + +# if defined( _MSC_VER ) + // On Windows getenv throws a warning as there is no input validation, + // since the switch is hardcoded, this should not be an issue. +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + + return std::getenv( "BAZEL_TEST" ) != nullptr; + +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif +#endif + } +} namespace Catch { - Config::Config( ConfigData const& data ) - : m_data( data ), - m_stream( Catch::makeStream(m_data.outputFilename) ) - { + bool operator==( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ) { + return lhs.name == rhs.name && + lhs.outputFilename == rhs.outputFilename && + lhs.colourMode == rhs.colourMode && + lhs.customOptions == rhs.customOptions; + } + + Config::Config( ConfigData const& data ): + m_data( data ) { // We need to trim filter specs to avoid trouble with superfluous // whitespace (esp. important for bdd macros, as those are manually // aligned with whitespace). @@ -31,6 +62,7 @@ namespace Catch { elem = trim(elem); } + TestSpecParser parser(ITagAliasRegistry::get()); if (!m_data.testsOrTags.empty()) { m_hasTestFilters = true; @@ -39,24 +71,87 @@ namespace Catch { } } m_testSpec = parser.testSpec(); - } - Config::~Config() = default; + // Insert the default reporter if user hasn't asked for a specfic one + if ( m_data.reporterSpecifications.empty() ) { + m_data.reporterSpecifications.push_back( { +#if defined( CATCH_CONFIG_DEFAULT_REPORTER ) + CATCH_CONFIG_DEFAULT_REPORTER, +#else + "console", +#endif + {}, {}, {} + } ); + } + +#if !defined(CATCH_PLATFORM_WINDOWS_UWP) + if(provideBazelReporterOutput()){ + // Register a JUnit reporter for Bazel. Bazel sets an environment + // variable with the path to XML output. If this file is written to + // during test, Bazel will not generate a default XML output. + // This allows the XML output file to contain higher level of detail + // than what is possible otherwise. +# if defined( _MSC_VER ) + // On Windows getenv throws a warning as there is no input validation, + // since the key is hardcoded, this should not be an issue. +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" ); +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif + if ( bazelOutputFilePtr != nullptr ) { + m_data.reporterSpecifications.push_back( + { "junit", std::string( bazelOutputFilePtr ), {}, {} } ); + } + } +#endif + + // We now fixup the reporter specs to handle default output spec, + // default colour spec, etc + bool defaultOutputUsed = false; + for ( auto const& reporterSpec : m_data.reporterSpecifications ) { + // We do the default-output check separately, while always + // using the default output below to make the code simpler + // and avoid superfluous copies. + if ( reporterSpec.outputFile().none() ) { + CATCH_ENFORCE( !defaultOutputUsed, + "Internal error: cannot use default output for " + "multiple reporters" ); + defaultOutputUsed = true; + } - std::string const& Config::getFilename() const { - return m_data.outputFilename ; + m_processedReporterSpecs.push_back( ProcessedReporterSpec{ + reporterSpec.name(), + reporterSpec.outputFile() ? *reporterSpec.outputFile() + : data.defaultOutputFilename, + reporterSpec.colourMode().valueOr( data.defaultColourMode ), + reporterSpec.customOptions() } ); + } } + Config::~Config() = default; + + 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 const& Config::getReporterName() const { return m_data.reporterName; } + bool Config::listListeners() const { return m_data.listListeners; } std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + std::vector<ReporterSpec> const& Config::getReporterSpecs() const { + return m_data.reporterSpecifications; + } + + std::vector<ProcessedReporterSpec> const& + Config::getProcessedReporterSpecs() const { + return m_processedReporterSpecs; + } + TestSpec const& Config::testSpec() const { return m_testSpec; } bool Config::hasTestFilters() const { return m_hasTestFilters; } @@ -64,23 +159,30 @@ namespace Catch { // IConfig interface bool Config::allowThrows() const { return !m_data.noThrow; } - std::ostream& Config::stream() const { return m_stream->stream(); } - StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + StringRef 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); } + bool Config::warnAboutMissingAssertions() const { + return !!( m_data.warnings & WarnAbout::NoAssertions ); + } + bool Config::warnAboutUnmatchedTestSpecs() const { + return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec ); + } + bool Config::zeroTestsCountAsSuccess() const { return m_data.allowZeroTests; } 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; } + uint32_t Config::rngSeed() const { return m_data.rngSeed; } + unsigned int Config::shardCount() const { return m_data.shardCount; } + unsigned int Config::shardIndex() const { return m_data.shardIndex; } + ColourMode Config::defaultColourMode() const { return m_data.defaultColourMode; } 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::skipBenchmarks() const { return m_data.skipBenchmarks; } bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } - int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + unsigned 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); } diff --git a/packages/Catch2/src/catch2/catch_config.hpp b/packages/Catch2/src/catch2/catch_config.hpp index 7daf61c713071d59aebba6b5444e642268cfc244..10df4d64ad5c313f106860205285b604e89d0aa0 100644 --- a/packages/Catch2/src/catch2/catch_config.hpp +++ b/packages/Catch2/src/catch2/catch_config.hpp @@ -11,18 +11,44 @@ #include <catch2/catch_test_spec.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_optional.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_random_seed_generation.hpp> +#include <catch2/internal/catch_reporter_spec_parser.hpp> -#include <vector> +#include <chrono> +#include <map> #include <string> +#include <vector> namespace Catch { - struct IStream; + class IStream; + + /** + * `ReporterSpec` but with the defaults filled in. + * + * Like `ReporterSpec`, the semantics are unchecked. + */ + struct ProcessedReporterSpec { + std::string name; + std::string outputFilename; + ColourMode colourMode; + std::map<std::string, std::string> customOptions; + friend bool operator==( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ); + friend bool operator!=( ProcessedReporterSpec const& lhs, + ProcessedReporterSpec const& rhs ) { + return !( lhs == rhs ); + } + }; struct ConfigData { + bool listTests = false; bool listTags = false; bool listReporters = false; + bool listListeners = false; bool showSuccessfulTests = false; bool shouldDebugBreak = false; @@ -31,10 +57,15 @@ namespace Catch { bool showInvisibles = false; bool filenamesAsTags = false; bool libIdentify = false; + bool allowZeroTests = false; int abortAfter = -1; - unsigned int rngSeed = 0; + uint32_t rngSeed = generateRandomSeed(GenerateFrom::Default); + + unsigned int shardCount = 1; + unsigned int shardIndex = 0; + bool skipBenchmarks = false; bool benchmarkNoAnalysis = false; unsigned int benchmarkSamples = 100; double benchmarkConfidenceInterval = 0.95; @@ -46,17 +77,13 @@ namespace Catch { ShowDurations showDurations = ShowDurations::DefaultForReporter; double minDuration = -1; TestRunOrder runOrder = TestRunOrder::Declared; - UseColour useColour = UseColour::Auto; + ColourMode defaultColourMode = ColourMode::PlatformDefault; WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; - std::string outputFilename; + std::string defaultOutputFilename; 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<ReporterSpec> reporterSpecifications; std::vector<std::string> testsOrTags; std::vector<std::string> sectionsToRun; @@ -70,13 +97,14 @@ namespace Catch { 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; + bool listListeners() const; - std::string const& getReporterName() const; + std::vector<ReporterSpec> const& getReporterSpecs() const; + std::vector<ProcessedReporterSpec> const& + getProcessedReporterSpecs() const; std::vector<std::string> const& getTestsOrTags() const override; std::vector<std::string> const& getSectionsToRun() const override; @@ -88,34 +116,35 @@ namespace Catch { // IConfig interface bool allowThrows() const override; - std::ostream& stream() const override; StringRef name() const override; bool includeSuccessfulResults() const override; bool warnAboutMissingAssertions() const override; - bool warnAboutNoTests() const override; + bool warnAboutUnmatchedTestSpecs() const override; + bool zeroTestsCountAsSuccess() const override; ShowDurations showDurations() const override; double minDuration() const override; TestRunOrder runOrder() const override; - unsigned int rngSeed() const override; - UseColour useColour() const override; + uint32_t rngSeed() const override; + unsigned int shardCount() const override; + unsigned int shardIndex() const override; + ColourMode defaultColourMode() const override; bool shouldDebugBreak() const override; int abortAfter() const override; bool showInvisibles() const override; Verbosity verbosity() const override; + bool skipBenchmarks() const override; bool benchmarkNoAnalysis() const override; - int benchmarkSamples() const override; + unsigned int benchmarkSamples() const override; double benchmarkConfidenceInterval() const override; unsigned int benchmarkResamples() const override; std::chrono::milliseconds benchmarkWarmupTime() const override; private: ConfigData m_data; - - Detail::unique_ptr<IStream const> m_stream; + std::vector<ProcessedReporterSpec> m_processedReporterSpecs; TestSpec m_testSpec; bool m_hasTestFilters = false; }; - } // end namespace Catch #endif // CATCH_CONFIG_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_get_random_seed.cpp b/packages/Catch2/src/catch2/catch_get_random_seed.cpp new file mode 100644 index 0000000000000000000000000000000000000000..12a5b6d8c20cfe884a673933c9797217de76ac78 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_get_random_seed.cpp @@ -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 + +#include <catch2/catch_get_random_seed.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/catch_config.hpp> + +namespace Catch { + std::uint32_t getSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } +} diff --git a/packages/Catch2/src/catch2/catch_get_random_seed.hpp b/packages/Catch2/src/catch2/catch_get_random_seed.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6df3c3a006b578a2fd8fa3be33467554144b17ce --- /dev/null +++ b/packages/Catch2/src/catch2/catch_get_random_seed.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_GET_RANDOM_SEED_HPP_INCLUDED +#define CATCH_GET_RANDOM_SEED_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + //! Returns Catch2's current RNG seed. + std::uint32_t getSeed(); +} + +#endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_message.hpp b/packages/Catch2/src/catch2/catch_message.hpp index 970ba438a4c73c47603227cbddbead9cb594a355..dac7a21d08cf6496fe7f9d4c147328eb1157608f 100644 --- a/packages/Catch2/src/catch2/catch_message.hpp +++ b/packages/Catch2/src/catch2/catch_message.hpp @@ -9,7 +9,7 @@ #define CATCH_MESSAGE_HPP_INCLUDED #include <catch2/internal/catch_result_type.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/internal/catch_stream_end_stop.hpp> #include <catch2/internal/catch_message_info.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> diff --git a/packages/Catch2/src/catch2/catch_registry_hub.cpp b/packages/Catch2/src/catch2/catch_registry_hub.cpp index edf9b2b52ec65d5ade457f330f560350ea131d37..1fca78fb7fa16729353ce34315f6e932f347506e 100644 --- a/packages/Catch2/src/catch2/catch_registry_hub.cpp +++ b/packages/Catch2/src/catch2/catch_registry_hub.cpp @@ -51,7 +51,7 @@ namespace Catch { void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override { m_reporterRegistry.registerReporter( name, CATCH_MOVE(factory) ); } - void registerListener( IReporterFactoryPtr factory ) override { + void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) override { m_reporterRegistry.registerListener( CATCH_MOVE(factory) ); } void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override { diff --git a/packages/Catch2/src/catch2/catch_reporter_registrars.hpp b/packages/Catch2/src/catch2/catch_reporter_registrars.hpp deleted file mode 100644 index 978d2925e24e34004281b2905286ab532b570a18..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/catch_reporter_registrars.hpp +++ /dev/null @@ -1,83 +0,0 @@ - -// 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.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> -#include <catch2/internal/catch_unique_ptr.hpp> - -namespace Catch { - - struct IStreamingReporter; - using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; - - 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_session.cpp b/packages/Catch2/src/catch2/catch_session.cpp index 9738cbb4f994c910031dc99a47f9ec53c6fd1a1e..df92559b58392c617c974114f8335b0008ae0bad 100644 --- a/packages/Catch2/src/catch2/catch_session.cpp +++ b/packages/Catch2/src/catch2/catch_session.cpp @@ -11,19 +11,22 @@ #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_sharding.hpp> #include <catch2/internal/catch_textflow.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp> -#include <catch2/reporters/catch_reporter_listening.hpp> +#include <catch2/reporters/catch_reporter_multi.hpp> #include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_stdstreams.hpp> +#include <catch2/internal/catch_istream.hpp> #include <algorithm> +#include <cassert> #include <iomanip> #include <set> @@ -32,50 +35,77 @@ 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 << "'"); + IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig&& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, CATCH_MOVE(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); + IEventListenerPtr prepareReporters(Config const* config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty() + && config->getProcessedReporterSpecs().size() == 1) { + auto const& spec = config->getProcessedReporterSpecs()[0]; + return createReporter( + spec.name, + ReporterConfig( config, + makeStream( spec.outputFilename ), + spec.colourMode, + spec.customOptions ) ); } - auto multi = Detail::make_unique<ListeningReporter>(config); + auto multi = Detail::make_unique<MultiReporter>(config); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); for (auto const& listener : listeners) { - multi->addListener(listener->create(Catch::ReporterConfig(config))); + multi->addListener(listener->create(config)); + } + + std::size_t reporterIdx = 0; + for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) { + multi->addReporter( createReporter( + reporterSpec.name, + ReporterConfig( config, + makeStream( reporterSpec.outputFilename ), + reporterSpec.colourMode, + reporterSpec.customOptions ) ) ); + reporterIdx++; } - multi->addReporter(createReporter(config->getReporterName(), config)); + return multi; } class TestGroup { public: - explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): + explicit TestGroup(IEventListenerPtr&& reporter, Config const* config): m_reporter(reporter.get()), m_config{config}, m_context{config, CATCH_MOVE(reporter)} { - auto const& allTestCases = getAllTestCasesSorted(*m_config); - m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); - auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + assert( m_config->testSpec().getInvalidSpecs().empty() && + "Invalid test specs should be handled before running tests" ); - if (m_matches.empty() && invalidArgs.empty()) { - for (auto const& test : allTestCases) - if (!test.getTestCaseInfo().isHidden()) - m_tests.emplace(&test); + auto const& allTestCases = getAllTestCasesSorted(*m_config); + auto const& testSpec = m_config->testSpec(); + if ( !testSpec.hasFilters() ) { + 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()); + m_matches = + testSpec.matchesByFilter( allTestCases, *m_config ); + for ( auto const& match : m_matches ) { + m_tests.insert( match.tests.begin(), + match.tests.end() ); + } } + + m_tests = createShard(m_tests, m_config->shardCount(), m_config->shardIndex()); } Totals execute() { - auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); Totals totals; for (auto const& testCase : m_tests) { if (!m_context.aborting()) @@ -86,27 +116,26 @@ namespace Catch { for (auto const& match : m_matches) { if (match.tests.empty()) { - m_reporter->noMatchingTestCases(match.name); - totals.error = -1; + m_unmatchedTestSpecs = true; + m_reporter->noMatchingTestCases( match.name ); } } - if (!invalidArgs.empty()) { - for (auto const& invalidArg: invalidArgs) - m_reporter->reportInvalidArguments(invalidArg); - } - return totals; } - private: - using Tests = std::set<TestCaseHandle const*>; + bool hadUnmatchedTestSpecs() const { + return m_unmatchedTestSpecs; + } + - IStreamingReporter* m_reporter; + private: + IEventListener* m_reporter; Config const* m_config; RunContext m_context; - Tests m_tests; + std::set<TestCaseHandle const*> m_tests; TestSpec::Matches m_matches; + bool m_unmatchedTestSpecs = false; }; void applyFilenamesAsTags() { @@ -132,14 +161,17 @@ namespace Catch { getCurrentMutableContext().setConfig(m_config.get()); m_startupExceptions = true; - Colour colourGuard( Colour::Red ); - Catch::cerr() << "Errors occurred during startup!" << '\n'; + auto errStream = makeStream( "%stderr" ); + auto colourImpl = makeColourImpl( + ColourMode::PlatformDefault, errStream.get() ); + auto guard = colourImpl->guardColour( Colour::Red ); + errStream->stream() << "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'; + errStream->stream() << TextFlow::Column( ex.what() ).indent(2) << '\n'; } } } @@ -154,7 +186,7 @@ namespace Catch { void Session::showHelp() const { Catch::cout() - << "\nCatch v" << libraryVersion() << '\n' + << "\nCatch2 v" << libraryVersion() << '\n' << m_cli << '\n' << "For more detailed usage please see the project docs\n\n" << std::flush; } @@ -162,7 +194,7 @@ namespace Catch { 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) << "framework: " << "Catch2\n" << std::left << std::setw(16) << "version: " << libraryVersion() << '\n' << std::flush; } @@ -171,15 +203,19 @@ namespace Catch { return 1; auto result = m_cli.parse( Clara::Args( argc, argv ) ); + if( !result ) { config(); getCurrentMutableContext().setConfig(m_config.get()); - Catch::cerr() - << Colour( Colour::Red ) + auto errStream = makeStream( "%stderr" ); + auto colour = makeColourImpl( ColourMode::PlatformDefault, errStream.get() ); + + errStream->stream() + << colour->guardColour( Colour::Red ) << "\nError(s) in input:\n" << TextFlow::Column( result.errorMessage() ).indent( 2 ) << "\n\n"; - Catch::cerr() << "Run with -? for usage\n\n" << std::flush; + errStream->stream() << "Run with -? for usage\n\n" << std::flush; return MaxExitCode; } @@ -187,6 +223,7 @@ namespace Catch { showHelp(); if( m_configData.libIdentify ) libIdentify(); + m_config.reset(); return 0; } @@ -256,6 +293,14 @@ namespace Catch { return 0; } + if ( m_configData.shardIndex >= m_configData.shardCount ) { + Catch::cerr() << "The shard count (" << m_configData.shardCount + << ") must be greater than the shard index (" + << m_configData.shardIndex << ")\n" + << std::flush; + return 1; + } + CATCH_TRY { config(); // Force config to be constructed @@ -269,7 +314,16 @@ namespace Catch { getCurrentMutableContext().setConfig(m_config.get()); // Create reporter(s) so we can route listings through them - auto reporter = makeReporter(m_config.get()); + auto reporter = prepareReporters(m_config.get()); + + auto const& invalidSpecs = m_config->testSpec().getInvalidSpecs(); + if ( !invalidSpecs.empty() ) { + for ( auto const& spec : invalidSpecs ) { + reporter->reportInvalidTestSpec( spec ); + } + return 1; + } + // Handle list request if (list(*reporter, *m_config)) { @@ -279,13 +333,20 @@ namespace Catch { TestGroup tests { CATCH_MOVE(reporter), m_config.get() }; auto const totals = tests.execute(); - if( m_config->warnAboutNoTests() && totals.error == -1 ) + if ( tests.hadUnmatchedTestSpecs() + && m_config->warnAboutUnmatchedTestSpecs() ) { + return 3; + } + + if ( totals.testCases.total() == 0 + && !m_config->zeroTestsCountAsSuccess() ) { 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))); + return (std::min) (MaxExitCode, static_cast<int>(totals.assertions.failed)); } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) catch( std::exception& ex ) { diff --git a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d3e10cb06df83ce2cb5219582be67d1ec5e8992a --- /dev/null +++ b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp @@ -0,0 +1,24 @@ + +// 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_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(); + } + } + +} diff --git a/packages/Catch2/src/catch2/catch_test_case_info.cpp b/packages/Catch2/src/catch2/catch_test_case_info.cpp index 7dab6ae48146f833bc618f48addf7a9070520e48..c1a0a4310aa474e2f2f77c51c6420178fa571ed6 100644 --- a/packages/Catch2/src/catch2/catch_test_case_info.cpp +++ b/packages/Catch2/src/catch2/catch_test_case_info.cpp @@ -7,9 +7,8 @@ // 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 <catch2/internal/catch_case_insensitive_comparisons.hpp> #include <cassert> #include <cctype> @@ -59,7 +58,7 @@ namespace Catch { else if( tag == "!nonportable"_sr ) return TestCaseProperties::NonPortable; else if( tag == "!benchmark"_sr ) - return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden ); + return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden; else return TestCaseProperties::None; } @@ -103,18 +102,23 @@ namespace Catch { } } // end unnamed namespace - bool operator<( Tag const& lhs, Tag const& rhs ) { - return lhs.original < rhs.original; + bool operator<( Tag const& lhs, Tag const& rhs ) { + Detail::CaseInsensitiveLess cmp; + return cmp( lhs.original, rhs.original ); + } + bool operator==( Tag const& lhs, Tag const& rhs ) { + Detail::CaseInsensitiveEqualTo cmp; + return cmp( lhs.original, rhs.original ); } Detail::unique_ptr<TestCaseInfo> - makeTestCaseInfo(std::string const& _className, + makeTestCaseInfo(StringRef _className, NameAndTags const& nameAndTags, SourceLineInfo const& _lineInfo ) { return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo); } - TestCaseInfo::TestCaseInfo(std::string const& _className, + TestCaseInfo::TestCaseInfo(StringRef _className, NameAndTags const& _nameAndTags, SourceLineInfo const& _lineInfo): name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ), @@ -126,7 +130,6 @@ namespace Catch { // (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]. @@ -172,9 +175,8 @@ namespace Catch { } // 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; }), + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); } @@ -195,9 +197,6 @@ namespace Catch { 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 { @@ -223,13 +222,7 @@ namespace Catch { 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)); + tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart)); } bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) { diff --git a/packages/Catch2/src/catch2/catch_test_case_info.hpp b/packages/Catch2/src/catch2/catch_test_case_info.hpp index 8048bd3a3027ee548d59ade9eeafe803277fe820..6cfc2aaf99b8863d8e6e66e4f4f4210e78e9ef76 100644 --- a/packages/Catch2/src/catch2/catch_test_case_info.hpp +++ b/packages/Catch2/src/catch2/catch_test_case_info.hpp @@ -25,16 +25,24 @@ namespace Catch { + /** + * A **view** of a tag string that provides case insensitive comparisons + * + * Note that in Catch2 internals, the square brackets around tags are + * not a part of tag's representation, so e.g. "[cool-tag]" is represented + * as "cool-tag" internally. + */ struct Tag { - Tag(StringRef original_, StringRef lowerCased_): - original(original_), lowerCased(lowerCased_) + constexpr Tag(StringRef original_): + original(original_) {} - StringRef original, lowerCased; + StringRef original; - friend bool operator<( Tag const& lhs, Tag const& rhs ); + friend bool operator< ( Tag const& lhs, Tag const& rhs ); + friend bool operator==( Tag const& lhs, Tag const& rhs ); }; - struct ITestInvoker; + class ITestInvoker; enum class TestCaseProperties : uint8_t { None = 0, @@ -57,7 +65,7 @@ namespace Catch { */ struct TestCaseInfo : Detail::NonCopyable { - TestCaseInfo(std::string const& _className, + TestCaseInfo(StringRef _className, NameAndTags const& _tags, SourceLineInfo const& _lineInfo); @@ -77,9 +85,9 @@ namespace Catch { std::string tagsAsString() const; std::string name; - std::string className; + StringRef className; private: - std::string backingTags, backingLCaseTags; + std::string backingTags; // Internally we copy tags to the backing storage and then add // refs to this storage to the tags vector. void internalAppendTag(StringRef tagString); @@ -109,9 +117,10 @@ namespace Catch { TestCaseInfo const& getTestCaseInfo() const; }; - Detail::unique_ptr<TestCaseInfo> makeTestCaseInfo( std::string const& className, - NameAndTags const& nameAndTags, - SourceLineInfo const& lineInfo ); + Detail::unique_ptr<TestCaseInfo> + makeTestCaseInfo( StringRef className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); } #ifdef __clang__ diff --git a/packages/Catch2/src/catch2/catch_test_macros.hpp b/packages/Catch2/src/catch2/catch_test_macros.hpp index 918fd4bfff071e8e4792ea8d515b16ae43bddd18..e92a45f0fa9dade729354ffb6185ad54a957e1c1 100644 --- a/packages/Catch2/src/catch2/catch_test_macros.hpp +++ b/packages/Catch2/src/catch2/catch_test_macros.hpp @@ -10,7 +10,7 @@ #include <catch2/internal/catch_test_macro_impl.hpp> #include <catch2/catch_message.hpp> -#include <catch2/internal/catch_preprocessor.hpp> +#include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_section.hpp> #include <catch2/internal/catch_test_registry.hpp> #include <catch2/internal/catch_unique_name.hpp> @@ -54,9 +54,13 @@ #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__ ) + #define CATCH_STATIC_CHECK( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) + #define CATCH_STATIC_CHECK_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__ ) + #define CATCH_STATIC_CHECK( ... ) CATCH_CHECK( __VA_ARGS__ ) + #define CATCH_STATIC_CHECK_FALSE( ... ) CATCH_CHECK_FALSE( __VA_ARGS__ ) #endif @@ -101,6 +105,8 @@ #define CATCH_STATIC_REQUIRE( ... ) (void)(0) #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + #define CATCH_STATIC_CHECK( ... ) (void)(0) + #define CATCH_STATIC_CHECK_FALSE( ... ) (void)(0) // "BDD-style" convenience wrappers #define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ )) @@ -145,9 +151,13 @@ #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__ ")" ) + #define STATIC_CHECK( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) + #define STATIC_CHECK_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__ ) + #define STATIC_CHECK( ... ) CHECK( __VA_ARGS__ ) + #define STATIC_CHECK_FALSE( ... ) CHECK_FALSE( __VA_ARGS__ ) #endif // "BDD-style" convenience wrappers @@ -191,6 +201,8 @@ #define STATIC_REQUIRE( ... ) (void)(0) #define STATIC_REQUIRE_FALSE( ... ) (void)(0) + #define STATIC_CHECK( ... ) (void)(0) + #define STATIC_CHECK_FALSE( ... ) (void)(0) // "BDD-style" convenience wrappers #define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ) ) diff --git a/packages/Catch2/src/catch2/catch_test_spec.cpp b/packages/Catch2/src/catch2/catch_test_spec.cpp index df0d570f6e35e16e5cf49556df7a1aac1815e4d1..a3235d432ff6635a2a3925ee691e06969bd9f8c9 100644 --- a/packages/Catch2/src/catch2/catch_test_spec.cpp +++ b/packages/Catch2/src/catch2/catch_test_spec.cpp @@ -38,15 +38,13 @@ namespace Catch { TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) : Pattern( filterString ) - , m_tag( toLower( tag ) ) + , m_tag( 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); + return std::find( begin( testCase.tags ), + end( testCase.tags ), + Tag( m_tag ) ) != end( testCase.tags ); } bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { @@ -98,8 +96,8 @@ namespace Catch { return matches; } - const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ - return (m_invalidArgs); + const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const { + return m_invalidSpecs; } } diff --git a/packages/Catch2/src/catch2/catch_test_spec.hpp b/packages/Catch2/src/catch2/catch_test_spec.hpp index c8804a2cb7b121a7f511801f964d36e4d680276c..499bfaa56c800b92cfab0b757142417aa7be051b 100644 --- a/packages/Catch2/src/catch2/catch_test_spec.hpp +++ b/packages/Catch2/src/catch2/catch_test_spec.hpp @@ -21,7 +21,7 @@ namespace Catch { - struct IConfig; + class IConfig; struct TestCaseInfo; class TestCaseHandle; @@ -72,11 +72,11 @@ namespace Catch { bool hasFilters() const; bool matches( TestCaseInfo const& testCase ) const; Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const; - const vectorStrings & getInvalidArgs() const; + const vectorStrings & getInvalidSpecs() const; private: std::vector<Filter> m_filters; - std::vector<std::string> m_invalidArgs; + std::vector<std::string> m_invalidSpecs; friend class TestSpecParser; }; } diff --git a/packages/Catch2/src/catch2/catch_timer.cpp b/packages/Catch2/src/catch2/catch_timer.cpp index 659292dd1b7e4e63b13afb575dbeb9aa2ff9a6a4..d67d94ca6800a015e245a8aee78c275f6ed2e638 100644 --- a/packages/Catch2/src/catch2/catch_timer.cpp +++ b/packages/Catch2/src/catch2/catch_timer.cpp @@ -9,49 +9,13 @@ #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; + static auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); } - } - auto getEstimatedClockResolution() -> uint64_t { - static auto s_resolution = estimateClockResolution(); - return s_resolution; - } + } // end unnamed namespace void Timer::start() { m_nanoseconds = getCurrentNanosecondsSinceEpoch(); diff --git a/packages/Catch2/src/catch2/catch_timer.hpp b/packages/Catch2/src/catch2/catch_timer.hpp index 03bbf497177392cbb2b071135d1460df5a971af3..30e814150335c995238dbda9134736f70150e1b7 100644 --- a/packages/Catch2/src/catch2/catch_timer.hpp +++ b/packages/Catch2/src/catch2/catch_timer.hpp @@ -12,9 +12,6 @@ namespace Catch { - auto getCurrentNanosecondsSinceEpoch() -> uint64_t; - auto getEstimatedClockResolution() -> uint64_t; - class Timer { uint64_t m_nanoseconds = 0; public: diff --git a/packages/Catch2/src/catch2/catch_tostring.hpp b/packages/Catch2/src/catch2/catch_tostring.hpp index e82552bf82c1fecaad23de3406dde800023cadad..964c8a665e8928d0f8737551d32510b21877f8d4 100644 --- a/packages/Catch2/src/catch2/catch_tostring.hpp +++ b/packages/Catch2/src/catch2/catch_tostring.hpp @@ -14,9 +14,11 @@ #include <type_traits> #include <string> #include <string.h> + #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_config_wchar.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> +#include <catch2/internal/catch_void_type.hpp> #include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp> #ifdef CATCH_CONFIG_CPP17_STRING_VIEW @@ -203,7 +205,7 @@ namespace Catch { }; #endif // CATCH_CONFIG_WCHAR - template<int SZ> + template<size_t SZ> struct StringMaker<char[SZ]> { static std::string convert(char const* str) { // Note that `strnlen` is not actually part of standard C++, @@ -212,7 +214,7 @@ namespace Catch { StringRef( str, strnlen( str, SZ ) ) ); } }; - template<int SZ> + template<size_t SZ> struct StringMaker<signed char[SZ]> { static std::string convert(signed char const* str) { // See the plain `char const*` overload @@ -221,7 +223,7 @@ namespace Catch { StringRef(reinterpreted, strnlen(reinterpreted, SZ))); } }; - template<int SZ> + template<size_t SZ> struct StringMaker<unsigned char[SZ]> { static std::string convert(unsigned char const* str) { // See the plain `char const*` overload @@ -388,13 +390,11 @@ 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); + return ::Catch::Detail::stringify(*optional); } else { - rss << "{ }"; + return "{ }"; } - return rss.str(); } }; } @@ -476,19 +476,11 @@ namespace Catch { using std::end; namespace Detail { - template <typename...> - struct void_type { - using type = void; - }; - - template <typename... Ts> - using void_type_t = typename void_type<Ts...>::type; - template <typename T, typename = void> struct is_range_impl : std::false_type {}; template <typename T> - struct is_range_impl<T, void_type_t<decltype(begin(std::declval<T>()))>> : std::true_type {}; + struct is_range_impl<T, void_t<decltype(begin(std::declval<T>()))>> : std::true_type {}; } // namespace Detail template <typename T> @@ -530,7 +522,7 @@ namespace Catch { } }; - template <typename T, int SZ> + template <typename T, size_t SZ> struct StringMaker<T[SZ]> { static std::string convert(T const(&arr)[SZ]) { return rangeToString(arr); @@ -560,27 +552,27 @@ struct ratio_string { template <> struct ratio_string<std::atto> { - static std::string symbol() { return "a"; } + static char symbol() { return 'a'; } }; template <> struct ratio_string<std::femto> { - static std::string symbol() { return "f"; } + static char symbol() { return 'f'; } }; template <> struct ratio_string<std::pico> { - static std::string symbol() { return "p"; } + static char symbol() { return 'p'; } }; template <> struct ratio_string<std::nano> { - static std::string symbol() { return "n"; } + static char symbol() { return 'n'; } }; template <> struct ratio_string<std::micro> { - static std::string symbol() { return "u"; } + static char symbol() { return 'u'; } }; template <> struct ratio_string<std::milli> { - static std::string symbol() { return "m"; } + static char symbol() { return 'm'; } }; //////////// diff --git a/packages/Catch2/src/catch2/catch_totals.cpp b/packages/Catch2/src/catch2/catch_totals.cpp index a283c6589da4bf8265b96c93d3d4a38e7ebcce7b..14a23869dfd1eb1f670850901de5f20ec04b6e02 100644 --- a/packages/Catch2/src/catch2/catch_totals.cpp +++ b/packages/Catch2/src/catch2/catch_totals.cpp @@ -24,7 +24,7 @@ namespace Catch { return *this; } - std::size_t Counts::total() const { + std::uint64_t Counts::total() const { return passed + failed + failedButOk; } bool Counts::allPassed() const { diff --git a/packages/Catch2/src/catch2/catch_totals.hpp b/packages/Catch2/src/catch2/catch_totals.hpp index 76d6ae47d647c2e078c99de8bb677d6c6f8166d1..6bc444fc2f547ee2aa8fd07a0335915e293df9cb 100644 --- a/packages/Catch2/src/catch2/catch_totals.hpp +++ b/packages/Catch2/src/catch2/catch_totals.hpp @@ -8,7 +8,7 @@ #ifndef CATCH_TOTALS_HPP_INCLUDED #define CATCH_TOTALS_HPP_INCLUDED -#include <cstddef> +#include <cstdint> namespace Catch { @@ -16,13 +16,13 @@ namespace Catch { Counts operator - ( Counts const& other ) const; Counts& operator += ( Counts const& other ); - std::size_t total() const; + std::uint64_t total() const; bool allPassed() const; bool allOk() const; - std::size_t passed = 0; - std::size_t failed = 0; - std::size_t failedButOk = 0; + std::uint64_t passed = 0; + std::uint64_t failed = 0; + std::uint64_t failedButOk = 0; }; struct Totals { @@ -32,7 +32,6 @@ namespace Catch { Totals delta( Totals const& prevTotals ) const; - int error = 0; Counts assertions; Counts testCases; }; diff --git a/packages/Catch2/src/catch2/catch_translate_exception.hpp b/packages/Catch2/src/catch2/catch_translate_exception.hpp index dfd95cd69619ef2cf9064201f944bb24aeb8b316..4a0be629da9ed63fc8be0124365512ca63ac225d 100644 --- a/packages/Catch2/src/catch2/catch_translate_exception.hpp +++ b/packages/Catch2/src/catch2/catch_translate_exception.hpp @@ -81,4 +81,4 @@ namespace Catch { #endif -#endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED \ No newline at end of file +#endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_user_config.hpp.in b/packages/Catch2/src/catch2/catch_user_config.hpp.in new file mode 100644 index 0000000000000000000000000000000000000000..77c94291cd8d2117efadbee7c02d041d22754291 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_user_config.hpp.in @@ -0,0 +1,198 @@ + +// 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 + * **AUTOGENERATED FROM CMAKE CONFIGURATION** + * + * Contains materialized compile-time configuration provided to Catch2's + * CMake configuration. All compile-time configuration options need to + * be here, and also documented in `docs/configuration.md`. + */ + +#ifndef CATCH_USER_CONFIG_HPP_INCLUDED +#define CATCH_USER_CONFIG_HPP_INCLUDED + + +// ------ +// Overridable compilation flags, +// these can have 3 "states": Force Yes, Force No, Use Default. +// Setting both Force Yes and Force No is an error +// ------ + +#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE +#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE + +#if defined( CATCH_CONFIG_ANDROID_LOGWRITE ) && \ + defined( CATCH_CONFIG_NO_ANDROID_LOGWRITE ) +# error Cannot force ANDROID_LOGWRITE to both ON and OFF +#endif + +#cmakedefine CATCH_CONFIG_COLOUR_WIN32 +#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32 + +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) && \ + defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) +# error Cannot force COLOUR_WIN32 to be ON and OFF +#endif + +#cmakedefine CATCH_CONFIG_COUNTER +#cmakedefine CATCH_CONFIG_NO_COUNTER + +#if defined( CATCH_CONFIG_COUNTER ) && \ + defined( CATCH_CONFIG_NO_COUNTER ) +# error Cannot force COUNTER to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP11_TO_STRING +#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING + +#if defined( CATCH_CONFIG_CPP11_TO_STRING ) && \ + defined( CATCH_CONFIG_NO_CPP11_TO_STRING ) +# error Cannot force CPP11_TO_STRING to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP17_BYTE +#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE + +#if defined( CATCH_CONFIG_CPP17_BYTE ) && \ + defined( CATCH_CONFIG_NO_CPP17_BYTE ) +# error Cannot force CPP17_BYTE to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL +#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL + +#if defined( CATCH_CONFIG_CPP17_OPTIONAL ) && \ + defined( CATCH_CONFIG_NO_CPP17_OPTIONAL ) +# error Cannot force CPP17_OPTIONAL to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW +#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW + +#if defined( CATCH_CONFIG_CPP17_STRING_VIEW ) && \ + defined( CATCH_CONFIG_NO_CPP17_STRING_VIEW ) +# error Cannot force CPP17_STRING_VIEW to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS + +#if defined( CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS ) && \ + defined( CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS ) +# error Cannot force CPP17_UNCAUGHT_EXCEPTIONS to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_CPP17_VARIANT +#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT + +#if defined( CATCH_CONFIG_CPP17_VARIANT ) && \ + defined( CATCH_CONFIG_NO_CPP17_VARIANT ) +# error Cannot force CPP17_VARIANT to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER +#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER + +#if defined( CATCH_CONFIG_GLOBAL_NEXTAFTER ) && \ + defined( CATCH_CONFIG_NO_GLOBAL_NEXTAFTER ) +# error Cannot force GLOBAL_NEXTAFTER to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_POSIX_SIGNALS +#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS + +#if defined( CATCH_CONFIG_POSIX_SIGNALS ) && \ + defined( CATCH_CONFIG_NO_POSIX_SIGNALS ) +# error Cannot force POSIX_SIGNALS to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_USE_ASYNC +#cmakedefine CATCH_CONFIG_NO_USE_ASYNC + +#if defined( CATCH_CONFIG_USE_ASYNC ) && \ + defined( CATCH_CONFIG_NO_USE_ASYNC ) +# error Cannot force USE_ASYNC to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_WCHAR +#cmakedefine CATCH_CONFIG_NO_WCHAR + +#if defined( CATCH_CONFIG_WCHAR ) && \ + defined( CATCH_CONFIG_NO_WCHAR ) +# error Cannot force WCHAR to both ON and OFF +#endif + + + +#cmakedefine CATCH_CONFIG_WINDOWS_SEH +#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) && \ + defined( CATCH_CONFIG_NO_WINDOWS_SEH ) +# error Cannot force WINDOWS_SEH to both ON and OFF +#endif + + +// ------ +// Simple toggle defines +// their value is never used and they cannot be overriden +// ------ + + +#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT +#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS +#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER +#cmakedefine CATCH_CONFIG_DISABLE +#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION +#cmakedefine CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS +#cmakedefine CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER +#cmakedefine CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +#cmakedefine CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +#cmakedefine CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT +#cmakedefine CATCH_CONFIG_FAST_COMPILE +#cmakedefine CATCH_CONFIG_NOSTDOUT +#cmakedefine CATCH_CONFIG_PREFIX_ALL +#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG + + +// ------ +// "Variable" defines, these have actual values +// ------ + +#define CATCH_CONFIG_DEFAULT_REPORTER "@CATCH_CONFIG_DEFAULT_REPORTER@" +#define CATCH_CONFIG_CONSOLE_WIDTH @CATCH_CONFIG_CONSOLE_WIDTH@ + +// Unlike the macros above, CATCH_CONFIG_FALLBACK_STRINGIFIER does not +// have a good default value, so we cannot always define it, and cannot +// even expose it as a variable in CMake. The users will have to find +// out about it from docs and set it only if they use it. +#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@ + +#endif // CATCH_USER_CONFIG_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_version.cpp b/packages/Catch2/src/catch2/catch_version.cpp index 96ab364072b20f878b07466f91c489b992bb7a1c..a7075f3006e09e2946e75515f0c7a77d4e74fdc2 100644 --- a/packages/Catch2/src/catch2/catch_version.cpp +++ b/packages/Catch2/src/catch2/catch_version.cpp @@ -36,7 +36,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 3, 0, 0, "preview", 3 ); + static Version version( 3, 1, 0, "", 0 ); return version; } diff --git a/packages/Catch2/src/catch2/catch_version_macros.hpp b/packages/Catch2/src/catch2/catch_version_macros.hpp index 51e50c5ce084eae5bef891f7cbb8e6e584bb3fc9..c7212e3a6ad22e86bbaef94ffda018ba1f6b0f19 100644 --- a/packages/Catch2/src/catch2/catch_version_macros.hpp +++ b/packages/Catch2/src/catch2/catch_version_macros.hpp @@ -9,7 +9,7 @@ #define CATCH_VERSION_MACROS_HPP_INCLUDED #define CATCH_VERSION_MAJOR 3 -#define CATCH_VERSION_MINOR 0 +#define CATCH_VERSION_MINOR 1 #define CATCH_VERSION_PATCH 0 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp b/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70a991e3c8c43217b72fb9ea38f627441293dee3 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp @@ -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 + +#include <catch2/generators/catch_generator_exception.hpp> + +namespace Catch { + + const char* GeneratorException::what() const noexcept { + return m_msg; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp b/packages/Catch2/src/catch2/generators/catch_generators.cpp similarity index 52% rename from packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp rename to packages/Catch2/src/catch2/generators/catch_generators.cpp index da1b62e9d4cc73842a45af220e703bdfc0613c39..3e09bfd9ebe7844c9999e24743e650594d0195bd 100644 --- a/packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp +++ b/packages/Catch2/src/catch2/generators/catch_generators.cpp @@ -5,36 +5,6 @@ // 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> diff --git a/packages/Catch2/src/catch2/generators/catch_generators.hpp b/packages/Catch2/src/catch2/generators/catch_generators.hpp index 9ffb9b76d7e763173b5b6f6fdef75734b53298d2..1de04e3bddad492c78d8c54c22378b00168f4b92 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators.hpp @@ -8,10 +8,13 @@ #ifndef CATCH_GENERATORS_HPP_INCLUDED #define CATCH_GENERATORS_HPP_INCLUDED +#include <catch2/catch_tostring.hpp> #include <catch2/interfaces/catch_interfaces_generatortracker.hpp> #include <catch2/internal/catch_source_line_info.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_unique_name.hpp> +#include <catch2/internal/catch_preprocessor.hpp> #include <vector> #include <tuple> @@ -29,7 +32,12 @@ namespace Detail { } // end namespace detail template<typename T> - struct IGenerator : GeneratorUntypedBase { + class IGenerator : public GeneratorUntypedBase { + std::string stringifyImpl() const override { + return ::Catch::Detail::stringify( get() ); + } + + public: ~IGenerator() override = default; IGenerator() = default; IGenerator(IGenerator const&) = default; @@ -61,7 +69,7 @@ namespace Detail { return m_generator->get(); } bool next() { - return m_generator->next(); + return m_generator->countedNext(); } }; diff --git a/packages/Catch2/src/catch2/generators/catch_generators_random.cpp b/packages/Catch2/src/catch2/generators/catch_generators_random.cpp new file mode 100644 index 0000000000000000000000000000000000000000..57ad174553692589a416d2603422269cf8b34b85 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators_random.cpp @@ -0,0 +1,13 @@ + +// 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/generators/catch_generators_random.hpp> + +#include <catch2/internal/catch_context.hpp> + +std::uint32_t Catch::Generators::Detail::getSeed() { return sharedRng()(); } diff --git a/packages/Catch2/src/catch2/generators/catch_generators_random.hpp b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp index cc66f908050c9202a627a87971474551a88b734c..e9ff92084d2df15a9fa5f9b665233efa12b73c99 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_random.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp @@ -16,16 +16,21 @@ namespace Catch { namespace Generators { +namespace Detail { + // Returns a suitable seed for a random floating generator based off + // the primary internal rng. It does so by taking current value from + // the rng and returning it as the seed. + std::uint32_t getSeed(); +} template <typename Float> class RandomFloatingGenerator final : public IGenerator<Float> { - Catch::SimplePcg32& m_rng; + Catch::SimplePcg32 m_rng; std::uniform_real_distribution<Float> m_dist; Float m_current_number; public: - - RandomFloatingGenerator(Float a, Float b): - m_rng(rng()), + RandomFloatingGenerator( Float a, Float b, std::uint32_t seed ): + m_rng(seed), m_dist(a, b) { static_cast<void>(next()); } @@ -41,13 +46,12 @@ public: template <typename Integer> class RandomIntegerGenerator final : public IGenerator<Integer> { - Catch::SimplePcg32& m_rng; + Catch::SimplePcg32 m_rng; std::uniform_int_distribution<Integer> m_dist; Integer m_current_number; public: - - RandomIntegerGenerator(Integer a, Integer b): - m_rng(rng()), + RandomIntegerGenerator( Integer a, Integer b, std::uint32_t seed ): + m_rng(seed), m_dist(a, b) { static_cast<void>(next()); } @@ -61,14 +65,19 @@ public: } }; -// 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>> +std::enable_if_t<std::is_integral<T>::value, GeneratorWrapper<T>> random(T a, T b) { + static_assert( + !std::is_same<T, char>::value && + !std::is_same<T, int8_t>::value && + !std::is_same<T, uint8_t>::value && + !std::is_same<T, signed char>::value && + !std::is_same<T, unsigned char>::value && + !std::is_same<T, bool>::value, + "The requested type is not supported by the underlying random distributions from std" ); return GeneratorWrapper<T>( - Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b) + Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b, Detail::getSeed()) ); } @@ -77,7 +86,7 @@ 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) + Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b, Detail::getSeed()) ); } diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fb98a75d8baec0ed7a3ce8e806310f3387028a81 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp @@ -0,0 +1,13 @@ + +// 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_capture.hpp> + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp index 2e7a631f152f28356893bd5524145cd6f2aa0b12..6981e724bcdf978387acf83f5114a648ecfbf0cb 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -26,15 +26,15 @@ namespace Catch { struct AssertionReaction; struct SourceLineInfo; - struct ITransientExpression; - struct IGeneratorTracker; + class ITransientExpression; + class IGeneratorTracker; struct BenchmarkInfo; template <typename Duration = std::chrono::duration<double, std::nano>> struct BenchmarkStats; - struct IResultCapture { - + class IResultCapture { + public: virtual ~IResultCapture(); virtual bool sectionStarted( SectionInfo const& sectionInfo, diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp deleted file mode 100644 index 7acf0a12407cf6d1d18ba6a76ab769ce2320cd92..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// 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_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.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp new file mode 100644 index 0000000000000000000000000000000000000000..13d761dfbf54624eade17ca1d00735d368861d66 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp @@ -0,0 +1,13 @@ + +// 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_config.hpp> + +namespace Catch { + IConfig::~IConfig() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp index 60c4e9be8c47ffa9f0e1392968d221dfd59c0247..5e358650a4dcdaeefb30f2aa52e46b25b47520b3 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp @@ -26,8 +26,10 @@ namespace Catch { struct WarnAbout { enum What { Nothing = 0x00, + //! A test case or leaf section did not run any assertions NoAssertions = 0x01, - NoTests = 0x02 + //! A command line test spec matched no test cases + UnmatchedTestSpec = 0x02, }; }; enum class ShowDurations { @@ -40,10 +42,15 @@ namespace Catch { LexicographicallySorted, Randomized }; - enum class UseColour { - Auto, - Yes, - No + enum class ColourMode : std::uint8_t { + //! Let Catch2 pick implementation based on platform detection + PlatformDefault, + //! Use ANSI colour code escapes + ANSI, + //! Use Win32 console colour API + Win32, + //! Don't use any colour + None }; struct WaitForKeypress { enum When { Never, @@ -53,18 +60,19 @@ namespace Catch { }; }; class TestSpec; + class IStream; - struct IConfig : Detail::NonCopyable { - + class IConfig : public Detail::NonCopyable { + public: virtual ~IConfig(); virtual bool allowThrows() const = 0; - virtual std::ostream& stream() const = 0; virtual StringRef name() const = 0; virtual bool includeSuccessfulResults() const = 0; virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; - virtual bool warnAboutNoTests() const = 0; + virtual bool warnAboutUnmatchedTestSpecs() const = 0; + virtual bool zeroTestsCountAsSuccess() const = 0; virtual int abortAfter() const = 0; virtual bool showInvisibles() const = 0; virtual ShowDurations showDurations() const = 0; @@ -73,13 +81,16 @@ namespace Catch { 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 uint32_t rngSeed() const = 0; + virtual unsigned int shardCount() const = 0; + virtual unsigned int shardIndex() const = 0; + virtual ColourMode defaultColourMode() const = 0; virtual std::vector<std::string> const& getSectionsToRun() const = 0; virtual Verbosity verbosity() const = 0; + virtual bool skipBenchmarks() const = 0; virtual bool benchmarkNoAnalysis() const = 0; - virtual int benchmarkSamples() const = 0; + virtual unsigned int benchmarkSamples() const = 0; virtual double benchmarkConfidenceInterval() const = 0; virtual unsigned int benchmarkResamples() const = 0; virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; 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 index e00f2c9db5ab376689480afebfabc131d1e753fa..cf25d896eadba2be187f4f87d2f5d57c70184f24 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp @@ -25,7 +25,8 @@ namespace Catch { }; } // namespace Detail - struct IMutableEnumValuesRegistry { + class IMutableEnumValuesRegistry { + public: virtual ~IMutableEnumValuesRegistry(); // = default; virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0de7450e1eed8fa9d96d8e83f6dbefb4dbe2828 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp @@ -0,0 +1,14 @@ + +// 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_exception.hpp> + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp index c1834074577e0e1465a094c1e0aad6c703ba7bed..b72b49a105f8a1df80d1d6269a4caf8d7f21fbae 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp @@ -17,17 +17,18 @@ namespace Catch { using exceptionTranslateFunction = std::string(*)(); - struct IExceptionTranslator; + class IExceptionTranslator; using ExceptionTranslators = std::vector<Detail::unique_ptr<IExceptionTranslator const>>; - struct IExceptionTranslator { + class IExceptionTranslator { + public: virtual ~IExceptionTranslator(); // = default virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; }; - struct IExceptionTranslatorRegistry { + class IExceptionTranslatorRegistry { + public: virtual ~IExceptionTranslatorRegistry(); // = default - virtual std::string translateActiveException() const = 0; }; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8c67b543a9ede7f9c5fac02695cf6c1d0c57129 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp @@ -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 + +#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> +#include <string> + +namespace Catch { + namespace Generators { + + bool GeneratorUntypedBase::countedNext() { + auto ret = next(); + if ( ret ) { + m_stringReprCache.clear(); + ++m_currentElementIndex; + } + return ret; + } + + StringRef GeneratorUntypedBase::currentElementAsString() const { + if ( m_stringReprCache.empty() ) { + m_stringReprCache = stringifyImpl(); + } + return m_stringReprCache; + } + + } // namespace Generators +} // namespace Catch diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp index f1ca34417aede4fe7ff2afff25ed9e78705f1562..83e3d783a923fc3a5550fcb7e582de0be70e5ac5 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp @@ -9,11 +9,32 @@ #define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <string> namespace Catch { namespace Generators { class GeneratorUntypedBase { + // Caches result from `toStringImpl`, assume that when it is an + // empty string, the cache is invalidated. + mutable std::string m_stringReprCache; + + // Counts based on `next` returning true + std::size_t m_currentElementIndex = 0; + + /** + * 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; + + //! Customization point for `currentElementAsString` + virtual std::string stringifyImpl() const = 0; + public: GeneratorUntypedBase() = default; // Generation of copy ops is deprecated (and Clang will complain) @@ -23,17 +44,41 @@ namespace Catch { 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; + /** + * Attempts to move the generator to the next element + * + * Serves as a non-virtual interface to `next`, so that the + * top level interface can provide sanity checking and shared + * features. + * + * As with `next`, returns true iff the move succeeded and + * the generator has new valid element to provide. + */ + bool countedNext(); + + std::size_t currentElementIndex() const { return m_currentElementIndex; } + + /** + * Returns generator's current element as user-friendly string. + * + * By default returns string equivalent to calling + * `Catch::Detail::stringify` on the current element, but generators + * can customize their implementation as needed. + * + * Not thread-safe due to internal caching. + * + * The returned ref is valid only until the generator instance + * is destructed, or it moves onto the next element, whichever + * comes first. + */ + StringRef currentElementAsString() const; }; using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; } // namespace Generators - struct IGeneratorTracker { + class IGeneratorTracker { + public: virtual ~IGeneratorTracker(); // = default; virtual auto hasGenerator() const -> bool = 0; virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..557f7303731df86114939d457610d5068ff074bf --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp @@ -0,0 +1,14 @@ + +// 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> + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp index aeefeedb5fb26c708e48c8229deff966150a8ade..22e62b7967a4d1da04f33af7ca266cccc58eec9f 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp @@ -16,21 +16,23 @@ namespace Catch { class TestCaseHandle; struct TestCaseInfo; - struct ITestCaseRegistry; - struct IExceptionTranslatorRegistry; - struct IExceptionTranslator; - struct IReporterRegistry; - struct IReporterFactory; - struct ITagAliasRegistry; - struct ITestInvoker; - struct IMutableEnumValuesRegistry; + class ITestCaseRegistry; + class IExceptionTranslatorRegistry; + class IExceptionTranslator; + class IReporterRegistry; + class IReporterFactory; + class ITagAliasRegistry; + class ITestInvoker; + class IMutableEnumValuesRegistry; struct SourceLineInfo; class StartupExceptionRegistry; + class EventListenerFactory; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; - struct IRegistryHub { + class IRegistryHub { + public: virtual ~IRegistryHub(); // = default virtual IReporterRegistry const& getReporterRegistry() const = 0; @@ -42,10 +44,11 @@ namespace Catch { virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; }; - struct IMutableRegistryHub { + class IMutableRegistryHub { + public: virtual ~IMutableRegistryHub(); // = default virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0; - virtual void registerListener( IReporterFactoryPtr factory ) = 0; + virtual void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) = 0; virtual void registerTest(Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker) = 0; virtual void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) = 0; virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp index 89a86f59a867b2837d7ae45a111d556bd1dc01e7..b1ad584c148023995b7c8a5c50cbe9f15c8f8715 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -14,20 +14,38 @@ #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_istream.hpp> #include <algorithm> +#include <cassert> #include <iomanip> namespace Catch { - ReporterConfig::ReporterConfig( IConfig const* _fullConfig ) - : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + ReporterConfig::ReporterConfig( + IConfig const* _fullConfig, + Detail::unique_ptr<IStream> _stream, + ColourMode colourMode, + std::map<std::string, std::string> customOptions ): + m_stream( CATCH_MOVE(_stream) ), + m_fullConfig( _fullConfig ), + m_colourMode( colourMode ), + m_customOptions( CATCH_MOVE( customOptions ) ) {} + + Detail::unique_ptr<IStream> ReporterConfig::takeStream() && { + assert( m_stream ); + return CATCH_MOVE( m_stream ); + } + IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; } + ColourMode ReporterConfig::colourMode() const { return m_colourMode; } - ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ) - : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + std::map<std::string, std::string> const& + ReporterConfig::customOptions() const { + return m_customOptions; + } - std::ostream& ReporterConfig::stream() const { return *m_stream; } - IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; } + ReporterConfig::~ReporterConfig() = default; AssertionStats::AssertionStats( AssertionResult const& _assertionResult, std::vector<MessageInfo> const& _infoMessages, @@ -81,6 +99,6 @@ namespace Catch { aborting( _aborting ) {} - IStreamingReporter::~IStreamingReporter() = default; + IEventListener::~IEventListener() = default; } // 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 index 681c8e4d85357cd7bc3f63a560ad4eb2881427a2..421924385046ff1151c950cfd4f5411ca9884998 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -19,6 +19,7 @@ #include <catch2/benchmark/catch_outlier_classification.hpp> +#include <map> #include <string> #include <vector> #include <iosfwd> @@ -26,26 +27,38 @@ namespace Catch { struct ReporterDescription; + struct ListenerDescription; struct TagInfo; struct TestCaseInfo; class TestCaseHandle; - struct IConfig; + class IConfig; + class IStream; + enum class ColourMode : std::uint8_t; struct ReporterConfig { - explicit ReporterConfig( IConfig const* _fullConfig ); + ReporterConfig( IConfig const* _fullConfig, + Detail::unique_ptr<IStream> _stream, + ColourMode colourMode, + std::map<std::string, std::string> customOptions ); - ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ); + ReporterConfig( ReporterConfig&& ) = default; + ReporterConfig& operator=( ReporterConfig&& ) = default; + ~ReporterConfig(); // = default - std::ostream& stream() const; + Detail::unique_ptr<IStream> takeStream() &&; IConfig const* fullConfig() const; + ColourMode colourMode() const; + std::map<std::string, std::string> const& customOptions() const; private: - std::ostream* m_stream; + Detail::unique_ptr<IStream> m_stream; IConfig const* m_fullConfig; + ColourMode m_colourMode; + std::map<std::string, std::string> m_customOptions; }; struct TestRunInfo { - TestRunInfo(StringRef _name) : name(_name) {} + constexpr TestRunInfo(StringRef _name) : name(_name) {} StringRef name; }; @@ -105,7 +118,7 @@ namespace Catch { std::string name; double estimatedDuration; int iterations; - int samples; + unsigned int samples; unsigned int resamples; double clockResolution; double clockCost; @@ -151,8 +164,19 @@ namespace Catch { bool shouldReportAllAssertions = false; }; - - struct IStreamingReporter { + /** + * The common base for all reporters and event listeners + * + * Implementing classes must also implement: + * + * //! User-friendly description of the reporter/listener type + * static std::string getDescription() + * + * Generally shouldn't be derived from by users of Catch2 directly, + * instead they should derive from one of the utility bases that + * derive from this class. + */ + class IEventListener { protected: //! Derived classes can set up their preferences here ReporterPreferences m_preferences; @@ -160,9 +184,9 @@ namespace Catch { IConfig const* m_config; public: - IStreamingReporter( IConfig const* config ): m_config( config ) {} + IEventListener( IConfig const* config ): m_config( config ) {} - virtual ~IStreamingReporter(); // = default; + virtual ~IEventListener(); // = default; // Implementing class must also provide the following static methods: // static std::string getDescription(); @@ -171,46 +195,69 @@ namespace Catch { return m_preferences; } + //! Called when no test cases match provided test spec virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0; - virtual void reportInvalidArguments( StringRef invalidArgument ) = 0; - + //! Called for all invalid test specs from the cli + virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0; + + /** + * Called once in a testing run before tests are started + * + * Not called if tests won't be run (e.g. only listing will happen) + */ virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; //! Called _once_ for each TEST_CASE, no matter how many times it is entered virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections) virtual void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) = 0; + //! Called when a `SECTION` is being entered. Not called for skipped sections virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; + //! Called when user-code is being probed before the actual benchmark runs virtual void benchmarkPreparing( StringRef benchmarkName ) = 0; + //! Called after probe but before the user-code is being benchmarked virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0; + //! Called with the benchmark results if benchmark successfully finishes virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0; + //! Called if running the benchmarks fails for any reason virtual void benchmarkFailed( StringRef benchmarkName ) = 0; + //! Called before assertion success/failure is evaluated virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + //! Called after assertion was fully evaluated virtual void assertionEnded( AssertionStats const& assertionStats ) = 0; + //! Called after a `SECTION` has finished running virtual void sectionEnded( SectionStats const& sectionStats ) = 0; //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections) virtual void testCasePartialEnded(TestCaseStats const& testCaseStats, uint64_t partNumber ) = 0; //! Called _once_ for each TEST_CASE, no matter how many times it is entered virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; + /** + * Called once after all tests in a testing run are finished + * + * Not called if tests weren't run (e.g. only listings happened) + */ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + //! Called with test cases that are skipped due to the test run aborting virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + //! Called if a fatal error (signal/structured exception) occured virtual void fatalErrorEncountered( StringRef error ) = 0; //! Writes out information about provided reporters using reporter-specific format virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0; + //! Writes out the provided listeners descriptions using reporter-specific format + virtual void listListeners(std::vector<ListenerDescription> 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>; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; } // end namespace Catch diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8732ed89a1efdc4c2e8595e446f8884311860d78 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp @@ -0,0 +1,14 @@ + +// 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_factory.hpp> + +namespace Catch { + IReporterFactory::~IReporterFactory() = default; + EventListenerFactory::~EventListenerFactory() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp index 5a40d1bded67f983b054ce0e348f37cc50b98edc..323edde26cdc79e3a039520934eab396504ed396 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp @@ -9,24 +9,37 @@ #define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_stringref.hpp> #include <string> namespace Catch { struct ReporterConfig; - struct IStreamingReporter; - using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + class IConfig; + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; - struct IReporterFactory { + class IReporterFactory { + public: virtual ~IReporterFactory(); // = default - virtual IStreamingReporterPtr - create( ReporterConfig const& config ) const = 0; + virtual IEventListenerPtr + create( ReporterConfig&& config ) const = 0; virtual std::string getDescription() const = 0; }; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; + + class EventListenerFactory { + public: + virtual ~EventListenerFactory(); // = default + virtual IEventListenerPtr create( IConfig const* config ) const = 0; + //! Return a meaningful name for the listener, e.g. its type name + virtual StringRef getName() const = 0; + //! Return listener's description if available + virtual std::string getDescription() const = 0; + }; } // namespace Catch #endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd38ac2886aa9317e157c4d1512c012af83c8fe7 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp @@ -0,0 +1,13 @@ + +// 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_registry.hpp> + +namespace Catch { + IReporterRegistry::~IReporterRegistry() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp index 54871ccedc236d162899531a9920565c3b52b514..d2f2a1596bec8f68874184c0663933887458893c 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED #define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED +#include <catch2/internal/catch_case_insensitive_comparisons.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <string> @@ -16,19 +17,22 @@ namespace Catch { - struct IConfig; + class IConfig; - struct IStreamingReporter; - using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; - struct IReporterFactory; + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + class IReporterFactory; using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; + struct ReporterConfig; + class EventListenerFactory; - struct IReporterRegistry { - using FactoryMap = std::map<std::string, IReporterFactoryPtr>; - using Listeners = std::vector<IReporterFactoryPtr>; + class IReporterRegistry { + public: + using FactoryMap = std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess>; + using Listeners = std::vector<Detail::unique_ptr<EventListenerFactory>>; virtual ~IReporterRegistry(); // = default - virtual IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const = 0; + virtual IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const = 0; virtual FactoryMap const& getFactories() const = 0; virtual Listeners const& getListeners() const = 0; }; 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 index 6b0973b40208204bc814619c43bed15e6d82c8a5..141560a1fd1c6026ae4fe1e5f078812682d6892d 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp @@ -14,7 +14,8 @@ namespace Catch { struct TagAlias; - struct ITagAliasRegistry { + class ITagAliasRegistry { + public: virtual ~ITagAliasRegistry(); // = default // Nullptr if not present virtual TagAlias const* find( std::string const& alias ) const = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec32d667bf082e9e425604a9ab4946f2ce37a19e --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp @@ -0,0 +1,14 @@ + +// 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_testcase.hpp> + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp index 2d0b6c284f59836bf0995916fcb0fcc2320a62d9..9701d34218abbc2269f9fbabe591fc4d05090719 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp @@ -15,15 +15,17 @@ namespace Catch { class TestSpec; struct TestCaseInfo; - struct ITestInvoker { + class ITestInvoker { + public: virtual void invoke () const = 0; virtual ~ITestInvoker(); // = default }; class TestCaseHandle; - struct IConfig; + class IConfig; - struct ITestCaseRegistry { + class ITestCaseRegistry { + public: virtual ~ITestCaseRegistry(); // = default // 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; diff --git a/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp index b7c7613e311d874dacb60860a1ccefbc4719468e..5faa5e4ba6cfa680c8759e1e1ddcb9183f598106 100644 --- a/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp +++ b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp @@ -13,11 +13,11 @@ #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/internal/catch_lazy_expr.hpp> +#include <string> + namespace Catch { - struct AssertionResultData; - struct IResultCapture; - class RunContext; + class IResultCapture; struct AssertionReaction { bool shouldDebugBreak = false; diff --git a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp new file mode 100644 index 0000000000000000000000000000000000000000..904c2289b8b891e6bfc5d902845730279a5fca6d --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.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_case_insensitive_comparisons.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +#include <algorithm> + +namespace Catch { + namespace Detail { + + bool CaseInsensitiveLess::operator()( StringRef lhs, + StringRef rhs ) const { + return std::lexicographical_compare( + lhs.begin(), lhs.end(), + rhs.begin(), rhs.end(), + []( char l, char r ) { return toLower( l ) < toLower( r ); } ); + } + + bool + CaseInsensitiveEqualTo::operator()( StringRef lhs, + StringRef rhs ) const { + return std::equal( + lhs.begin(), lhs.end(), + rhs.begin(), rhs.end(), + []( char l, char r ) { return toLower( l ) == toLower( r ); } ); + } + + } // namespace Detail +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a97b7b4b9a629c8e999364df20837e296eb24283 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.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_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED +#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + namespace Detail { + //! Provides case-insensitive `op<` semantics when called + struct CaseInsensitiveLess { + bool operator()( StringRef lhs, + StringRef rhs ) const; + }; + + //! Provides case-insensitive `op==` semantics when called + struct CaseInsensitiveEqualTo { + bool operator()( StringRef lhs, + StringRef rhs ) const; + }; + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_clara.cpp b/packages/Catch2/src/catch2/internal/catch_clara.cpp index eb7dacaea1a08493a65cd638524ae3708197d275..b34ce917679300e9173d91aa2b3798bd2a7586ef 100644 --- a/packages/Catch2/src/catch2/internal/catch_clara.cpp +++ b/packages/Catch2/src/catch2/internal/catch_clara.cpp @@ -5,13 +5,16 @@ // 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> +#include <algorithm> +#include <ostream> + namespace { bool isOptPrefix( char c ) { return c == '-' @@ -113,7 +116,7 @@ namespace Catch { } else { return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + - source + "'" ); + source + '\'' ); } return ParserResult::ok( ParseResultType::Matched ); } @@ -230,7 +233,7 @@ namespace Catch { return Detail::InternalParseResult::runtimeError( "Expected argument following " + token.token); - auto result = valueRef->setValue(argToken.token); + const auto result = valueRef->setValue(argToken.token); if (!result) return Detail::InternalParseResult(result); if (result.value() == diff --git a/packages/Catch2/src/catch2/internal/catch_clara.hpp b/packages/Catch2/src/catch2/internal/catch_clara.hpp index 477cb08d1e7a509e96da5d962cbe33fcbd2bbfab..512b0526c09752c047f2f2a463c4a93ce02de3bc 100644 --- a/packages/Catch2/src/catch2/internal/catch_clara.hpp +++ b/packages/Catch2/src/catch2/internal/catch_clara.hpp @@ -29,14 +29,16 @@ # endif #endif -#include <catch2/internal/catch_noncopyable.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_void_type.hpp> #include <cassert> -#include <cctype> #include <memory> +#include <ostream> #include <sstream> #include <string> +#include <type_traits> #include <vector> namespace Catch { @@ -53,7 +55,25 @@ namespace Catch { ShortCircuitSame }; + struct accept_many_t {}; + constexpr accept_many_t accept_many {}; + namespace Detail { + struct fake_arg { + template <typename T> + operator T(); + }; + + template <typename F, typename = void> + struct is_unary_function : std::false_type {}; + + template <typename F> + struct is_unary_function< + F, + Catch::Detail::void_t<decltype( + std::declval<F>()( fake_arg() ) ) + > + > : std::true_type {}; // Traits for extracting arg and return type of lambdas (for single // argument lambdas) @@ -203,20 +223,20 @@ namespace Catch { return { ResultType::Ok, value }; } static auto ok() -> BasicResult { return { ResultType::Ok }; } - static auto logicError( std::string const& message ) + static auto logicError( std::string&& message ) -> BasicResult { - return { ResultType::LogicError, message }; + return { ResultType::LogicError, CATCH_MOVE(message) }; } - static auto runtimeError( std::string const& message ) + static auto runtimeError( std::string&& message ) -> BasicResult { - return { ResultType::RuntimeError, message }; + return { ResultType::RuntimeError, CATCH_MOVE(message) }; } explicit operator bool() const { return m_type == ResultType::Ok; } auto type() const -> ResultType { return m_type; } - auto errorMessage() const -> std::string { + auto errorMessage() const -> std::string const& { return m_errorMessage; } @@ -235,8 +255,8 @@ namespace Catch { m_errorMessage; // Only populated if resultType is an error BasicResult( ResultType type, - std::string const& message ): - ResultValueBase<T>( type ), m_errorMessage( message ) { + std::string&& message ): + ResultValueBase<T>( type ), m_errorMessage( CATCH_MOVE(message) ) { assert( m_type != ResultType::Ok ); } @@ -393,6 +413,11 @@ namespace Catch { } }; + template <typename L> struct BoundManyLambda : BoundLambda<L> { + explicit BoundManyLambda( L const& lambda ): BoundLambda<L>( lambda ) {} + bool isContainer() const override { return true; } + }; + template <typename L> struct BoundFlagLambda : BoundFlagRefBase { L m_lambda; @@ -447,12 +472,23 @@ namespace Catch { m_ref( ref ) {} public: - template <typename T> + template <typename LambdaT> + ParserRefImpl( accept_many_t, + LambdaT const& ref, + std::string const& hint ): + m_ref( std::make_shared<BoundManyLambda<LambdaT>>( ref ) ), + m_hint( hint ) {} + + template <typename T, + typename = typename std::enable_if_t< + !Detail::is_unary_function<T>::value>> ParserRefImpl( T& ref, std::string const& hint ): m_ref( std::make_shared<BoundValueRef<T>>( ref ) ), m_hint( hint ) {} - template <typename LambdaT> + template <typename LambdaT, + typename = typename std::enable_if_t< + Detail::is_unary_function<LambdaT>::value>> ParserRefImpl( LambdaT const& ref, std::string const& hint ): m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ), m_hint( hint ) {} @@ -513,13 +549,21 @@ namespace Catch { explicit Opt(bool& ref); + template <typename LambdaT, + typename = typename std::enable_if_t< + Detail::is_unary_function<LambdaT>::value>> + Opt( LambdaT const& ref, std::string const& hint ): + ParserRefImpl( ref, hint ) {} + template <typename LambdaT> - Opt(LambdaT const& ref, std::string const& hint) : - ParserRefImpl(ref, hint) {} + Opt( accept_many_t, LambdaT const& ref, std::string const& hint ): + ParserRefImpl( accept_many, ref, hint ) {} - template <typename T> - Opt(T& ref, std::string const& hint) : - ParserRefImpl(ref, hint) {} + template <typename T, + typename = typename std::enable_if_t< + !Detail::is_unary_function<T>::value>> + Opt( T& ref, std::string const& hint ): + ParserRefImpl( ref, hint ) {} auto operator[](std::string const& optName) -> Opt& { m_optNames.push_back(optName); @@ -544,12 +588,6 @@ namespace Catch { 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); diff --git a/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp b/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp deleted file mode 100644 index b78d190498d519da2ed12db622fd75a89b4464a6..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp +++ /dev/null @@ -1,237 +0,0 @@ - -// 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 _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 index 0cb160e06c5362c63816f7860d56fd388a265c53..fda4b2bd55bbfc221f505993ad4e7238089ec713 100644 --- a/packages/Catch2/src/catch2/internal/catch_commandline.cpp +++ b/packages/Catch2/src/catch2/internal/catch_commandline.cpp @@ -7,14 +7,16 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_commandline.hpp> +#include <catch2/internal/catch_compiler_capabilities.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 <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_reporter_spec_parser.hpp> #include <fstream> -#include <ctime> +#include <string> namespace Catch { @@ -23,25 +25,21 @@ namespace Catch { 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 ); + if ( warning == "NoAssertions" ) { + config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::NoAssertions); return ParserResult::ok( ParseResultType::Matched ); - }; + } else if ( warning == "UnmatchedTestSpec" ) { + config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::UnmatchedTestSpec); + return ParserResult::ok( ParseResultType::Matched ); + } + + return ParserResult ::runtimeError( + "Unrecognised warning option: '" + warning + '\'' ); + }; 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 + "'" ); + return ParserResult::runtimeError( "Unable to load input file: '" + filename + '\'' ); std::string line; while( std::getline( f, line ) ) { @@ -67,28 +65,53 @@ namespace Catch { else if( startsWith( "random", order ) ) config.runOrder = TestRunOrder::Randomized; else - return ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); + 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 ); + if( seed == "time" ) { + config.rngSeed = generateRandomSeed(GenerateFrom::Time); + return ParserResult::ok(ParseResultType::Matched); + } else if (seed == "random-device") { + config.rngSeed = generateRandomSeed(GenerateFrom::RandomDevice); + return ParserResult::ok(ParseResultType::Matched); + } + + CATCH_TRY { + std::size_t parsedTo = 0; + unsigned long parsedSeed = std::stoul(seed, &parsedTo, 0); + if (parsedTo != seed.size()) { + return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + } + + // TODO: Ideally we could parse unsigned int directly, + // but the stdlib doesn't provide helper for that + // type. After this is refactored to use fixed size + // type, we should check the parsed value is in range + // of the underlying type. + config.rngSeed = static_cast<unsigned int>(parsedSeed); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + } }; + auto const setDefaultColourMode = [&]( std::string const& colourMode ) { + Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode )); + if ( !maybeMode ) { + return ParserResult::runtimeError( + "colour mode must be one of: default, ansi, win32, " + "or none. '" + + colourMode + "' is not recognised" ); + } + auto mode = *maybeMode; + if ( !isColourImplAvailable( mode ) ) { + return ParserResult::runtimeError( + "colour mode '" + colourMode + + "' is not supported in this binary" ); + } + config.defaultColourMode = mode; + return ParserResult::ok( ParseResultType::Matched ); + }; auto const setWaitForKeypress = [&]( std::string const& keypress ) { auto keypressLc = toLower( keypress ); if (keypressLc == "never") @@ -112,31 +135,95 @@ namespace Catch { else if( lcVerbosity == "high" ) config.verbosity = Verbosity::High; else - return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); + 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 const setReporter = [&]( std::string const& userReporterSpec ) { + if ( userReporterSpec.empty() ) { + return ParserResult::runtimeError( "Received empty reporter spec." ); + } - auto lcReporter = toLower( reporter ); - auto result = factories.find( lcReporter ); + Optional<ReporterSpec> parsed = + parseReporterSpec( userReporterSpec ); + if ( !parsed ) { + return ParserResult::runtimeError( + "Could not parse reporter spec '" + userReporterSpec + + "'" ); + } + + auto const& reporterSpec = *parsed; + + IReporterRegistry::FactoryMap const& factories = + getRegistryHub().getReporterRegistry().getFactories(); + auto result = factories.find( reporterSpec.name() ); + + if ( result == factories.end() ) { + return ParserResult::runtimeError( + "Unrecognized reporter, '" + reporterSpec.name() + + "'. Check available with --list-reporters" ); + } + + + const bool hadOutputFile = reporterSpec.outputFile().some(); + config.reporterSpecifications.push_back( CATCH_MOVE( *parsed ) ); + // It would be enough to check this only once at the very end, but + // there is not a place where we could call this check, so do it + // every time it could fail. For valid inputs, this is still called + // at most once. + if (!hadOutputFile) { + int n_reporters_without_file = 0; + for (auto const& spec : config.reporterSpecifications) { + if (spec.outputFile().none()) { + n_reporters_without_file++; + } + } + if (n_reporters_without_file > 1) { + return ParserResult::runtimeError( "Only one reporter may have unspecified output file." ); + } + } - 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 const setShardCount = [&]( std::string const& shardCount ) { + CATCH_TRY{ + std::size_t parsedTo = 0; + int64_t parsedCount = std::stoll(shardCount, &parsedTo, 0); + if (parsedTo != shardCount.size()) { + return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + } + if (parsedCount <= 0) { + return ParserResult::runtimeError("Shard count must be a positive number"); + } + + config.shardCount = static_cast<unsigned int>(parsedCount); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + } + }; + + auto const setShardIndex = [&](std::string const& shardIndex) { + CATCH_TRY{ + std::size_t parsedTo = 0; + int64_t parsedIndex = std::stoll(shardIndex, &parsedTo, 0); + if (parsedTo != shardIndex.size()) { + return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + } + if (parsedIndex < 0) { + return ParserResult::runtimeError("Shard index must be a non-negative number"); + } + + config.shardIndex = static_cast<unsigned int>(parsedIndex); + return ParserResult::ok(ParseResultType::Matched); + } CATCH_CATCH_ANON(std::exception const&) { + return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + } + }; + 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" ) @@ -149,10 +236,10 @@ namespace Catch { | Opt( config.showInvisibles ) ["-i"]["--invisibles"] ( "show invisibles (tabs, newlines)" ) - | Opt( config.outputFilename, "filename" ) + | Opt( config.defaultOutputFilename, "filename" ) ["-o"]["--out"] - ( "output filename" ) - | Opt( setReporter, "name" ) + ( "default output filename" ) + | Opt( accept_many, setReporter, "name[::key=value]*" ) ["-r"]["--reporter"] ( "reporter to use (defaults to console)" ) | Opt( config.name, "name" ) @@ -164,7 +251,7 @@ namespace Catch { | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) ["-x"]["--abortx"] ( "abort after x failures" ) - | Opt( setWarning, "warning name" ) + | Opt( accept_many, setWarning, "warning name" ) ["-w"]["--warn"] ( "enable warnings" ) | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) @@ -185,24 +272,36 @@ namespace Catch { | Opt( setVerbosity, "quiet|normal|high" ) ["-v"]["--verbosity"] ( "set output verbosity" ) + | Opt( config.listTests ) + ["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["--list-tags"] + ( "list all/matching tags" ) | Opt( config.listReporters ) ["--list-reporters"] - ( "list all reporters" ) + ( "list all available reporters" ) + | Opt( config.listListeners ) + ["--list-listeners"] + ( "list all listeners" ) | Opt( setTestOrder, "decl|lex|rand" ) ["--order"] ( "test case order (defaults to decl)" ) - | Opt( setRngSeed, "'time'|number" ) + | Opt( setRngSeed, "'time'|'random-device'|number" ) ["--rng-seed"] ( "set a specific seed for random numbers" ) - | Opt( setColourUsage, "yes|no" ) - ["--use-colour"] - ( "should output be colourised" ) + | Opt( setDefaultColourMode, "ansi|win32|none|default" ) + ["--colour-mode"] + ( "what color mode should be used as default" ) | 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.skipBenchmarks) + ["--skip-benchmarks"] + ( "disable running benchmarks") | Opt( config.benchmarkSamples, "samples" ) ["--benchmark-samples"] ( "number of samples to collect (default: 100)" ) @@ -218,6 +317,15 @@ namespace Catch { | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) ["--benchmark-warmup-time"] ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Opt( setShardCount, "shard count" ) + ["--shard-count"] + ( "split the tests to execute into this many groups" ) + | Opt( setShardIndex, "shard index" ) + ["--shard-index"] + ( "index of the group of tests to execute (see --shard-count)" ) | + Opt( config.allowZeroTests ) + ["--allow-running-no-tests"] + ( "Treat 'No tests run' as a success" ) | Arg( config.testsOrTags, "test name|pattern|tags" ) ( "which test or tests to use" ); diff --git a/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp index 0684050b921cf3502ee531cfaa1554cb594cd5b4..85477ec23d0b5d143a94eb965921a98c3bececda 100644 --- a/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp @@ -25,6 +25,7 @@ // can be combined, en-mass, with the _NO_ forms later. #include <catch2/internal/catch_platform.hpp> +#include <catch2/catch_user_config.hpp> #ifdef __cplusplus @@ -56,11 +57,23 @@ #endif +#if defined(__CUDACC__) && !defined(__clang__) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic pop" ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "nv_diag_suppress 177" ) +#endif + +// clang-cl defines _MSC_VER as well as __clang__, which could cause the +// start/stop internal suppression macros to be double defined. #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" ) +#endif // __clang__ && !_MSC_VER + +#if defined(__clang__) + // 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 @@ -115,7 +128,6 @@ #ifdef __OS400__ # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE #endif //////////////////////////////////////////////////////////////////////////////// @@ -162,8 +174,8 @@ // 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 +# if defined(CATCH_PLATFORM_WINDOWS_UWP) +# define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 # else # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH # endif @@ -205,7 +217,7 @@ #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 + #define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 #endif #if !defined(_GLIBCXX_USE_C99_MATH_TR1) @@ -287,7 +299,9 @@ # define CATCH_CONFIG_NEW_CAPTURE #endif -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#if !defined( CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED ) && \ + !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) && \ + !defined( CATCH_CONFIG_NO_DISABLE_EXCEPTIONS ) # define CATCH_CONFIG_DISABLE_EXCEPTIONS #endif @@ -355,4 +369,12 @@ #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #endif +#if defined( CATCH_PLATFORM_WINDOWS ) && \ + !defined( CATCH_CONFIG_COLOUR_WIN32 ) && \ + !defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) && \ + !defined( CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 ) +# define CATCH_CONFIG_COLOUR_WIN32 +#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 index 199c937598b5f725a476d6fe7d669714d42ef3de..670af2d55c444d16bb01828735f226097eb5703b 100644 --- a/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp +++ b/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp @@ -17,6 +17,8 @@ #ifndef CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED #define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED +#include <catch2/catch_user_config.hpp> + #if defined(__ANDROID__) # define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE #endif diff --git a/packages/Catch2/src/catch2/internal/catch_console_colour.cpp b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp index e524b0baf97a7987d48be20364ef93b5615736ab..c77e8295182e1da15f8f89e3457b4521a0e19276 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_colour.cpp +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp @@ -15,59 +15,114 @@ #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_istream.hpp> +#include <catch2/internal/catch_move_and_forward.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 <catch2/internal/catch_compiler_capabilities.hpp> +#include <cassert> #include <ostream> +#include <utility> namespace Catch { - namespace { - struct IColourImpl { - virtual ~IColourImpl() = default; - virtual void use( Colour::Code _colourCode ) = 0; - }; + ColourImpl::~ColourImpl() = default; - struct NoColourImpl : IColourImpl { - void use( Colour::Code ) override {} + ColourImpl::ColourGuard ColourImpl::guardColour( Colour::Code colourCode ) { + return ColourGuard(colourCode, this ); + } - static IColourImpl* instance() { - static NoColourImpl s_instance; - return &s_instance; - } + void ColourImpl::ColourGuard::engageImpl( std::ostream& stream ) { + assert( &stream == &m_colourImpl->m_stream->stream() && + "Engaging colour guard for different stream than used by the " + "parent colour implementation" ); + static_cast<void>( stream ); + + m_engaged = true; + m_colourImpl->use( m_code ); + } + + ColourImpl::ColourGuard::ColourGuard( Colour::Code code, + ColourImpl const* colour ): + m_colourImpl( colour ), m_code( code ) { + } + ColourImpl::ColourGuard::ColourGuard( ColourGuard&& rhs ) noexcept: + m_colourImpl( rhs.m_colourImpl ), + m_code( rhs.m_code ), + m_engaged( rhs.m_engaged ) { + rhs.m_engaged = false; + } + ColourImpl::ColourGuard& + ColourImpl::ColourGuard::operator=( ColourGuard&& rhs ) noexcept { + using std::swap; + swap( m_colourImpl, rhs.m_colourImpl ); + swap( m_code, rhs.m_code ); + swap( m_engaged, rhs.m_engaged ); + + return *this; + } + ColourImpl::ColourGuard::~ColourGuard() { + if ( m_engaged ) { + m_colourImpl->use( Colour::None ); + } + } + + ColourImpl::ColourGuard& + ColourImpl::ColourGuard::engage( std::ostream& stream ) & { + engageImpl( stream ); + return *this; + } + + ColourImpl::ColourGuard&& + ColourImpl::ColourGuard::engage( std::ostream& stream ) && { + engageImpl( stream ); + return CATCH_MOVE(*this); + } + + namespace { + //! A do-nothing implementation of colour, used as fallback for unknown + //! platforms, and when the user asks to deactivate all colours. + class NoColourImpl : public ColourImpl { + public: + NoColourImpl( IStream* stream ): ColourImpl( stream ) {} + + private: + void use( Colour::Code ) const override {} }; + } // namespace - } // 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 +} // namespace Catch -#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// +#if defined ( CATCH_CONFIG_COLOUR_WIN32 ) ///////////////////////////////////////// namespace Catch { namespace { - class Win32ColourImpl : public IColourImpl { + class Win32ColourImpl : public ColourImpl { public: - Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) - { + Win32ColourImpl(IStream* stream): + ColourImpl(stream) { CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); + GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), + &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 { + static bool useImplementationForStream(IStream const& stream) { + // Win32 text colour APIs can only be used on console streams + // We cannot check that the output hasn't been redirected, + // so we just check that the original stream is console stream. + return stream.isConsole(); + } + + private: + void use( Colour::Code _colourCode ) const override { switch( _colourCode ) { case Colour::None: return setTextAttribute( originalForegroundAttributes ); case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); @@ -91,45 +146,63 @@ namespace { } } - private: - void setTextAttribute( WORD _textAttribute ) { - SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); + void setTextAttribute( WORD _textAttribute ) const { + SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), + _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 ) ////////////////////////////////////// +#endif // Windows/ ANSI/ None + -#include <unistd.h> +#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC ) +# define CATCH_INTERNAL_HAS_ISATTY +# include <unistd.h> +#endif 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 { + class ANSIColourImpl : public ColourImpl { public: - void use( Colour::Code _colourCode ) override { + ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {} + + static bool useImplementationForStream(IStream const& stream) { + // This is kinda messy due to trying to support a bunch of + // different platforms at once. + // The basic idea is that if we are asked to do autodetection (as + // opposed to being told to use posixy colours outright), then we + // only want to use the colours if we are writing to console. + // However, console might be redirected, so we make an attempt at + // checking for that on platforms where we know how to do that. + bool useColour = stream.isConsole(); +#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \ + !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) ) + ErrnoGuard _; // for isatty + useColour = useColour && isatty( STDOUT_FILENO ); +# endif +# if defined( CATCH_PLATFORM_MAC ) || defined( CATCH_PLATFORM_IPHONE ) + useColour = useColour && !isDebuggerActive(); +# endif + + return useColour; + } + + private: + void use( Colour::Code _colourCode ) const override { + auto setColour = [&out = + m_stream->stream()]( char const* escapeCode ) { + // The escape sequence must be flushed to console, otherwise + // if stdin and stderr are intermixed, we'd get accidentally + // coloured output. + out << '\033' << escapeCode << std::flush; + }; switch( _colourCode ) { case Colour::None: case Colour::White: return setColour( "[0m" ); @@ -150,89 +223,56 @@ namespace { 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 + Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection, + IStream* stream ) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + if ( implSelection == ColourMode::Win32 ) { + return Detail::make_unique<Win32ColourImpl>( stream ); + } +#endif + if ( implSelection == ColourMode::ANSI ) { + return Detail::make_unique<ANSIColourImpl>( stream ); + } + if ( implSelection == ColourMode::None ) { + return Detail::make_unique<NoColourImpl>( stream ); + } -namespace Catch { + if ( implSelection == ColourMode::PlatformDefault) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + if ( Win32ColourImpl::useImplementationForStream( *stream ) ) { + return Detail::make_unique<Win32ColourImpl>( stream ); + } +#endif + if ( ANSIColourImpl::useImplementationForStream( *stream ) ) { + return Detail::make_unique<ANSIColourImpl>( stream ); + } + return Detail::make_unique<NoColourImpl>( stream ); + } - 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; + CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(implSelection) ); } - 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 ); + bool isColourImplAvailable( ColourMode colourSelection ) { + switch ( colourSelection ) { +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + case ColourMode::Win32: +#endif + case ColourMode::ANSI: + case ColourMode::None: + case ColourMode::PlatformDefault: + return true; + default: + return false; } } - std::ostream& operator << ( std::ostream& os, Colour const& ) { - return os; - } } // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_console_colour.hpp b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp index 7b102013c8a0295089cc81b9be1339f5a56b09fd..aa3d83a28e8fe82ec16719b3a69f71357512104d 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_colour.hpp +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp @@ -8,10 +8,16 @@ #ifndef CATCH_CONSOLE_COLOUR_HPP_INCLUDED #define CATCH_CONSOLE_COLOUR_HPP_INCLUDED +#include <catch2/internal/catch_unique_ptr.hpp> + #include <iosfwd> +#include <cstdint> namespace Catch { + enum class ColourMode : std::uint8_t; + class IStream; + struct Colour { enum Code { None = 0, @@ -48,22 +54,86 @@ namespace Catch { SecondaryText = LightGrey, Headers = White }; + }; - // Use constructed object for RAII guard - Colour( Code _colourCode ); - Colour( Colour&& other ) noexcept; - Colour& operator=( Colour&& other ) noexcept; - ~Colour(); + class ColourImpl { + protected: + //! The associated stream of this ColourImpl instance + IStream* m_stream; + public: + ColourImpl( IStream* stream ): m_stream( stream ) {} + + //! RAII wrapper around writing specific colour of text using specific + //! colour impl into a stream. + class ColourGuard { + ColourImpl const* m_colourImpl; + Colour::Code m_code; + bool m_engaged = false; + + public: + //! Does **not** engage the guard/start the colour + ColourGuard( Colour::Code code, + ColourImpl const* colour ); + + ColourGuard( ColourGuard const& rhs ) = delete; + ColourGuard& operator=( ColourGuard const& rhs ) = delete; + + ColourGuard( ColourGuard&& rhs ) noexcept; + ColourGuard& operator=( ColourGuard&& rhs ) noexcept; + + //! Removes colour _if_ the guard was engaged + ~ColourGuard(); + + /** + * Explicitly engages colour for given stream. + * + * The API based on operator<< should be preferred. + */ + ColourGuard& engage( std::ostream& stream ) &; + /** + * Explicitly engages colour for given stream. + * + * The API based on operator<< should be preferred. + */ + ColourGuard&& engage( std::ostream& stream ) &&; + + private: + //! Engages the guard and starts using colour + friend std::ostream& operator<<( std::ostream& lhs, + ColourGuard& guard ) { + guard.engageImpl( lhs ); + return lhs; + } + //! Engages the guard and starts using colour + friend std::ostream& operator<<( std::ostream& lhs, + ColourGuard&& guard) { + guard.engageImpl( lhs ); + return lhs; + } + + void engageImpl( std::ostream& stream ); - // Use static method for one-shot changes - static void use( Code _colourCode ); + }; - private: - bool m_moved = false; + virtual ~ColourImpl(); // = default + /** + * Creates a guard object for given colour and this colour impl + * + * **Important:** + * the guard starts disengaged, and has to be engaged explicitly. + */ + ColourGuard guardColour( Colour::Code colourCode ); - friend std::ostream& operator << (std::ostream& os, Colour const&); + private: + virtual void use( Colour::Code colourCode ) const = 0; }; + //! Provides ColourImpl based on global config and target compilation platform + Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection, + IStream* stream ); + + //! Checks if specific colour impl has been compiled into the binary + bool isColourImplAvailable( ColourMode colourSelection ); } // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_console_width.hpp b/packages/Catch2/src/catch2/internal/catch_console_width.hpp index 52ef0f0ee7c1d7ce8d789cf3bb7ee9cbcdcdf2a6..7156ec4eea844bf5a93d853daf1aa74bca470e1d 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_width.hpp +++ b/packages/Catch2/src/catch2/internal/catch_console_width.hpp @@ -8,8 +8,12 @@ #ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED #define CATCH_CONSOLE_WIDTH_HPP_INCLUDED +// This include must be kept so that user's configured value for CONSOLE_WIDTH +// is used before we attempt to provide a default value +#include <catch2/catch_user_config.hpp> + #ifndef CATCH_CONFIG_CONSOLE_WIDTH #define CATCH_CONFIG_CONSOLE_WIDTH 80 #endif -#endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED \ No newline at end of file +#endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_context.cpp b/packages/Catch2/src/catch2/internal/catch_context.cpp index 790a1b23d62273f5ea2d8ccab8e76ae461b6371f..6811b092f172d4d83914bffade7829105a305994 100644 --- a/packages/Catch2/src/catch2/internal/catch_context.cpp +++ b/packages/Catch2/src/catch2/internal/catch_context.cpp @@ -55,7 +55,7 @@ namespace Catch { Context::~Context() = default; - SimplePcg32& rng() { + SimplePcg32& sharedRng() { 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 index d3552448222247500d5cc67542116ae32b5562ce..fe1297056054e6d846e6affb32c6389aeba64a9b 100644 --- a/packages/Catch2/src/catch2/internal/catch_context.hpp +++ b/packages/Catch2/src/catch2/internal/catch_context.hpp @@ -10,20 +10,20 @@ namespace Catch { - struct IResultCapture; - struct IConfig; + class IResultCapture; + class IConfig; - struct IContext - { + class IContext { + public: virtual ~IContext(); // = default virtual IResultCapture* getResultCapture() = 0; virtual IConfig const* getConfig() const = 0; }; - struct IMutableContext : IContext - { - virtual ~IMutableContext(); // = default + class IMutableContext : public IContext { + public: + ~IMutableContext() override; // = default virtual void setResultCapture( IResultCapture* resultCapture ) = 0; virtual void setConfig( IConfig const* config ) = 0; @@ -50,7 +50,7 @@ namespace Catch { void cleanUpContext(); class SimplePcg32; - SimplePcg32& rng(); + SimplePcg32& sharedRng(); } #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 index 5942524eb41163d677b22ea26f59b95749d8c17b..5564c6a8847cd46dd2b4ad493246175de0771d61 100644 --- a/packages/Catch2/src/catch2/internal/catch_debug_console.cpp +++ b/packages/Catch2/src/catch2/internal/catch_debug_console.cpp @@ -5,11 +5,16 @@ // 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> +#include <catch2/catch_user_config.hpp> +#include <catch2/internal/catch_stdstreams.hpp> + +#include <ostream> #if defined(CATCH_CONFIG_ANDROID_LOGWRITE) #include <android/log.h> diff --git a/packages/Catch2/src/catch2/internal/catch_debugger.cpp b/packages/Catch2/src/catch2/internal/catch_debugger.cpp index 3c80173a69c830fc6ab1c719bc98aa5b59d5c091..349cf4ab35412828cf821bbc4eec7e576ad1547c 100644 --- a/packages/Catch2/src/catch2/internal/catch_debugger.cpp +++ b/packages/Catch2/src/catch2/internal/catch_debugger.cpp @@ -7,8 +7,8 @@ // 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> +#include <catch2/internal/catch_stdstreams.hpp> #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) diff --git a/packages/Catch2/src/catch2/internal/catch_debugger.hpp b/packages/Catch2/src/catch2/internal/catch_debugger.hpp index c300da72cdb52169db4d36f45057768501b42f76..ede291d7fae9c433e7abc7933d84600e3cdbf90e 100644 --- a/packages/Catch2/src/catch2/internal/catch_debugger.hpp +++ b/packages/Catch2/src/catch2/internal/catch_debugger.hpp @@ -19,7 +19,7 @@ namespace Catch { #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ #elif defined(__aarch64__) - #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #define CATCH_TRAP() __asm__(".inst 0xd43e0000") #endif #elif defined(CATCH_PLATFORM_IPHONE) diff --git a/packages/Catch2/src/catch2/internal/catch_decomposer.cpp b/packages/Catch2/src/catch2/internal/catch_decomposer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a85695389593f908b15f0453fd25004b09dcee93 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_decomposer.cpp @@ -0,0 +1,23 @@ + +// 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_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; + } +} diff --git a/packages/Catch2/src/catch2/internal/catch_decomposer.hpp b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp index a747c34cd61a5b364749823d210f7d0b80e1870f..e7dd1e9a4292648672573c0fd47087b80fbda2d9 100644 --- a/packages/Catch2/src/catch2/internal/catch_decomposer.hpp +++ b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp @@ -33,7 +33,11 @@ namespace Catch { - struct ITransientExpression { + class ITransientExpression { + bool m_isBinaryExpression; + bool m_result; + + public: auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } auto getResult() const -> bool { return m_result; } virtual void streamReconstructedExpression( std::ostream &os ) const = 0; @@ -51,8 +55,6 @@ namespace Catch { // 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; diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.cpp b/packages/Catch2/src/catch2/internal/catch_enforce.cpp index 3f4962cbfac07209657f34bfd70f32e6d2fd285a..4bc47ce3d3d91ed98a9bbb8d57c706448b358ffb 100644 --- a/packages/Catch2/src/catch2/internal/catch_enforce.cpp +++ b/packages/Catch2/src/catch2/internal/catch_enforce.cpp @@ -6,6 +6,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_stdstreams.hpp> #include <stdexcept> diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.hpp b/packages/Catch2/src/catch2/internal/catch_enforce.hpp index 3f81ef1a03a235d01cdbbb02e04bf183fae8e18b..db52a0e2d29450ce42f3904a63f231eb5c0cb04a 100644 --- a/packages/Catch2/src/catch2/internal/catch_enforce.hpp +++ b/packages/Catch2/src/catch2/internal/catch_enforce.hpp @@ -10,7 +10,7 @@ #include <catch2/internal/catch_source_line_info.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <exception> diff --git a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp index ef4baf9a994bc45f738fc49d7814a4fbd7b6b8cf..32d0a16d96ebe6807fb6da7a8da9e21d1610103c 100644 --- a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp @@ -7,7 +7,6 @@ // 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> diff --git a/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp b/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp new file mode 100644 index 0000000000000000000000000000000000000000..95c192df0120e7ff168149cbd42438761e78f617 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp @@ -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 + +#include <catch2/internal/catch_errno_guard.hpp> + +#include <cerrno> + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp index 9383257cecb51fc2e5762b94fc1f24df607292e8..3afd46f59fe0a352cf660afbdb0ae6f41b118017 100644 --- a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp @@ -30,6 +30,7 @@ #include <catch2/internal/catch_enforce.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp> +#include <catch2/internal/catch_stdstreams.hpp> #include <algorithm> @@ -40,7 +41,7 @@ namespace Catch { // If neither SEH nor signal handling is required, the handler impls // do not have to do anything, and can be empty. void FatalConditionHandler::engage_platform() {} - void FatalConditionHandler::disengage_platform() {} + void FatalConditionHandler::disengage_platform() noexcept {} FatalConditionHandler::FatalConditionHandler() = default; FatalConditionHandler::~FatalConditionHandler() = default; @@ -78,13 +79,13 @@ namespace Catch { // 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" }, + { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, + { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, + { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, + { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, }; - static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { + static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) { for (auto const& def : signalDefs) { if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { reportFatal(def.name); @@ -98,7 +99,7 @@ namespace Catch { // Since we do not support multiple instantiations, we put these // into global variables and rely on cleaning them up in outlined // constructors/destructors - static PVOID exceptionHandlerHandle = nullptr; + static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr; // For MSVC, we reserve part of the stack memory for handling @@ -120,18 +121,17 @@ namespace Catch { void FatalConditionHandler::engage_platform() { - // Register as first handler in current chain - exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); - if (!exceptionHandlerHandle) { - CATCH_RUNTIME_ERROR("Could not register vectored exception handler"); - } + // Register as a the top level exception filter. + previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter); } - void FatalConditionHandler::disengage_platform() { - if (!RemoveVectoredExceptionHandler(exceptionHandlerHandle)) { - CATCH_RUNTIME_ERROR("Could not unregister vectored exception handler"); + void FatalConditionHandler::disengage_platform() noexcept { + if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) { + Catch::cerr() + << "Unexpected SEH unhandled exception filter on disengage." + << " The filter was restored, but might be rolled back unexpectedly."; } - exceptionHandlerHandle = nullptr; + previousTopLevelExceptionFilter = nullptr; } } // end namespace Catch @@ -171,7 +171,7 @@ namespace Catch { static stack_t oldSigStack{}; static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{}; - static void restorePreviousSignalHandlers() { + static void restorePreviousSignalHandlers() noexcept { // We set signal handlers back to the previous ones. Hopefully // nobody overwrote them in the meantime, and doesn't expect // their signal handlers to live past ours given that they @@ -234,7 +234,7 @@ namespace Catch { #endif - void FatalConditionHandler::disengage_platform() { + void FatalConditionHandler::disengage_platform() noexcept { restorePreviousSignalHandlers(); } diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp index 4a2818cb567b4c427bc224e945a8509db06fc0bd..389dab5d4c13ef9b63a08ff87294e3d347139147 100644 --- a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp @@ -32,7 +32,7 @@ namespace Catch { // Should be if-defed to work on current platform, can assume // engage-disengage 1:1 pairing. void engage_platform(); - void disengage_platform(); + void disengage_platform() noexcept; public: // Should also have platform-specific implementations as needed FatalConditionHandler(); @@ -44,7 +44,7 @@ namespace Catch { engage_platform(); } - void disengage() { + void disengage() noexcept { assert(m_started && "Handler cannot be uninstalled without being installed first"); m_started = false; disengage_platform(); diff --git a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp index 3e73b3a72314a1e7bb8b8ad2b42ba24ed2cb6d27..f121281390c745440f0303ddb79fefc898b7642c 100644 --- a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp +++ b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp @@ -10,6 +10,7 @@ #include <catch2/internal/catch_polyfills.hpp> +#include <cassert> #include <cmath> #include <cstdint> #include <utility> @@ -24,6 +25,15 @@ namespace Catch { } // end namespace Detail + +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic push + // We do a bunch of direct compensations of floating point numbers, + // because we know what we are doing and actually do want the direct + // comparison behaviour. +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + /** * Calculates the ULP distance between two floating point numbers * @@ -83,6 +93,11 @@ namespace Catch { return lc - rc; } +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic pop +#endif + + } // end namespace Catch #endif // CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_stream.cpp b/packages/Catch2/src/catch2/internal/catch_istream.cpp similarity index 58% rename from packages/Catch2/src/catch2/internal/catch_stream.cpp rename to packages/Catch2/src/catch2/internal/catch_istream.cpp index 9890ae3a5df5a8b544eb235d98aa4cfe073039c7..4cd3505847e4045359eae043df1d06d38e7c90bb 100644 --- a/packages/Catch2/src/catch2/internal/catch_stream.cpp +++ b/packages/Catch2/src/catch2/internal/catch_istream.cpp @@ -5,15 +5,14 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 + +#include <catch2/internal/catch_istream.hpp> #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 <catch2/internal/catch_stdstreams.hpp> #include <cstdio> -#include <iostream> #include <fstream> #include <sstream> #include <vector> @@ -34,7 +33,7 @@ namespace Detail { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() noexcept { + ~StreamBufImpl() noexcept override { StreamBufImpl::sync(); } @@ -74,15 +73,15 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// class FileStream : public IStream { - mutable std::ofstream m_ofs; + std::ofstream m_ofs; public: FileStream( std::string const& filename ) { m_ofs.open( filename.c_str() ); - CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); + CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' ); } ~FileStream() override = default; public: // IStream - std::ostream& stream() const override { + std::ostream& stream() override { return m_ofs; } }; @@ -90,7 +89,7 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// class CoutStream : public IStream { - mutable std::ostream m_os; + std::ostream m_os; public: // Store the streambuf from cout up-front because // cout may get redirected when running tests @@ -98,14 +97,29 @@ namespace Detail { ~CoutStream() override = default; public: // IStream - std::ostream& stream() const override { return m_os; } + std::ostream& stream() override { return m_os; } + bool isConsole() const override { return true; } + }; + + class CerrStream : public IStream { + std::ostream m_os; + + public: + // Store the streambuf from cerr up-front because + // cout may get redirected when running tests + CerrStream(): m_os( Catch::cerr().rdbuf() ) {} + ~CerrStream() override = default; + + public: // IStream + std::ostream& stream() override { return m_os; } + bool isConsole() const override { return true; } }; /////////////////////////////////////////////////////////////////////////// class DebugOutStream : public IStream { Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; - mutable std::ostream m_os; + std::ostream m_os; public: DebugOutStream() : m_streamBuf( Detail::make_unique<StreamBufImpl<OutputDebugWriter>>() ), @@ -115,7 +129,7 @@ namespace Detail { ~DebugOutStream() override = default; public: // IStream - std::ostream& stream() const override { return m_os; } + std::ostream& stream() override { return m_os; } }; } // unnamed namespace @@ -123,70 +137,22 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// - auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream const> { - if( filename.empty() ) + auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream> { + if ( filename.empty() || filename == "-" ) { return Detail::make_unique<Detail::CoutStream>(); - else if( filename[0] == '%' ) { - if( filename == "%debug" ) - return Detail::make_unique<Detail::DebugOutStream>(); - else - CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); } - else - return Detail::make_unique<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::make_unique<std::ostringstream>() ); - return m_streams.size()-1; - } - else { - auto index = m_unused.back(); - m_unused.pop_back(); - return index; + if( filename[0] == '%' ) { + if ( filename == "%debug" ) { + return Detail::make_unique<Detail::DebugOutStream>(); + } else if ( filename == "%stderr" ) { + return Detail::make_unique<Detail::CerrStream>(); + } else if ( filename == "%stdout" ) { + return Detail::make_unique<Detail::CoutStream>(); + } else { + CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' ); } } - - 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(); + return Detail::make_unique<Detail::FileStream>( filename ); } - 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_istream.hpp b/packages/Catch2/src/catch2/internal/catch_istream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..629816c806cbd97654377fe7039f36ea11ac39ce --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_istream.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_ISTREAM_HPP_INCLUDED +#define CATCH_ISTREAM_HPP_INCLUDED + +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <iosfwd> +#include <cstddef> +#include <ostream> +#include <string> + +namespace Catch { + + class IStream { + public: + virtual ~IStream(); // = default + virtual std::ostream& stream() = 0; + /** + * Best guess on whether the instance is writing to a console (e.g. via stdout/stderr) + * + * This is useful for e.g. Win32 colour support, because the Win32 + * API manipulates console directly, unlike POSIX escape codes, + * that can be written anywhere. + * + * Due to variety of ways to change where the stdout/stderr is + * _actually_ being written, users should always assume that + * the answer might be wrong. + */ + virtual bool isConsole() const { return false; } + }; + + /** + * Creates a stream wrapper that writes to specific file. + * + * Also recognizes 4 special filenames + * * `-` for stdout + * * `%stdout` for stdout + * * `%stderr` for stderr + * * `%debug` for platform specific debugging output + * + * \throws if passed an unrecognized %-prefixed stream + */ + auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream>; + +} + +#endif // CATCH_STREAM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp b/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96ecf5c333476b32a76236bd50df76a02e30f770 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp @@ -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 + +#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_lazy_expr.hpp b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp index e69a72ef30d4918b2e93dbb32a363443cfd3b9f8..d4aa79d7be389e7716951fb190e3506f433f9219 100644 --- a/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp +++ b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp @@ -12,7 +12,7 @@ namespace Catch { - struct ITransientExpression; + class ITransientExpression; class LazyExpression { friend class AssertionHandler; diff --git a/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp b/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c9abbdfcdd1bc186b9f6bc3a091162f09fbf9678 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp @@ -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 + +#include <catch2/internal/catch_leak_detector.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/catch_user_config.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(); +} diff --git a/packages/Catch2/src/catch2/internal/catch_list.cpp b/packages/Catch2/src/catch2/internal/catch_list.cpp index 20613c70798b6e3f0e08cd4bfd58e1374a13f205..2c22745cefbc487d5f9993625569c604f502bc37 100644 --- a/packages/Catch2/src/catch2/internal/catch_list.cpp +++ b/packages/Catch2/src/catch2/internal/catch_list.cpp @@ -13,6 +13,7 @@ #include <catch2/interfaces/catch_interfaces_testcase.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_case_insensitive_comparisons.hpp> #include <catch2/internal/catch_context.hpp> #include <catch2/catch_config.hpp> @@ -22,22 +23,22 @@ namespace Catch { namespace { - void listTests(IStreamingReporter& reporter, IConfig const& config) { + void listTests(IEventListener& 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) { + void listTags(IEventListener& reporter, IConfig const& config) { auto const& testSpec = config.testSpec(); std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); - std::map<StringRef, TagInfo> tagCounts; + std::map<StringRef, TagInfo, Detail::CaseInsensitiveLess> tagCounts; for (auto const& testCase : matchedTestCases) { for (auto const& tagName : testCase.getTestCaseInfo().tags) { - auto it = tagCounts.find(tagName.lowerCased); + auto it = tagCounts.find(tagName.original); if (it == tagCounts.end()) - it = tagCounts.insert(std::make_pair(tagName.lowerCased, TagInfo())).first; + it = tagCounts.insert(std::make_pair(tagName.original, TagInfo())).first; it->second.add(tagName.original); } } @@ -50,7 +51,7 @@ namespace Catch { reporter.listTags(infos); } - void listReporters(IStreamingReporter& reporter) { + void listReporters(IEventListener& reporter) { std::vector<ReporterDescription> descriptions; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); @@ -62,6 +63,19 @@ namespace Catch { reporter.listReporters(descriptions); } + void listListeners(IEventListener& reporter) { + std::vector<ListenerDescription> descriptions; + + auto const& factories = + getRegistryHub().getReporterRegistry().getListeners(); + descriptions.reserve( factories.size() ); + for ( auto const& fac : factories ) { + descriptions.push_back( { fac->getName(), fac->getDescription() } ); + } + + reporter.listListeners( descriptions ); + } + } // end anonymous namespace void TagInfo::add( StringRef spelling ) { @@ -85,7 +99,7 @@ namespace Catch { return out; } - bool list( IStreamingReporter& reporter, Config const& config ) { + bool list( IEventListener& reporter, Config const& config ) { bool listed = false; if (config.listTests()) { listed = true; @@ -99,6 +113,10 @@ namespace Catch { listed = true; listReporters(reporter); } + if ( config.listListeners() ) { + listed = true; + listListeners( reporter ); + } return listed; } diff --git a/packages/Catch2/src/catch2/internal/catch_list.hpp b/packages/Catch2/src/catch2/internal/catch_list.hpp index 2d1952c5950357b60ab9b60cf410457dbcbb98cc..6fd759ea2f847130477f3f6427c7a9dd4265975a 100644 --- a/packages/Catch2/src/catch2/internal/catch_list.hpp +++ b/packages/Catch2/src/catch2/internal/catch_list.hpp @@ -16,13 +16,17 @@ namespace Catch { - struct IStreamingReporter; + class IEventListener; class Config; struct ReporterDescription { std::string name, description; }; + struct ListenerDescription { + StringRef name; + std::string description; + }; struct TagInfo { void add(StringRef spelling); @@ -32,7 +36,7 @@ namespace Catch { std::size_t count = 0; }; - bool list( IStreamingReporter& reporter, Config const& config ); + bool list( IEventListener& reporter, Config const& config ); } // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_main.cpp b/packages/Catch2/src/catch2/internal/catch_main.cpp index ed89ab6eed5ca2564faac97d76eee23a7f51767f..a0126c231a008c51670a333c803085aac1ea051e 100644 --- a/packages/Catch2/src/catch2/internal/catch_main.cpp +++ b/packages/Catch2/src/catch2/internal/catch_main.cpp @@ -14,10 +14,13 @@ namespace Catch { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS - LeakDetector leakDetector; + static LeakDetector leakDetector; CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION } +// Allow users of amalgamated .cpp file to remove our main and provide their own. +#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN) + #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 __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) { @@ -32,3 +35,5 @@ int main (int argc, char * argv[]) { return Catch::Session().run( argc, argv ); } + +#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN diff --git a/packages/Catch2/src/catch2/internal/catch_message_info.cpp b/packages/Catch2/src/catch2/internal/catch_message_info.cpp new file mode 100644 index 0000000000000000000000000000000000000000..11127e3f690086d3c686720a4fc78174117f02f8 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_message_info.cpp @@ -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 + +#include <catch2/internal/catch_message_info.hpp> + +namespace Catch { + + MessageInfo::MessageInfo( StringRef _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 diff --git a/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp b/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp index 70520308f1a61459c55ba4b8e1463ce1f217eb25..01b7adae5decd5a7c80343a653d4067cbebf70ac 100644 --- a/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp +++ b/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp @@ -10,10 +10,10 @@ #include <type_traits> -//! TODO: replaces std::move for better performance +//! Replacement for std::move with better compile time performance #define CATCH_MOVE(...) static_cast<std::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__) +//! Replacement for std::forward with better compile time performance #define CATCH_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__) #endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED - \ No newline at end of file diff --git a/packages/Catch2/src/catch2/internal/catch_option.hpp b/packages/Catch2/src/catch2/internal/catch_optional.hpp similarity index 54% rename from packages/Catch2/src/catch2/internal/catch_option.hpp rename to packages/Catch2/src/catch2/internal/catch_optional.hpp index 04e4d69ec677d602727c2af9c076bebff0d3047e..86eca344ce331840c4b0d5645986eec3b4a59354 100644 --- a/packages/Catch2/src/catch2/internal/catch_option.hpp +++ b/packages/Catch2/src/catch2/internal/catch_optional.hpp @@ -5,28 +5,30 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_OPTION_HPP_INCLUDED -#define CATCH_OPTION_HPP_INCLUDED +#ifndef CATCH_OPTIONAL_HPP_INCLUDED +#define CATCH_OPTIONAL_HPP_INCLUDED + +#include <cassert> namespace Catch { // An optional type template<typename T> - class Option { + class Optional { public: - Option() : nullableValue( nullptr ) {} - Option( T const& _value ) + Optional() : nullableValue( nullptr ) {} + Optional( T const& _value ) : nullableValue( new( storage ) T( _value ) ) {} - Option( Option const& _other ) + Optional( Optional const& _other ) : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) {} - ~Option() { + ~Optional() { reset(); } - Option& operator= ( Option const& _other ) { + Optional& operator= ( Optional const& _other ) { if( &_other != this ) { reset(); if( _other ) @@ -34,7 +36,7 @@ namespace Catch { } return *this; } - Option& operator = ( T const& _value ) { + Optional& operator = ( T const& _value ) { reset(); nullableValue = new( storage ) T( _value ); return *this; @@ -46,10 +48,22 @@ namespace Catch { nullableValue = nullptr; } - T& operator*() { return *nullableValue; } - T const& operator*() const { return *nullableValue; } - T* operator->() { return nullableValue; } - const T* operator->() const { return nullableValue; } + T& operator*() { + assert(nullableValue); + return *nullableValue; + } + T const& operator*() const { + assert(nullableValue); + return *nullableValue; + } + T* operator->() { + assert(nullableValue); + return nullableValue; + } + const T* operator->() const { + assert(nullableValue); + return nullableValue; + } T valueOr( T const& defaultValue ) const { return nullableValue ? *nullableValue : defaultValue; @@ -63,6 +77,19 @@ namespace Catch { return some(); } + friend bool operator==(Optional const& a, Optional const& b) { + if (a.none() && b.none()) { + return true; + } else if (a.some() && b.some()) { + return *a == *b; + } else { + return false; + } + } + friend bool operator!=(Optional const& a, Optional const& b) { + return !( a == b ); + } + private: T *nullableValue; alignas(alignof(T)) char storage[sizeof(T)]; @@ -70,4 +97,4 @@ namespace Catch { } // end namespace Catch -#endif // CATCH_OPTION_HPP_INCLUDED +#endif // CATCH_OPTIONAL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp index 49cfaa0d3eb3ecd8aeed6ff16dd914415e769c0d..ae0601412762d0a59e4829288971db5739dc2a6f 100644 --- a/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_output_redirect.hpp> #include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_stdstreams.hpp> #include <cstdio> #include <cstring> diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp index 26334d165bb8e2105dd5104702fa13be77fda20c..d3463d992c0b957af0b56ad2fae580aed9ecbc8a 100644 --- a/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp @@ -9,7 +9,8 @@ #define CATCH_OUTPUT_REDIRECT_HPP_INCLUDED #include <catch2/internal/catch_platform.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> #include <cstdio> #include <iosfwd> diff --git a/packages/Catch2/src/catch2/internal/catch_platform.hpp b/packages/Catch2/src/catch2/internal/catch_platform.hpp index 8ecf01ad296f1115d18574cfad5b5963a69c80bc..01ee6cd9d39a56e1a7e186edf333aac479638ac2 100644 --- a/packages/Catch2/src/catch2/internal/catch_platform.hpp +++ b/packages/Catch2/src/catch2/internal/catch_platform.hpp @@ -24,6 +24,10 @@ #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) # define CATCH_PLATFORM_WINDOWS + +# if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP ) +# define CATCH_PLATFORM_WINDOWS_UWP +# endif #endif #endif // CATCH_PLATFORM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_polyfills.cpp b/packages/Catch2/src/catch2/internal/catch_polyfills.cpp new file mode 100644 index 0000000000000000000000000000000000000000..13e60f4a4d3195021ed2ecafdca53fb48739fcb4 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_polyfills.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/internal/catch_polyfills.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/catch_user_config.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 diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp index 00859b150a377d5b525f2bf1f8a4c71b506978bd..4292d0df592a84b821d142151da5717faf78c289 100644 --- a/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_PREPROCESSOR_HPP_INCLUDED #define CATCH_PREPROCESSOR_HPP_INCLUDED +#include <catch2/internal/catch_preprocessor_remove_parens.hpp> #if defined(__GNUC__) // We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work @@ -59,10 +60,6 @@ #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__ @@ -77,8 +74,6 @@ #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__)) diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8033789083416c1ec673a19e4534af837b5644ca --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.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_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED +#define CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED + +#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_REMOVE_PARENS( ... ) \ + INTERNAL_CATCH_EXPAND1( INTERNAL_CATCH_DEF __VA_ARGS__ ) + +#endif // CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7fc1b90d4bfe9bb1cd8c29b230d7783f4efa8123 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.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/internal/catch_random_seed_generation.hpp> + +#include <catch2/internal/catch_enforce.hpp> + +#include <ctime> +#include <random> + +namespace Catch { + + std::uint32_t generateRandomSeed( GenerateFrom from ) { + switch ( from ) { + case GenerateFrom::Time: + return static_cast<std::uint32_t>( std::time( nullptr ) ); + + case GenerateFrom::Default: + case GenerateFrom::RandomDevice: + // In theory, a platform could have random_device that returns just + // 16 bits. That is still some randomness, so we don't care too much + return static_cast<std::uint32_t>( std::random_device{}() ); + + default: + CATCH_ERROR("Unknown generation method"); + } + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..42ca93db7d83de2c1e381fdd429b91dca7c97e02 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.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_RANDOM_SEED_GENERATION_HPP_INCLUDED +#define CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + + enum class GenerateFrom { + Time, + RandomDevice, + //! Currently equivalent to RandomDevice, but can change at any point + Default + }; + + std::uint32_t generateRandomSeed(GenerateFrom from); + +} // end namespace Catch + +#endif // CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp index ee92ad7de024de325109a43cfbe8534e4533a43d..01b6b3a0ac9c935d20e140e8d0c8ea7d29099820 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp @@ -7,7 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_reporter_registry.hpp> -#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/reporters/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> @@ -17,36 +17,41 @@ #include <catch2/reporters/catch_reporter_teamcity.hpp> #include <catch2/reporters/catch_reporter_xml.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_enforce.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["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>>(); + 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 { + IEventListenerPtr ReporterRegistry::create( std::string const& name, ReporterConfig&& config ) const { auto it = m_factories.find( name ); if( it == m_factories.end() ) return nullptr; - return it->second->create( ReporterConfig( config ) ); + return it->second->create( CATCH_MOVE(config) ); } void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) { - m_factories.emplace(name, CATCH_MOVE(factory)); + CATCH_ENFORCE( name.find( "::" ) == name.npos, + "'::' is not allowed in reporter name: '" + name + '\'' ); + auto ret = m_factories.emplace(name, CATCH_MOVE(factory)); + CATCH_ENFORCE( ret.second, "reporter using '" + name + "' as name was already registered" ); } - void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) { + void ReporterRegistry::registerListener( + Detail::unique_ptr<EventListenerFactory> factory ) { m_listeners.push_back( CATCH_MOVE(factory) ); } diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp index 62c2023e9a97281be109133a037c59b1db1043ea..b0864265c285199b70694f612a9de51070cd7e02 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp @@ -21,10 +21,10 @@ namespace Catch { ReporterRegistry(); ~ReporterRegistry() override; // = default, out of line to allow fwd decl - IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const override; + IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const override; void registerReporter( std::string const& name, IReporterFactoryPtr factory ); - void registerListener( IReporterFactoryPtr factory ); + void registerListener( Detail::unique_ptr<EventListenerFactory> factory ); FactoryMap const& getFactories() const override; Listeners const& getListeners() const override; diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..30ee191c59ae1a253c1fa37ff49b5a667d0c2572 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp @@ -0,0 +1,173 @@ + +// 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_spec_parser.hpp> + +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> + +#include <algorithm> + +namespace Catch { + + namespace { + struct kvPair { + StringRef key, value; + }; + + kvPair splitKVPair(StringRef kvString) { + auto splitPos = static_cast<size_t>( std::distance( + kvString.begin(), + std::find( kvString.begin(), kvString.end(), '=' ) ) ); + + return { kvString.substr( 0, splitPos ), + kvString.substr( splitPos + 1, kvString.size() ) }; + } + } + + namespace Detail { + std::vector<std::string> splitReporterSpec( StringRef reporterSpec ) { + static constexpr auto separator = "::"; + static constexpr size_t separatorSize = 2; + + size_t separatorPos = 0; + auto findNextSeparator = [&reporterSpec]( size_t startPos ) { + static_assert( + separatorSize == 2, + "The code below currently assumes 2 char separator" ); + + auto currentPos = startPos; + do { + while ( currentPos < reporterSpec.size() && + reporterSpec[currentPos] != separator[0] ) { + ++currentPos; + } + if ( currentPos + 1 < reporterSpec.size() && + reporterSpec[currentPos + 1] == separator[1] ) { + return currentPos; + } + ++currentPos; + } while ( currentPos < reporterSpec.size() ); + + return static_cast<size_t>( -1 ); + }; + + std::vector<std::string> parts; + + while ( separatorPos < reporterSpec.size() ) { + const auto nextSeparator = findNextSeparator( separatorPos ); + parts.push_back( static_cast<std::string>( reporterSpec.substr( + separatorPos, nextSeparator - separatorPos ) ) ); + + if ( nextSeparator == static_cast<size_t>( -1 ) ) { + break; + } + separatorPos = nextSeparator + separatorSize; + } + + // Handle a separator at the end. + // This is not a valid spec, but we want to do validation in a + // centralized place + if ( separatorPos == reporterSpec.size() ) { + parts.emplace_back(); + } + + return parts; + } + + Optional<ColourMode> stringToColourMode( StringRef colourMode ) { + if ( colourMode == "default" ) { + return ColourMode::PlatformDefault; + } else if ( colourMode == "ansi" ) { + return ColourMode::ANSI; + } else if ( colourMode == "win32" ) { + return ColourMode::Win32; + } else if ( colourMode == "none" ) { + return ColourMode::None; + } else { + return {}; + } + } + } // namespace Detail + + + bool operator==( ReporterSpec const& lhs, ReporterSpec const& rhs ) { + return lhs.m_name == rhs.m_name && + lhs.m_outputFileName == rhs.m_outputFileName && + lhs.m_colourMode == rhs.m_colourMode && + lhs.m_customOptions == rhs.m_customOptions; + } + + Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ) { + auto parts = Detail::splitReporterSpec( reporterSpec ); + + assert( parts.size() > 0 && "Split should never return empty vector" ); + + std::map<std::string, std::string> kvPairs; + Optional<std::string> outputFileName; + Optional<ColourMode> colourMode; + + // First part is always reporter name, so we skip it + for ( size_t i = 1; i < parts.size(); ++i ) { + auto kv = splitKVPair( parts[i] ); + auto key = kv.key, value = kv.value; + + if ( key.empty() || value.empty() ) { + return {}; + } else if ( key[0] == 'X' ) { + // This is a reporter-specific option, we don't check these + // apart from basic sanity checks + if ( key.size() == 1 ) { + return {}; + } + + auto ret = kvPairs.emplace( std::string(kv.key), std::string(kv.value) ); + if ( !ret.second ) { + // Duplicated key. We might want to handle this differently, + // e.g. by overwriting the existing value? + return {}; + } + } else if ( key == "out" ) { + // Duplicated key + if ( outputFileName ) { + return {}; + } + outputFileName = static_cast<std::string>( value ); + } else if ( key == "colour-mode" ) { + // Duplicated key + if ( colourMode ) { + return {}; + } + colourMode = Detail::stringToColourMode( value ); + // Parsing failed + if ( !colourMode ) { + return {}; + } + } else { + // Unrecognized option + return {}; + } + } + + return ReporterSpec{ CATCH_MOVE( parts[0] ), + CATCH_MOVE( outputFileName ), + CATCH_MOVE( colourMode ), + CATCH_MOVE( kvPairs ) }; + } + +ReporterSpec::ReporterSpec( + std::string name, + Optional<std::string> outputFileName, + Optional<ColourMode> colourMode, + std::map<std::string, std::string> customOptions ): + m_name( CATCH_MOVE( name ) ), + m_outputFileName( CATCH_MOVE( outputFileName ) ), + m_colourMode( CATCH_MOVE( colourMode ) ), + m_customOptions( CATCH_MOVE( customOptions ) ) {} + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp new file mode 100644 index 0000000000000000000000000000000000000000..242e10222335c34ec32362b07a7197e2bfa0e54c --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp @@ -0,0 +1,85 @@ + +// 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_SPEC_PARSER_HPP_INCLUDED +#define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED + +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_optional.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <map> +#include <string> +#include <vector> + +namespace Catch { + + enum class ColourMode : std::uint8_t; + + namespace Detail { + //! Splits the reporter spec into reporter name and kv-pair options + std::vector<std::string> splitReporterSpec( StringRef reporterSpec ); + + Optional<ColourMode> stringToColourMode( StringRef colourMode ); + } + + /** + * Structured reporter spec that a reporter can be created from + * + * Parsing has been validated, but semantics have not. This means e.g. + * that the colour mode is known to Catch2, but it might not be + * compiled into the binary, and the output filename might not be + * openable. + */ + class ReporterSpec { + std::string m_name; + Optional<std::string> m_outputFileName; + Optional<ColourMode> m_colourMode; + std::map<std::string, std::string> m_customOptions; + + friend bool operator==( ReporterSpec const& lhs, + ReporterSpec const& rhs ); + friend bool operator!=( ReporterSpec const& lhs, + ReporterSpec const& rhs ) { + return !( lhs == rhs ); + } + + public: + ReporterSpec( + std::string name, + Optional<std::string> outputFileName, + Optional<ColourMode> colourMode, + std::map<std::string, std::string> customOptions ); + + std::string const& name() const { return m_name; } + + Optional<std::string> const& outputFile() const { + return m_outputFileName; + } + + Optional<ColourMode> const& colourMode() const { return m_colourMode; } + + std::map<std::string, std::string> const& customOptions() const { + return m_customOptions; + } + }; + + /** + * Parses provided reporter spec string into + * + * Returns empty optional on errors, e.g. + * * field that is not first and not a key+value pair + * * duplicated keys in kv pair + * * unknown catch reporter option + * * empty key/value in an custom kv pair + * * ... + */ + Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ); + +} + +#endif // CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b0824236a0f019e27d32611a8cafad6dc50b2b6 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp @@ -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 +#include <catch2/internal/catch_reusable_string_stream.hpp> +#include <catch2/internal/catch_singletons.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <cstdio> +#include <sstream> +#include <vector> + +namespace Catch { + + // 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::make_unique<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 ); + } + + +} diff --git a/packages/Catch2/src/catch2/internal/catch_stream.hpp b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp similarity index 77% rename from packages/Catch2/src/catch2/internal/catch_stream.hpp rename to packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp index 39a4c0c8cd7de0abbc3ac1493019341caaa2f3b7..55cff727ecd5273ab19f37eff5832e27d484109b 100644 --- a/packages/Catch2/src/catch2/internal/catch_stream.hpp +++ b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp @@ -5,11 +5,10 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_STREAM_HPP_INCLUDED -#define CATCH_STREAM_HPP_INCLUDED +#ifndef CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED +#define CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED #include <catch2/internal/catch_noncopyable.hpp> -#include <catch2/internal/catch_unique_ptr.hpp> #include <iosfwd> #include <cstddef> @@ -18,17 +17,6 @@ namespace Catch { - std::ostream& cout(); - std::ostream& cerr(); - std::ostream& clog(); - - struct IStream { - virtual ~IStream(); // = default - virtual std::ostream& stream() const = 0; - }; - - auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream const>; - class ReusableStringStream : Detail::NonCopyable { std::size_t m_index; std::ostream* m_oss; @@ -66,4 +54,4 @@ namespace Catch { }; } -#endif // CATCH_STREAM_HPP_INCLUDED +#endif // CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.cpp b/packages/Catch2/src/catch2/internal/catch_run_context.cpp index b8e74e5f35885e003737e11709cefb22780fb453..c8b0b30e399460dbcbdb4a8bd7c626fdbcd4f470 100644 --- a/packages/Catch2/src/catch2/internal/catch_run_context.cpp +++ b/packages/Catch2/src/catch2/internal/catch_run_context.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_run_context.hpp> +#include <catch2/catch_user_config.hpp> #include <catch2/interfaces/catch_interfaces_generatortracker.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> @@ -31,7 +32,7 @@ namespace Catch { GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : TrackerBase( nameAndLocation, ctx, parent ) {} - ~GeneratorTracker(); + ~GeneratorTracker() override; static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { GeneratorTracker* tracker; @@ -142,7 +143,7 @@ namespace Catch { // this generator is still waiting for any child to start. if ( should_wait_for_child || ( m_runState == CompletedSuccessfully && - m_generator->next() ) ) { + m_generator->countedNext() ) ) { m_children.clear(); m_runState = Executing; } @@ -159,7 +160,7 @@ namespace Catch { GeneratorTracker::~GeneratorTracker() = default; } - RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter) + RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter) : m_runInfo(_config->name()), m_context(getCurrentMutableContext()), m_config(_config), @@ -192,6 +193,39 @@ namespace Catch { assert(rootTracker.isSectionTracker()); static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + // We intentionally only seed the internal RNG once per test case, + // before it is first invoked. The reason for that is a complex + // interplay of generator/section implementation details and the + // Random*Generator types. + // + // The issue boils down to us needing to seed the Random*Generators + // with different seed each, so that they return different sequences + // of random numbers. We do this by giving them a number from the + // shared RNG instance as their seed. + // + // However, this runs into an issue if the reseeding happens each + // time the test case is entered (as opposed to first time only), + // because multiple generators could get the same seed, e.g. in + // ```cpp + // TEST_CASE() { + // auto i = GENERATE(take(10, random(0, 100)); + // SECTION("A") { + // auto j = GENERATE(take(10, random(0, 100)); + // } + // SECTION("B") { + // auto k = GENERATE(take(10, random(0, 100)); + // } + // } + // ``` + // `i` and `j` would properly return values from different sequences, + // but `i` and `k` would return the same sequence, because their seed + // would be the same. + // (The reason their seeds would be the same is that the generator + // for k would be initialized when the test case is entered the second + // time, after the shared RNG instance was reset to the same value + // it had when the generator for i was initialized.) + seedRng( *m_config ); + uint64_t testRuns = 0; do { m_trackerContext.startCycle(); @@ -206,7 +240,7 @@ namespace Catch { redirectedCerr += oneRunCerr; const auto singleRunTotals = m_totals.delta(beforeRunTotals); - auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, redirectedCout, oneRunCerr, aborting()); + auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, oneRunCout, oneRunCerr, aborting()); m_reporter->testCasePartialEnded(statsForOneRun, testRuns); ++testRuns; @@ -421,8 +455,6 @@ namespace Catch { 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) { @@ -468,6 +500,11 @@ namespace Catch { // before running the tests themselves, or the binary can crash // without failed test being reported. FatalConditionHandlerGuard _(&m_fatalConditionhandler); + // We keep having issue where some compilers warn about an unused + // variable, even though the type has non-trivial constructor and + // destructor. This is annoying and ugly, but it makes them stfu. + (void)_; + m_activeTestCase->invoke(); } @@ -597,10 +634,7 @@ namespace Catch { } void seedRng(IConfig const& config) { - if (config.rngSeed() != 0) { - std::srand(config.rngSeed()); - rng().seed(config.rngSeed()); - } + sharedRng().seed(config.rngSeed()); } unsigned int rngSeed() { diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.hpp b/packages/Catch2/src/catch2/internal/catch_run_context.hpp index 7c315e9acc830648f3bc2cd5152629c941e200dc..cf8941766a0469b21772b917d735b08c06494a76 100644 --- a/packages/Catch2/src/catch2/internal/catch_run_context.hpp +++ b/packages/Catch2/src/catch2/internal/catch_run_context.hpp @@ -17,16 +17,16 @@ #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 <catch2/internal/catch_optional.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <string> namespace Catch { - struct IMutableContext; - struct IGeneratorTracker; - struct IConfig; + class IMutableContext; + class IGeneratorTracker; + class IConfig; /////////////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ namespace Catch { RunContext( RunContext const& ) = delete; RunContext& operator =( RunContext const& ) = delete; - explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter ); + explicit RunContext( IConfig const* _config, IEventListenerPtr&& reporter ); ~RunContext() override; @@ -126,11 +126,11 @@ namespace Catch { IMutableContext& m_context; TestCaseHandle const* m_activeTestCase = nullptr; ITracker* m_testCaseTracker = nullptr; - Option<AssertionResult> m_lastResult; + Optional<AssertionResult> m_lastResult; IConfig const* m_config; Totals m_totals; - IStreamingReporterPtr m_reporter; + IEventListenerPtr m_reporter; std::vector<MessageInfo> m_messages; std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */ AssertionInfo m_lastAssertionInfo; diff --git a/packages/Catch2/src/catch2/internal/catch_sharding.hpp b/packages/Catch2/src/catch2/internal/catch_sharding.hpp new file mode 100644 index 0000000000000000000000000000000000000000..17a206f85070e8be43f7faa19b53ddd55e194ccb --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_sharding.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_SHARDING_HPP_INCLUDED +#define CATCH_SHARDING_HPP_INCLUDED + +#include <catch2/catch_session.hpp> + +#include <cmath> + +namespace Catch { + + template<typename Container> + Container createShard(Container const& container, std::size_t const shardCount, std::size_t const shardIndex) { + assert(shardCount > shardIndex); + + if (shardCount == 1) { + return container; + } + + const std::size_t totalTestCount = container.size(); + + const std::size_t shardSize = totalTestCount / shardCount; + const std::size_t leftoverTests = totalTestCount % shardCount; + + const std::size_t startIndex = shardIndex * shardSize + (std::min)(shardIndex, leftoverTests); + const std::size_t endIndex = (shardIndex + 1) * shardSize + (std::min)(shardIndex + 1, leftoverTests); + + auto startIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(startIndex)); + auto endIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(endIndex)); + + return Container(startIterator, endIterator); + } + +} + +#endif // CATCH_SHARDING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7681f442acbf3bc51b74b6569827266bc9cbf6b0 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp @@ -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 + +#include <catch2/internal/catch_startup_exception_registry.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/catch_user_config.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 diff --git a/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp b/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp new file mode 100644 index 0000000000000000000000000000000000000000..21a0e4e61b3c27fe667592b2d74c3615fa140958 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp @@ -0,0 +1,24 @@ + +// 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_stdstreams.hpp> + +#include <catch2/catch_user_config.hpp> + +#include <iostream> + +namespace Catch { + +// If you #define this you must implement these functions +#if !defined( CATCH_CONFIG_NOSTDOUT ) + std::ostream& cout() { return std::cout; } + std::ostream& cerr() { return std::cerr; } + std::ostream& clog() { return std::clog; } +#endif + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp b/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp new file mode 100644 index 0000000000000000000000000000000000000000..39d8bd750bb6da16867642258ed6649ef99aa446 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp @@ -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 + +#ifndef CATCH_STDSTREAMS_HPP_INCLUDED +#define CATCH_STDSTREAMS_HPP_INCLUDED + +#include <iosfwd> + +namespace Catch { + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + +} // namespace Catch + +#endif diff --git a/packages/Catch2/src/catch2/internal/catch_string_manip.cpp b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp index 0444cd38ed6b958051b60953629d65c2bb0533c1..e61bfd434628c8f7b99915d399016b517e6dba1e 100644 --- a/packages/Catch2/src/catch2/internal/catch_string_manip.cpp +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp @@ -16,16 +16,10 @@ 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 ) { + bool startsWith( StringRef s, char prefix ) { return !s.empty() && s[0] == prefix; } bool endsWith( std::string const& s, std::string const& suffix ) { @@ -38,13 +32,19 @@ namespace Catch { return s.find( infix ) != std::string::npos; } void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + std::transform( s.begin(), s.end(), s.begin(), []( char c ) { + return toLower( c ); + } ); } std::string toLower( std::string const& s ) { std::string lc = s; toLowerInPlace( lc ); return lc; } + char toLower(char c) { + return static_cast<char>(std::tolower(static_cast<unsigned char>(c))); + } + 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 ); diff --git a/packages/Catch2/src/catch2/internal/catch_string_manip.hpp b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp index bd7d0ddf40fa4a0cc3f3af5e54303120faaad5f6..dc58a33601e76504a583b51b38f14ff1c8dd4026 100644 --- a/packages/Catch2/src/catch2/internal/catch_string_manip.hpp +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp @@ -17,12 +17,13 @@ namespace Catch { bool startsWith( std::string const& s, std::string const& prefix ); - bool startsWith( std::string const& s, char prefix ); + bool startsWith( StringRef 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 ); + char toLower( char c ); //! 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! @@ -42,16 +43,17 @@ namespace Catch { * * **Important:** The provided string must outlive the instance */ - struct pluralise { - pluralise(std::size_t count, StringRef label): + class pluralise { + std::uint64_t m_count; + StringRef m_label; + + public: + constexpr pluralise(std::uint64_t count, StringRef label): m_count(count), m_label(label) {} friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); - - std::size_t m_count; - StringRef m_label; }; } diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.cpp b/packages/Catch2/src/catch2/internal/catch_stringref.cpp index 36a6d2466d83845ce44e8e57823216d607b832fe..46bbfafdba598bd5945814015232ba32dc114d5c 100644 --- a/packages/Catch2/src/catch2/internal/catch_stringref.cpp +++ b/packages/Catch2/src/catch2/internal/catch_stringref.cpp @@ -14,23 +14,44 @@ namespace Catch { StringRef::StringRef( char const* rawChars ) noexcept - : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) + : StringRef( rawChars, std::strlen(rawChars) ) {} - auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + auto StringRef::operator == ( StringRef 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 { + bool StringRef::operator<(StringRef 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()); + int StringRef::compare( StringRef rhs ) const { + auto cmpResult = + strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) ); + + // This means that strncmp found a difference before the strings + // ended, and we can return it directly + if ( cmpResult != 0 ) { + return cmpResult; + } + + // If strings are equal up to length, then their comparison results on + // their size + if ( m_size < rhs.m_size ) { + return -1; + } else if ( m_size > rhs.m_size ) { + return 1; + } else { + return 0; + } + } + + auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& { + return os.write(str.data(), static_cast<std::streamsize>(str.size())); } std::string operator+(StringRef lhs, StringRef rhs) { @@ -41,7 +62,7 @@ namespace Catch { return ret; } - auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& { lhs.append(rhs.data(), rhs.size()); return lhs; } diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.hpp b/packages/Catch2/src/catch2/internal/catch_stringref.hpp index 17f5d07dab0312218743f42cf4d814421294ab89..e7f1ab70c14c8add9bdc2bc3f7156dc708d2070c 100644 --- a/packages/Catch2/src/catch2/internal/catch_stringref.hpp +++ b/packages/Catch2/src/catch2/internal/catch_stringref.hpp @@ -49,8 +49,8 @@ namespace Catch { } public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { + auto operator == ( StringRef other ) const noexcept -> bool; + auto operator != (StringRef other) const noexcept -> bool { return !(*this == other); } @@ -59,7 +59,7 @@ namespace Catch { return m_start[index]; } - bool operator<(StringRef const& rhs) const noexcept; + bool operator<(StringRef rhs) const noexcept; public: // named queries constexpr auto empty() const noexcept -> bool { @@ -69,7 +69,6 @@ namespace Catch { return m_size; } - 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. @@ -87,14 +86,21 @@ namespace Catch { return m_start; } - 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 += (std::string& lhs, StringRef sr); + friend std::ostream& operator << (std::ostream& os, StringRef sr); friend std::string operator+(StringRef lhs, StringRef rhs); + + /** + * Provides a three-way comparison with rhs + * + * Returns negative number if lhs < rhs, 0 if lhs == rhs, and a positive + * number if lhs > rhs + */ + int compare( StringRef rhs ) const; }; diff --git a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp index 9dd86c13aab9815d7da2d6c875e097e084932a61..3dbe05281c1bdcc1c02c5409d251d90d0065fc52 100644 --- a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp @@ -15,6 +15,7 @@ #include <string> namespace Catch { + struct SourceLineInfo; class TagAliasRegistry : public ITagAliasRegistry { public: diff --git a/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp index 1099f9db890726804aba573aac6bf99a6eb5a895..bfac3bc81d44ecbb24425aef0d23e33e11813ea5 100644 --- a/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp @@ -83,9 +83,9 @@ template<typename...Types> \ struct TestName{\ TestName(){\ - int index = 0; \ + size_t index = 0; \ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = int[];\ + using expander = size_t[];\ (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ @@ -128,12 +128,12 @@ template<typename... Types> \ struct TestName { \ void reg_tests() { \ - int index = 0; \ - using expander = int[]; \ + size_t index = 0; \ + using expander = size_t[]; \ 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 */\ + (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 ) = [](){ \ @@ -176,8 +176,8 @@ template<typename... Types> \ struct TestName { \ void reg_tests() { \ - int index = 0; \ - using expander = int[]; \ + size_t index = 0; \ + using expander = size_t[]; \ (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 */\ } \ };\ @@ -211,9 +211,9 @@ template<typename...Types> \ struct TestNameClass{\ TestNameClass(){\ - int index = 0; \ + size_t index = 0; \ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = int[];\ + using expander = size_t[];\ (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ @@ -259,12 +259,12 @@ template<typename...Types>\ struct TestNameClass{\ void reg_tests(){\ - int index = 0;\ - using expander = int[];\ + std::size_t index = 0;\ + using expander = std::size_t[];\ 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 */ \ + (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 ) = [](){\ @@ -310,8 +310,8 @@ template<typename...Types>\ struct TestNameClass{\ void reg_tests(){\ - int index = 0;\ - using expander = int[];\ + size_t index = 0;\ + using expander = size_t[];\ (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 */ \ }\ };\ diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp new file mode 100644 index 0000000000000000000000000000000000000000..692d066c4352011a015b8f578370e41c6323a41c --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp @@ -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 + +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_test_case_info_hasher.hpp> + +namespace Catch { + TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {} + + uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const { + // FNV-1a hash algorithm that is designed for uniqueness: + const hash_t prime = 1099511628211u; + hash_t hash = 14695981039346656037u; + for ( const char c : t.name ) { + hash ^= c; + hash *= prime; + } + for ( const char c : t.className ) { + hash ^= c; + hash *= prime; + } + for ( const Tag& tag : t.tags ) { + for ( const char c : tag.original ) { + hash ^= c; + hash *= prime; + } + } + hash ^= m_seed; + hash *= prime; + const uint32_t low{ static_cast<uint32_t>( hash ) }; + const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) }; + return low * high; + } +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..afe233553171e085e88d9c75cf74c40b399ceda4 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.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_TEST_CASE_INFO_HASHER_HPP_INCLUDED +#define CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + + struct TestCaseInfo; + + class TestCaseInfoHasher { + public: + using hash_t = std::uint64_t; + TestCaseInfoHasher( hash_t seed ); + uint32_t operator()( TestCaseInfo const& t ) const; + + private: + hash_t m_seed; + }; + +} // namespace Catch + +#endif /* CATCH_TEST_CASE_INFO_HASHER_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 index dd1744a7072f699e263ddef58f85d0dac32e8a49..6c491a959f27fa42e1a3b23103b609cf479081ed 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp @@ -12,41 +12,17 @@ #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_sharding.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/catch_test_spec.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_test_case_info_hasher.hpp> #include <algorithm> #include <set> namespace Catch { -namespace { - struct TestHasher { - using hash_t = uint64_t; - - explicit TestHasher( hash_t hashSuffix ): - m_hashSuffix( hashSuffix ) {} - - uint64_t m_hashSuffix; - - uint32_t operator()( TestCaseInfo const& t ) const { - // FNV-1a hash with multiplication fold. - const hash_t prime = 1099511628211u; - hash_t hash = 14695981039346656037u; - for (const char c : t.name) { - hash ^= c; - hash *= prime; - } - hash ^= m_hashSuffix; - hash *= prime; - const uint32_t low{ static_cast<uint32_t>(hash) }; - const uint32_t high{ static_cast<uint32_t>(hash >> 32) }; - return low * high; - } - }; -} // end anonymous namespace - std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) { switch (config.runOrder()) { case TestRunOrder::Declared: @@ -65,9 +41,9 @@ namespace { } case TestRunOrder::Randomized: { seedRng(config); - using TestWithHash = std::pair<TestHasher::hash_t, TestCaseHandle>; + using TestWithHash = std::pair<TestCaseInfoHasher::hash_t, TestCaseHandle>; - TestHasher h{ config.rngSeed() }; + TestCaseInfoHasher h{ config.rngSeed() }; std::vector<TestWithHash> indexed_tests; indexed_tests.reserve(unsortedTestCases.size()); @@ -135,7 +111,7 @@ namespace { filtered.push_back(testCase); } } - return filtered; + return createShard(filtered, config.shardCount(), config.shardIndex()); } std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) { return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); 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 index 60a8f9bdc5af5b9af129b63d11686282265552d6..b0064cbbdf8ae5487dd0957b03e11236c38f2c6d 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp @@ -16,7 +16,7 @@ namespace Catch { class TestCaseHandle; - struct IConfig; + class IConfig; class TestSpec; std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ); diff --git a/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp index 357e114dd25a4ddf1bd4bd852cea4fbce6340f59..95384bc155ab730b64ec02bbb9d089537eb762e4 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp @@ -8,14 +8,15 @@ #ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED #define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED +#include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_assertion_handler.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_source_line_info.hpp> -// We need this suppression to leak, because it took until GCC 9 +// We need this suppression to leak, because it took until GCC 10 // for the front end to handle local suppression via _Pragma properly -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9 +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ <= 9 #pragma GCC diagnostic ignored "-Wparentheses" #endif @@ -46,7 +47,7 @@ /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ - do { \ + do { /* NOLINT(bugprone-infinite-loop) */ \ /* 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 ); \ @@ -57,7 +58,8 @@ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) ) + } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.cpp b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp index d33ba27abeb77ae15b59fb6b3f7bb264f2c7fffb..faadb101b663132b5571b53a968399763ce27ba5 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp @@ -13,21 +13,38 @@ #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <algorithm> +#include <iterator> + namespace Catch { namespace { - std::string extractClassName( StringRef 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 ); + StringRef extractClassName( StringRef classOrMethodName ) { + if ( !startsWith( classOrMethodName, '&' ) ) { + return classOrMethodName; } - return className; + + // Remove the leading '&' to avoid having to special case it later + const auto methodName = + classOrMethodName.substr( 1, classOrMethodName.size() ); + + auto reverseStart = std::make_reverse_iterator( methodName.end() ); + auto reverseEnd = std::make_reverse_iterator( methodName.begin() ); + + // We make a simplifying assumption that ":" is only present + // in the input as part of "::" from C++ typenames (this is + // relatively safe assumption because the input is generated + // as stringification of type through preprocessor). + auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1; + auto secondLastColons = + std::find( lastColons + 1, reverseEnd, ':' ); + + auto const startIdx = reverseEnd - secondLastColons; + auto const classNameSize = secondLastColons - lastColons - 1; + + return methodName.substr( + static_cast<std::size_t>( startIdx ), + static_cast<std::size_t>( classNameSize ) ); } } // namespace diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp index 9a03e6dbfa4043508ada321f043e139b9c636c9c..6e064e0831416446c81ed95b4b8c63a1691bc727 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp @@ -14,6 +14,7 @@ #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_unique_name.hpp> +#include <catch2/internal/catch_preprocessor_remove_parens.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 @@ -76,6 +77,7 @@ struct AutoReg : Detail::NonCopyable { static void TestName(); \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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() @@ -86,6 +88,7 @@ struct AutoReg : Detail::NonCopyable { #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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 @@ -93,6 +96,7 @@ struct AutoReg : Detail::NonCopyable { #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ namespace{ \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ void test(); \ @@ -109,6 +113,7 @@ struct AutoReg : Detail::NonCopyable { do { \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_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) diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp index 86b25bfa607036fe928081fc2fb7b57611c35c5d..4dd1ea2a17d3318657c66d6023b0654a8b3775da 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp @@ -28,7 +28,7 @@ namespace Catch { 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); + m_testSpec.m_invalidSpecs.push_back(arg); break; } endMode(); diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp index 22b288ebb3f3e7f2bd61c348ad858d6d110b07d6..75f2fd760c4c5e7d672f511610f71249a5636462 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp @@ -20,7 +20,7 @@ namespace Catch { - struct ITagAliasRegistry; + class ITagAliasRegistry; class TestSpecParser { enum Mode{ None, Name, QuotedName, Tag, EscapedName }; diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.cpp b/packages/Catch2/src/catch2/internal/catch_textflow.cpp index 01fd2df59cd4b43f35e96474f5e33ee64da14b42..993e16229910d1c93f29e75f2407c6188548da25 100644 --- a/packages/Catch2/src/catch2/internal/catch_textflow.cpp +++ b/packages/Catch2/src/catch2/internal/catch_textflow.cpp @@ -6,6 +6,8 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_textflow.hpp> + +#include <algorithm> #include <cstring> #include <ostream> @@ -39,96 +41,107 @@ namespace { namespace Catch { namespace TextFlow { - void Column::iterator::calcLength() { - m_suffix = false; - auto width = m_column.m_width - indent(); - m_end = m_pos; + void Column::const_iterator::calcLength() { + m_addHyphen = false; + m_parsedTo = m_lineStart; + std::string const& current_line = m_column.m_string; - if ( current_line[m_pos] == '\n' ) { - ++m_end; + if ( current_line[m_lineStart] == '\n' ) { + ++m_parsedTo; } - while ( m_end < current_line.size() && - current_line[m_end] != '\n' ) { - ++m_end; + + const auto maxLineLength = m_column.m_width - indentSize(); + const auto maxParseTo = std::min(current_line.size(), m_lineStart + maxLineLength); + while ( m_parsedTo < maxParseTo && + current_line[m_parsedTo] != '\n' ) { + ++m_parsedTo; } - if ( m_end < m_pos + width ) { - m_len = m_end - m_pos; + // If we encountered a newline before the column is filled, + // then we linebreak at the newline and consider this line + // finished. + if ( m_parsedTo < m_lineStart + maxLineLength ) { + m_lineLength = m_parsedTo - m_lineStart; } else { - size_t len = width; - while ( len > 0 && !isBoundary( current_line, m_pos + len ) ) { - --len; + // Look for a natural linebreak boundary in the column + // (We look from the end, so that the first found boundary is + // the right one) + size_t newLineLength = maxLineLength; + while ( newLineLength > 0 && !isBoundary( current_line, m_lineStart + newLineLength ) ) { + --newLineLength; } - while ( len > 0 && - isWhitespace( current_line[m_pos + len - 1] ) ) { - --len; + while ( newLineLength > 0 && + isWhitespace( current_line[m_lineStart + newLineLength - 1] ) ) { + --newLineLength; } - if ( len > 0 ) { - m_len = len; + // If we found one, then that is where we linebreak + if ( newLineLength > 0 ) { + m_lineLength = newLineLength; } else { - m_suffix = true; - m_len = width - 1; + // Otherwise we have to split text with a hyphen + m_addHyphen = true; + m_lineLength = maxLineLength - 1; } } } - size_t Column::iterator::indent() const { + size_t Column::const_iterator::indentSize() const { auto initial = - m_pos == 0 ? m_column.m_initialIndent : std::string::npos; + m_lineStart == 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, + Column::const_iterator::addIndentAndSuffix( size_t position, size_t length ) const { std::string ret; - const auto desired_indent = indent(); - ret.reserve( desired_indent + length + m_suffix ); + const auto desired_indent = indentSize(); + ret.reserve( desired_indent + length + m_addHyphen ); ret.append( desired_indent, ' ' ); ret.append( m_column.m_string, position, length ); - if ( m_suffix ) { + if ( m_addHyphen ) { ret.push_back( '-' ); } return ret; } - Column::iterator::iterator( Column const& column ): m_column( column ) { + Column::const_iterator::const_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(); + if ( m_lineLength == 0 ) { + m_lineStart = m_column.m_string.size(); } } - std::string Column::iterator::operator*() const { - assert( m_pos <= m_end ); - return addIndentAndSuffix( m_pos, m_len ); + std::string Column::const_iterator::operator*() const { + assert( m_lineStart <= m_parsedTo ); + return addIndentAndSuffix( m_lineStart, m_lineLength ); } - Column::iterator& Column::iterator::operator++() { - m_pos += m_len; + Column::const_iterator& Column::const_iterator::operator++() { + m_lineStart += m_lineLength; std::string const& current_line = m_column.m_string; - if ( m_pos < current_line.size() && current_line[m_pos] == '\n' ) { - m_pos += 1; + if ( m_lineStart < current_line.size() && current_line[m_lineStart] == '\n' ) { + m_lineStart += 1; } else { - while ( m_pos < current_line.size() && - isWhitespace( current_line[m_pos] ) ) { - ++m_pos; + while ( m_lineStart < current_line.size() && + isWhitespace( current_line[m_lineStart] ) ) { + ++m_lineStart; } } - if ( m_pos != current_line.size() ) { + if ( m_lineStart != current_line.size() ) { calcLength(); } return *this; } - Column::iterator Column::iterator::operator++( int ) { - iterator prev( *this ); + Column::const_iterator Column::const_iterator::operator++( int ) { + const_iterator prev( *this ); operator++(); return prev; } diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.hpp b/packages/Catch2/src/catch2/internal/catch_textflow.hpp index 074146c871f013d8ef5644787c639cdb0309b835..e2cdff58b7f9e0e9be2704cd5f044c0e525c1b28 100644 --- a/packages/Catch2/src/catch2/internal/catch_textflow.hpp +++ b/packages/Catch2/src/catch2/internal/catch_textflow.hpp @@ -18,31 +18,49 @@ namespace Catch { class Columns; + /** + * Represents a column of text with specific width and indentation + * + * When written out to a stream, it will perform linebreaking + * of the provided text so that the written lines fit within + * target width. + */ class Column { + // String to be written out std::string m_string; + // Width of the column for linebreaking size_t m_width = CATCH_CONFIG_CONSOLE_WIDTH - 1; + // Indentation of other lines (including first if initial indent is unset) size_t m_indent = 0; + // Indentation of the first line size_t m_initialIndent = std::string::npos; public: - class iterator { + /** + * Iterates "lines" in `Column` and return sthem + */ + class const_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() ) {} - + // Where does the current line start? + size_t m_lineStart = 0; + // How long should the current line be? + size_t m_lineLength = 0; + // How far have we checked the string to iterate? + size_t m_parsedTo = 0; + // Should a '-' be appended to the line? + bool m_addHyphen = false; + + const_iterator( Column const& column, EndTag ): + m_column( column ), m_lineStart( m_column.m_string.size() ) {} + + // Calculates the length of the current line void calcLength(); // Returns current indention width - size_t indent() const; + size_t indentSize() const; // Creates an indented and (optionally) suffixed string from // current iterator position, indentation and length. @@ -56,21 +74,21 @@ namespace Catch { using reference = value_type&; using iterator_category = std::forward_iterator_tag; - explicit iterator( Column const& column ); + explicit const_iterator( Column const& column ); std::string operator*() const; - iterator& operator++(); - iterator operator++( int ); + const_iterator& operator++(); + const_iterator operator++( int ); - bool operator==( iterator const& other ) const { - return m_pos == other.m_pos && &m_column == &other.m_column; + bool operator==( const_iterator const& other ) const { + return m_lineStart == other.m_lineStart && &m_column == &other.m_column; } - bool operator!=( iterator const& other ) const { + bool operator!=( const_iterator const& other ) const { return !operator==( other ); } }; - using const_iterator = iterator; + using iterator = const_iterator; explicit Column( std::string const& text ): m_string( text ) {} @@ -89,8 +107,8 @@ namespace Catch { } size_t width() const { return m_width; } - iterator begin() const { return iterator( *this ); } - iterator end() const { return { *this, iterator::EndTag{} }; } + const_iterator begin() const { return const_iterator( *this ); } + const_iterator end() const { return { *this, const_iterator::EndTag{} }; } friend std::ostream& operator<<( std::ostream& os, Column const& col ); @@ -110,7 +128,7 @@ namespace Catch { struct EndTag {}; std::vector<Column> const& m_columns; - std::vector<Column::iterator> m_iterators; + std::vector<Column::const_iterator> m_iterators; size_t m_activeIterators; iterator( Columns const& columns, EndTag ); diff --git a/packages/Catch2/src/catch2/internal/catch_to_string.hpp b/packages/Catch2/src/catch2/internal/catch_to_string.hpp index d8ff35cfc534c22f7f2076dc9eb50675072cf950..15b24e19534253ce9c0b52875fc7fed11fdc080b 100644 --- a/packages/Catch2/src/catch2/internal/catch_to_string.hpp +++ b/packages/Catch2/src/catch2/internal/catch_to_string.hpp @@ -11,7 +11,7 @@ #include <string> #include <catch2/internal/catch_compiler_capabilities.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> namespace Catch { template <typename T> diff --git a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c6251a3f7cff4c669bed5ef2365d8892e500f844 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.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_uncaught_exceptions.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_uncaught_exceptions.hpp> +#include <catch2/catch_user_config.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 diff --git a/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp index d3bc8417de3a9435bf257ba9b1ad7da3630b1c06..c453cde623e0e846ca9c6c108974c5898fcfd2c0 100644 --- a/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp +++ b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp @@ -11,11 +11,15 @@ #include <cassert> #include <type_traits> +#include <catch2/internal/catch_move_and_forward.hpp> + 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 + /** + * A reimplementation of `std::unique_ptr` for improved compilation performance + * + * Does not support arrays nor custom deleters. + */ template <typename T> class unique_ptr { T* m_ptr; @@ -98,20 +102,13 @@ namespace Detail { } }; - // 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? + //! Specialization to cause compile-time error for arrays 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)...)); + return unique_ptr<T>(new T(CATCH_FORWARD(args)...)); } diff --git a/packages/Catch2/src/catch2/internal/catch_void_type.hpp b/packages/Catch2/src/catch2/internal/catch_void_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..23875c352471cd07346eb70df6aa388749ec1ba0 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_void_type.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_VOID_TYPE_HPP_INCLUDED +#define CATCH_VOID_TYPE_HPP_INCLUDED + + +namespace Catch { + namespace Detail { + + template <typename...> + struct make_void { using type = void; }; + + template <typename... Ts> + using void_t = typename make_void<Ts...>::type; + + } // namespace Detail +} // namespace Catch + + +#endif // CATCH_VOID_TYPE_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 index a4c11fa624b21c0c7f8dfc3a5d2f3236dfae649a..14fe747d1447fb37fc5fefc6440238190a99ed5e 100644 --- a/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp +++ b/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp @@ -12,12 +12,12 @@ #if defined(CATCH_PLATFORM_WINDOWS) -#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) -# define CATCH_DEFINED_NOMINMAX +// We might end up with the define made globally through the compiler, +// and we don't want to trigger warnings for this +#if !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 +#if !defined(WIN32_LEAN_AND_MEAN) # define WIN32_LEAN_AND_MEAN #endif @@ -27,13 +27,6 @@ #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 index b8635f7f2bd2760e3662931e6ce7e2badcfbf80e..93758cba766ce7fb2d6c050f610e386ea01bb8d5 100644 --- a/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp @@ -87,7 +87,7 @@ namespace { // (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]; + unsigned char c = static_cast<unsigned char>(m_str[idx]); switch (c) { case '<': os << "<"; break; case '&': os << "&"; break; @@ -147,7 +147,7 @@ namespace { bool valid = true; uint32_t value = headerValue(c); for (std::size_t n = 1; n < encBytes; ++n) { - unsigned char nc = m_str[idx + n]; + unsigned char nc = static_cast<unsigned char>(m_str[idx + n]); valid &= ((nc & 0xC0) == 0x80); value = (value << 6) | (nc & 0x3F); } @@ -268,7 +268,7 @@ namespace { if (shouldIndent(fmt)) { m_os << m_indent; } - m_os << "</" << m_tags.back() << ">"; + m_os << "</" << m_tags.back() << '>'; } m_os << std::flush; applyFormatting(fmt); @@ -295,13 +295,14 @@ namespace { } XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) { + CATCH_ENFORCE(!m_tags.empty(), "Cannot write text as top level element"); if( !text.empty() ){ bool tagWasOpen = m_tagIsOpen; ensureTagClosed(); if (tagWasOpen && shouldIndent(fmt)) { m_os << m_indent; } - m_os << XmlEncode( text ); + m_os << XmlEncode( text, XmlEncode::ForTextNodes ); applyFormatting(fmt); } return *this; @@ -312,7 +313,7 @@ namespace { if (shouldIndent(fmt)) { m_os << m_indent; } - m_os << "<!--" << text << "-->"; + m_os << "<!-- " << text << " -->"; applyFormatting(fmt); return *this; } @@ -321,12 +322,6 @@ namespace { m_os << R"(<?xml-stylesheet type="text/xsl" href=")" << url << R"("?>)" << '\n'; } - XmlWriter& XmlWriter::writeBlankLine() { - ensureTagClosed(); - m_os << '\n'; - return *this; - } - void XmlWriter::ensureTagClosed() { if( m_tagIsOpen ) { m_os << '>' << std::flush; diff --git a/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp index 3ba8c08ecb60a93dbbd1c383cd308581e7b9bbeb..556339376d17f1d8972bfe63376bf8532aef57c7 100644 --- a/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp @@ -8,9 +8,10 @@ #ifndef CATCH_XMLWRITER_HPP_INCLUDED #define CATCH_XMLWRITER_HPP_INCLUDED -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/internal/catch_stringref.hpp> +#include <iosfwd> #include <vector> namespace Catch { @@ -77,11 +78,11 @@ namespace Catch { } private: - mutable XmlWriter* m_writer = nullptr; + XmlWriter* m_writer = nullptr; XmlFormatting m_fmt; }; - XmlWriter( std::ostream& os = Catch::cout() ); + XmlWriter( std::ostream& os ); ~XmlWriter(); XmlWriter( XmlWriter const& ) = delete; @@ -117,18 +118,18 @@ namespace Catch { return writeAttribute( name, rss.str() ); } + //! Writes escaped `text` in a element XmlWriter& writeText( StringRef text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); + //! Writes XML comment as "<!-- text -->" XmlWriter& writeComment( StringRef text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); void writeStylesheetRef( StringRef url ); - XmlWriter& writeBlankLine(); - void ensureTagClosed(); private: diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b604e4a18e38f84320249b7f6853d9f36e8a3d8 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers.cpp @@ -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 + + +#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 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp index 86f63bee5e41e9678523c1eaeb9f307488e23223..373e2a6739ef2af4eaa7e29df6f758b089fea4b6 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp @@ -35,27 +35,20 @@ namespace Matchers { 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> {}; + class MatcherBase : public MatcherUntypedBase { + public: + virtual bool match( T const& arg ) const = 0; + }; namespace Detail { template<typename ArgT> - struct MatchAllOf final : MatcherBase<ArgT> { + class MatchAllOf final : public MatcherBase<ArgT> { + std::vector<MatcherBase<ArgT> const*> m_matchers; + + public: MatchAllOf() = default; MatchAllOf(MatchAllOf const&) = delete; MatchAllOf& operator=(MatchAllOf const&) = delete; @@ -94,9 +87,6 @@ namespace Matchers { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); return CATCH_MOVE(rhs); } - - private: - std::vector<MatcherBase<ArgT> const*> m_matchers; }; //! lvalue overload is intentionally deleted, users should @@ -109,7 +99,9 @@ namespace Matchers { MatchAllOf<ArgT> operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf<ArgT> const& rhs) = delete; template<typename ArgT> - struct MatchAnyOf final : MatcherBase<ArgT> { + class MatchAnyOf final : public MatcherBase<ArgT> { + std::vector<MatcherBase<ArgT> const*> m_matchers; + public: MatchAnyOf() = default; MatchAnyOf(MatchAnyOf const&) = delete; MatchAnyOf& operator=(MatchAnyOf const&) = delete; @@ -147,9 +139,6 @@ namespace Matchers { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); return CATCH_MOVE(rhs); } - - private: - std::vector<MatcherBase<ArgT> const*> m_matchers; }; //! lvalue overload is intentionally deleted, users should @@ -162,8 +151,10 @@ namespace Matchers { MatchAnyOf<ArgT> operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf<ArgT> const& rhs) = delete; template<typename ArgT> - struct MatchNotOf final : MatcherBase<ArgT> { + class MatchNotOf final : public MatcherBase<ArgT> { + MatcherBase<ArgT> const& m_underlyingMatcher; + public: explicit MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ): m_underlyingMatcher( underlyingMatcher ) {} @@ -175,9 +166,6 @@ namespace Matchers { std::string describe() const override { return "not " + m_underlyingMatcher.toString(); } - - private: - MatcherBase<ArgT> const& m_underlyingMatcher; }; } // namespace Detail diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5344abcd6c6544b1c371a44053ae994ef48f11f8 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.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/matchers/catch_matchers_container_properties.hpp> +#include <catch2/internal/catch_reusable_string_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 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp index 082f834f281a694f240f68305d1e7c83e9728d66..f0688a57af50105c55c44c7fc4074825e8877677 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp @@ -17,7 +17,6 @@ namespace Catch { 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) diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af3ea15a6dd079905d315fe27941f29916230a7f --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.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/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/catch_matchers_floating_point.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp index ad0fd378c5aff1aa43a4e0b312d812ed03cf39d5..4d40140fea2bdb108e51958730a1c7401c7b95f4 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -150,14 +150,26 @@ namespace Detail { ret << " (["; if (m_type == Detail::FloatingPointKind::Double) { - write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps)); + write( ret, + step( m_target, + -std::numeric_limits<double>::infinity(), + m_ulps ) ); ret << ", "; - write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps)); + write( ret, + step( m_target, + std::numeric_limits<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)); + write( ret, + step( static_cast<float>( m_target ), + -std::numeric_limits<float>::infinity(), + m_ulps ) ); ret << ", "; - write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps)); + write( ret, + step( static_cast<float>( m_target ), + std::numeric_limits<float>::infinity(), + m_ulps ) ); } ret << "])"; diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp index dc0fa8f71fe8c174f8c8a6cb3d3f89ef2cd352ac..99572e4332cad6c7328156f2de8dc4155cde0a37 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp @@ -17,7 +17,8 @@ namespace Matchers { enum class FloatingPointKind : uint8_t; } - struct WithinAbsMatcher final : MatcherBase<double> { + class WithinAbsMatcher final : public MatcherBase<double> { + public: WithinAbsMatcher(double target, double margin); bool match(double const& matchee) const override; std::string describe() const override; @@ -26,8 +27,11 @@ namespace Matchers { double m_margin; }; - struct WithinUlpsMatcher final : MatcherBase<double> { - WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType); + class WithinUlpsMatcher final : public MatcherBase<double> { + public: + WithinUlpsMatcher( double target, + uint64_t ulps, + Detail::FloatingPointKind baseType ); bool match(double const& matchee) const override; std::string describe() const override; private: @@ -42,8 +46,9 @@ namespace Matchers { // |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); + class WithinRelMatcher final : public MatcherBase<double> { + public: + WithinRelMatcher( double target, double epsilon ); bool match(double const& matchee) const override; std::string describe() const override; private: diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a9ecffc9fb0edd095b89e6644f751b10566724a2 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp @@ -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 + +#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 + '"'; + } +} diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f2e48d8758c16e91460a116baf3186a08be15e7 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp @@ -0,0 +1,24 @@ + +// 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_quantifiers.hpp> + +namespace Catch { + namespace Matchers { + std::string AllTrueMatcher::describe() const { return "contains only true"; } + + AllTrueMatcher AllTrue() { return AllTrueMatcher{}; } + + std::string NoneTrueMatcher::describe() const { return "contains no true"; } + + NoneTrueMatcher NoneTrue() { return NoneTrueMatcher{}; } + + std::string AnyTrueMatcher::describe() const { return "contains at least one true"; } + + AnyTrueMatcher AnyTrue() { return AnyTrueMatcher{}; } + } // namespace Matchers +} // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp index e0e1a62d702794e5c4dcaf35e2bb4b7a6175bac1..8833440f28f88a301b22759ace1f1411c51cdb77 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp @@ -85,7 +85,55 @@ namespace Catch { } }; - // Creates a matcher that checks whether a range contains element matching a matcher + // Matcher for checking that all elements in range are true. + class AllTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (!elem) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that no element in range is true. + class NoneTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (elem) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that any element in range is true. + class AnyTrueMatcher final : public MatcherGenericBase { + public: + std::string describe() const override; + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (elem) { + return true; + } + } + return false; + } + }; + + // Creates a matcher that checks whether all elements in a range match a matcher template <typename Matcher> AllMatchMatcher<Matcher> AllMatch(Matcher&& matcher) { return { CATCH_FORWARD(matcher) }; @@ -102,6 +150,15 @@ namespace Catch { AnyMatchMatcher<Matcher> AnyMatch(Matcher&& matcher) { return { CATCH_FORWARD(matcher) }; } + + // Creates a matcher that checks whether all elements in a range are true + AllTrueMatcher AllTrue(); + + // Creates a matcher that checks whether no element in a range is true + NoneTrueMatcher NoneTrue(); + + // Creates a matcher that checks whether any element in a range is true + AnyTrueMatcher AnyTrue(); } } diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp index ee082d2c06e12b86509a3c3ee7e00902b86a1976..2fc3a55638299dd7b3fca1c6c6f43bb39868de39 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp @@ -31,7 +31,7 @@ namespace Matchers { } - StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + StringMatcherBase::StringMatcherBase( StringRef operation, CasedString const& comparator ) : m_comparator( comparator ), m_operation( operation ) { } @@ -43,33 +43,33 @@ namespace Matchers { description += m_operation; description += ": \""; description += m_comparator.m_str; - description += "\""; + description += '"'; description += m_comparator.caseSensitivitySuffix(); return description; } - StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals"_sr, 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 ) {} + StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains"_sr, 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 ) {} + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with"_sr, 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 ) {} + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with"_sr, comparator ) {} bool EndsWithMatcher::match( std::string const& source ) const { return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); @@ -96,7 +96,7 @@ namespace Matchers { StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity ) { return StringEqualsMatcher( CasedString( str, caseSensitivity) ); } - StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity ) { + StringContainsMatcher ContainsSubstring( std::string const& str, CaseSensitive caseSensitivity ) { return StringContainsMatcher( CasedString( str, caseSensitivity) ); } EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity ) { diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp index ed2b1f68c9660abb2e4012bf0f9a74f57b6919d8..7f961c45ed5082f0fb6b89f80a21acafbbc04b7b 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp @@ -26,45 +26,52 @@ namespace Matchers { std::string m_str; }; - struct StringMatcherBase : MatcherBase<std::string> { - StringMatcherBase( std::string const& operation, CasedString const& comparator ); - std::string describe() const override; - + class StringMatcherBase : public MatcherBase<std::string> { + protected: CasedString m_comparator; - std::string m_operation; + StringRef m_operation; + + public: + StringMatcherBase( StringRef operation, + CasedString const& comparator ); + std::string describe() const override; }; - struct StringEqualsMatcher final : StringMatcherBase { + class StringEqualsMatcher final : public StringMatcherBase { + public: StringEqualsMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct StringContainsMatcher final : StringMatcherBase { + class StringContainsMatcher final : public StringMatcherBase { + public: StringContainsMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct StartsWithMatcher final : StringMatcherBase { + class StartsWithMatcher final : public StringMatcherBase { + public: StartsWithMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct EndsWithMatcher final : StringMatcherBase { + class EndsWithMatcher final : public StringMatcherBase { + public: EndsWithMatcher( CasedString const& comparator ); bool match( std::string const& source ) const override; }; - struct RegexMatcher final : MatcherBase<std::string> { + class RegexMatcher final : public MatcherBase<std::string> { + std::string m_regex; + CaseSensitive m_caseSensitivity; + + public: 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 ); + StringContainsMatcher ContainsSubstring( 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` diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp index 3431bde08d47399cd6ecedbb700615f354f0fbc4..a336d8989666be29065e47fbfbab09e21fac8d9b 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp @@ -19,7 +19,7 @@ namespace Matchers { for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { combined_size += desc->size(); } - combined_size += (descriptions_end - descriptions_begin - 1) * combine.size(); + combined_size += static_cast<size_t>(descriptions_end - descriptions_begin - 1) * combine.size(); description.reserve(combined_size); diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp index 200ca74bf9e919462163580b945cbfb45ebcbd44..8c7804ce91824f058b0cb6271319c2c4def86a1a 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp @@ -19,9 +19,10 @@ namespace Catch { namespace Matchers { - struct MatcherGenericBase : MatcherUntypedBase { + class MatcherGenericBase : public MatcherUntypedBase { + public: MatcherGenericBase() = default; - virtual ~MatcherGenericBase(); // = default; + ~MatcherGenericBase() override; // = default; MatcherGenericBase(MatcherGenericBase&) = default; MatcherGenericBase(MatcherGenericBase&&) = default; @@ -119,7 +120,8 @@ namespace Matchers { template<typename... MatcherTs> - struct MatchAllOfGeneric final : MatcherGenericBase { + class MatchAllOfGeneric final : public MatcherGenericBase { + public: MatchAllOfGeneric(MatchAllOfGeneric const&) = delete; MatchAllOfGeneric& operator=(MatchAllOfGeneric const&) = delete; MatchAllOfGeneric(MatchAllOfGeneric&&) = default; @@ -137,7 +139,11 @@ namespace Matchers { return describe_multi_matcher<MatcherTs...>(" and "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); } - std::array<void const*, sizeof...(MatcherTs)> m_matchers; + // Has to be public to enable the concatenating operators + // below, because they are not friend of the RHS, only LHS, + // and thus cannot access private fields of RHS + std::array<void const*, sizeof...( MatcherTs )> m_matchers; + //! Avoids type nesting for `GenericAllOf && GenericAllOf` case template<typename... MatchersRHS> @@ -169,7 +175,8 @@ namespace Matchers { template<typename... MatcherTs> - struct MatchAnyOfGeneric final : MatcherGenericBase { + class MatchAnyOfGeneric final : public MatcherGenericBase { + public: MatchAnyOfGeneric(MatchAnyOfGeneric const&) = delete; MatchAnyOfGeneric& operator=(MatchAnyOfGeneric const&) = delete; MatchAnyOfGeneric(MatchAnyOfGeneric&&) = default; @@ -187,7 +194,11 @@ namespace Matchers { return describe_multi_matcher<MatcherTs...>(" or "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); } - std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + // Has to be public to enable the concatenating operators + // below, because they are not friend of the RHS, only LHS, + // and thus cannot access private fields of RHS + std::array<void const*, sizeof...( MatcherTs )> m_matchers; //! Avoids type nesting for `GenericAnyOf || GenericAnyOf` case template<typename... MatchersRHS> @@ -218,7 +229,10 @@ namespace Matchers { template<typename MatcherT> - struct MatchNotOfGeneric final : MatcherGenericBase { + class MatchNotOfGeneric final : public MatcherGenericBase { + MatcherT const& m_matcher; + + public: MatchNotOfGeneric(MatchNotOfGeneric const&) = delete; MatchNotOfGeneric& operator=(MatchNotOfGeneric const&) = delete; MatchNotOfGeneric(MatchNotOfGeneric&&) = default; @@ -239,8 +253,6 @@ namespace Matchers { friend MatcherT const& operator ! (MatchNotOfGeneric<MatcherT> const& matcher) { return matcher.m_matcher; } - private: - MatcherT const& m_matcher; }; } // namespace Detail diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp index 00ecbc33d272e366075d3d9bf59c35a8138e545a..b9a02f579cc5efeb334d83952d155d43d33f2a36 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp @@ -17,8 +17,10 @@ namespace Catch { namespace Matchers { template<typename T, typename Alloc> - struct VectorContainsElementMatcher final : MatcherBase<std::vector<T, Alloc>> { + class VectorContainsElementMatcher final : public MatcherBase<std::vector<T, Alloc>> { + T const& m_comparator; + public: VectorContainsElementMatcher(T const& comparator): m_comparator(comparator) {} @@ -35,13 +37,13 @@ namespace Matchers { 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>> { + class ContainsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + public: ContainsMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -67,13 +69,13 @@ namespace Matchers { 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>> { + class EqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + public: EqualsMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -93,12 +95,14 @@ namespace Matchers { 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>> { + class ApproxMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_comparator; + mutable Catch::Approx approx = Catch::Approx::custom(); + public: ApproxMatcher(std::vector<T, AllocComp> const& comparator): m_comparator( comparator ) {} @@ -129,13 +133,13 @@ namespace Matchers { 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>> { + class UnorderedEqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> { + std::vector<T, AllocComp> const& m_target; + + public: UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target): m_target(target) {} @@ -149,15 +153,12 @@ namespace Matchers { 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 ) { 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 deleted file mode 100644 index 4fab1b52f84cf5c04273b79ce9600bf2eae5977e..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -// 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> -#include <catch2/internal/catch_move_and_forward.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 matcherString ) { - std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr<std::string, StringMatcher const&> expr( CATCH_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.cpp b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c2a61179a243435b747efdb768e2a06aaf26aaf --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp @@ -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 + +#include <catch2/matchers/internal/catch_matchers_impl.hpp> +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/internal/catch_move_and_forward.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 matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // 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 index 2acbec1f3014796c335279ddb52840e320d81fe6..5d00ad7d54cee4054833408928a13fc4eddf1444 100644 --- a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp @@ -36,7 +36,7 @@ namespace Catch { namespace Matchers { template <typename ArgT> - struct MatcherBase; + class MatcherBase; } using StringMatcher = Matchers::MatcherBase<std::string>; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp index ec11f605f9fcf6a2ce2ad9154a82213de699a9be..90b12928df803ca3a32eab69d36280f8d3b17294 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp @@ -16,20 +16,20 @@ namespace Catch { void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. - stream << ":test-result: "; + m_stream << ":test-result: "; if (_testCaseStats.totals.assertions.allPassed()) { - stream << "PASS"; + m_stream << "PASS"; } else if (_testCaseStats.totals.assertions.allOk()) { - stream << "XFAIL"; + m_stream << "XFAIL"; } else { - stream << "FAIL"; + m_stream << "FAIL"; } - stream << ' ' << _testCaseStats.testInfo->name << '\n'; + m_stream << ' ' << _testCaseStats.testInfo->name << '\n'; StreamingReporterBase::testCaseEnded(_testCaseStats); } void AutomakeReporter::skipTest(TestCaseInfo const& testInfo) { - stream << ":test-result: SKIP " << testInfo.name << '\n'; + m_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 index 84fad79027e1ebec9a22dea4810f7aa27a275f6e..bf18fddf7d0b82eb3137b5852827c08fcfe987bd 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp @@ -8,15 +8,21 @@ #ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED +#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> + +#include <string> namespace Catch { - struct AutomakeReporter final : StreamingReporterBase { - AutomakeReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ) + class AutomakeReporter final : public StreamingReporterBase { + public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + AutomakeReporter(ReporterConfig&& _config): + StreamingReporterBase(CATCH_MOVE(_config)) {} - ~AutomakeReporter() override; static std::string getDescription() { @@ -26,7 +32,6 @@ namespace Catch { void testCaseEnded(TestCaseStats const& _testCaseStats) override; void skipTest(TestCaseInfo const& testInfo) override; - }; } // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp new file mode 100644 index 0000000000000000000000000000000000000000..698435d044c4093880034347c100b3ba43cf0f61 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp @@ -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 + +#include <catch2/reporters/catch_reporter_common_base.hpp> + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_istream.hpp> + + +namespace Catch { + ReporterBase::ReporterBase( ReporterConfig&& config ): + IEventListener( config.fullConfig() ), + m_wrapped_stream( CATCH_MOVE(config).takeStream() ), + m_stream( m_wrapped_stream->stream() ), + m_colour( makeColourImpl( config.colourMode(), m_wrapped_stream.get() ) ), + m_customOptions( config.customOptions() ) + {} + + ReporterBase::~ReporterBase() = default; + + void ReporterBase::listReporters( + std::vector<ReporterDescription> const& descriptions ) { + defaultListReporters(m_stream, descriptions, m_config->verbosity()); + } + + void ReporterBase::listListeners( + std::vector<ListenerDescription> const& descriptions ) { + defaultListListeners( m_stream, descriptions ); + } + + void ReporterBase::listTests(std::vector<TestCaseHandle> const& tests) { + defaultListTests(m_stream, + m_colour.get(), + tests, + m_config->hasTestFilters(), + m_config->verbosity()); + } + + void ReporterBase::listTags(std::vector<TagInfo> const& tags) { + defaultListTags( m_stream, tags, m_config->hasTestFilters() ); + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e6888be1664ff83ce2926e9abb2078fe23516465 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.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_COMMON_BASE_HPP_INCLUDED +#define CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +#include <map> +#include <string> + +namespace Catch { + class ColourImpl; + + /** + * This is the base class for all reporters. + * + * If are writing a reporter, you must derive from this type, or one + * of the helper reporter bases that are derived from this type. + * + * ReporterBase centralizes handling of various common tasks in reporters, + * like storing the right stream for the reporters to write to, and + * providing the default implementation of the different listing events. + */ + class ReporterBase : public IEventListener { + protected: + //! The stream wrapper as passed to us by outside code + Detail::unique_ptr<IStream> m_wrapped_stream; + //! Cached output stream from `m_wrapped_stream` to reduce + //! number of indirect calls needed to write output. + std::ostream& m_stream; + //! Colour implementation this reporter was configured for + Detail::unique_ptr<ColourImpl> m_colour; + //! The custom reporter options user passed down to the reporter + std::map<std::string, std::string> m_customOptions; + + public: + ReporterBase( ReporterConfig&& config ); + ~ReporterBase() override; // = default; + + /** + * Provides a simple default listing of reporters. + * + * Should look roughly like the reporter listing in v2 and earlier + * versions of Catch2. + */ + void listReporters( + std::vector<ReporterDescription> const& descriptions ) override; + /** + * Provides a simple default listing of listeners + * + * Looks similarly to listing of reporters, but with listener type + * instead of reporter name. + */ + void listListeners( + std::vector<ListenerDescription> const& descriptions ) override; + /** + * Provides a simple default listing of tests. + * + * Should look roughly like the test listing in v2 and earlier versions + * of Catch2. Especially supports low-verbosity listing that mimics the + * old `--list-test-names-only` output. + */ + void listTests( std::vector<TestCaseHandle> const& tests ) override; + /** + * Provides a simple default listing of tags. + * + * Should look roughly like the tag listing in v2 and earlier versions + * of Catch2. + */ + void listTags( std::vector<TagInfo> const& tags ) override; + }; +} // namespace Catch + +#endif // CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp index 1bd997bdc70f19bfe7ca48af9031b981b620a95a..a09f0483d53e690be0b764f7461f45d8fa823b11 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp @@ -7,6 +7,8 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/reporters/catch_reporter_compact.hpp> +#include <catch2/catch_get_random_seed.hpp> +#include <catch2/catch_test_spec.hpp> #include <catch2/reporters/catch_reporter_helpers.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/internal/catch_platform.hpp> @@ -18,10 +20,7 @@ namespace { - // Colour::LightGrey - constexpr Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } - - constexpr Catch::StringRef bothOrAll( std::size_t count ) { + constexpr Catch::StringRef bothOrAll( std::uint64_t count ) { switch (count) { case 1: return Catch::StringRef{}; @@ -38,6 +37,9 @@ namespace { namespace Catch { namespace { + // Colour::LightGrey + static constexpr Colour::Code compactDimColour = Colour::FileName; + #ifdef CATCH_PLATFORM_MAC static constexpr Catch::StringRef compactFailedString = "FAILED"_sr; static constexpr Catch::StringRef compactPassedString = "PASSED"_sr; @@ -52,11 +54,11 @@ namespace { // - 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) { +void printTotals(std::ostream& out, const Totals& totals, ColourImpl* colourImpl) { if (totals.testCases.total() == 0) { out << "No tests ran."; } else if (totals.testCases.failed == totals.testCases.total()) { - Colour colour(Colour::ResultError); + auto guard = colourImpl->guardColour( Colour::ResultError ).engage( out ); const StringRef qualify_assertions_failed = totals.assertions.failed == totals.assertions.total() ? bothOrAll(totals.assertions.failed) : StringRef{}; @@ -71,13 +73,11 @@ void printTotals(std::ostream& out, const Totals& totals) { << pluralise(totals.testCases.total(), "test case"_sr) << " (no assertions)."; } else if (totals.assertions.failed) { - Colour colour(Colour::ResultError); - out << + out << colourImpl->guardColour( Colour::ResultError ) << "Failed " << pluralise(totals.testCases.failed, "test case"_sr) << ", " "failed " << pluralise(totals.assertions.failed, "assertion"_sr) << '.'; } else { - Colour colour(Colour::ResultSuccess); - out << + out << colourImpl->guardColour( Colour::ResultSuccess ) << "Passed " << bothOrAll(totals.testCases.passed) << pluralise(totals.testCases.passed, "test case"_sr) << " with " << pluralise(totals.assertions.passed, "assertion"_sr) << '.'; @@ -89,12 +89,14 @@ class AssertionPrinter { public: AssertionPrinter& operator= (AssertionPrinter const&) = delete; AssertionPrinter(AssertionPrinter const&) = delete; - AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages, ColourImpl* colourImpl_) : stream(_stream) , result(_stats.assertionResult) , messages(_stats.infoMessages) , itMessage(_stats.infoMessages.begin()) - , printInfoMessages(_printInfoMessages) {} + , printInfoMessages(_printInfoMessages) + , colourImpl(colourImpl_) + {} void print() { printSourceInfo(); @@ -166,16 +168,13 @@ public: private: void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ':'; + stream << colourImpl->guardColour( Colour::FileName ) + << result.getSourceInfo() << ':'; } void printResultType(Colour::Code colour, StringRef passOrFail) const { if (!passOrFail.empty()) { - { - Colour colourGuard(colour); - stream << ' ' << passOrFail; - } + stream << colourImpl->guardColour(colour) << ' ' << passOrFail; stream << ':'; } } @@ -188,8 +187,7 @@ private: if (result.hasExpression()) { stream << ';'; { - Colour colour(dimColour()); - stream << " expression was:"; + stream << colourImpl->guardColour(compactDimColour) << " expression was:"; } printOriginalExpression(); } @@ -203,10 +201,7 @@ private: void printReconstructedExpression() const { if (result.hasExpandedExpression()) { - { - Colour colour(dimColour()); - stream << " for: "; - } + stream << colourImpl->guardColour(compactDimColour) << " for: "; stream << result.getExpandedExpression(); } } @@ -218,25 +213,22 @@ private: } } - void printRemainingMessages(Colour::Code colour = dimColour()) { + void printRemainingMessages(Colour::Code colour = compactDimColour) { 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"_sr) << ':'; - } + stream << colourImpl->guardColour( colour ) << " with " + << pluralise( N, "message"_sr ) << ':'; 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"; + stream << colourImpl->guardColour(compactDimColour) << " and"; } continue; } @@ -250,6 +242,7 @@ private: std::vector<MessageInfo> messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; + ColourImpl* colourImpl; }; } // anon namespace @@ -259,7 +252,17 @@ private: } void CompactReporter::noMatchingTestCases( StringRef unmatchedSpec ) { - stream << "No test cases matched '" << unmatchedSpec << "'\n"; + m_stream << "No test cases matched '" << unmatchedSpec << "'\n"; + } + + void CompactReporter::testRunStarting( TestRunInfo const& ) { + if ( m_config->testSpec().hasFilters() ) { + m_stream << m_colour->guardColour( Colour::BrightYellow ) + << "Filters: " + << serializeFilters( m_config->getTestsOrTags() ) + << '\n'; + } + m_stream << "RNG seed: " << getSeed() << '\n'; } void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { @@ -274,22 +277,22 @@ private: printInfoMessages = false; } - AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + AssertionPrinter printer( m_stream, _assertionStats, printInfoMessages, m_colour.get() ); printer.print(); - stream << '\n' << std::flush; + m_stream << '\n' << std::flush; } void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { double dur = _sectionStats.durationInSeconds; if ( shouldShowDuration( *m_config, dur ) ) { - stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; + m_stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; } } void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( stream, _testRunStats.totals ); - stream << "\n\n" << std::flush; + printTotals( m_stream, _testRunStats.totals, m_colour.get() ); + m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded( _testRunStats ); } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp index b39bd18ae264e890416cad430a9852614efc1eb9..6362fc2977ca2f2d3a276c24000afabc3d26232b 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp @@ -14,8 +14,8 @@ namespace Catch { - struct CompactReporter final : StreamingReporterBase { - + class CompactReporter final : public StreamingReporterBase { + public: using StreamingReporterBase::StreamingReporterBase; ~CompactReporter() override; @@ -24,6 +24,8 @@ namespace Catch { void noMatchingTestCases( StringRef unmatchedSpec ) override; + void testRunStarting( TestRunInfo const& _testInfo ) override; + void assertionEnded(AssertionStats const& _assertionStats) override; void sectionEnded(SectionStats const& _sectionStats) override; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp index d7c2dd5953cd51dc145131d668015caf9650c733..88d43b531fd4ca84c10b275780a5159257214127 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp @@ -13,12 +13,13 @@ #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_reusable_string_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 <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/catch_get_random_seed.hpp> #include <cstdio> @@ -45,13 +46,14 @@ class ConsoleAssertionPrinter { public: ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; - ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, ColourImpl* colourImpl_, bool _printInfoMessages) : stream(_stream), stats(_stats), result(_stats.assertionResult), colour(Colour::None), message(result.getMessage()), messages(_stats.infoMessages), + colourImpl(colourImpl_), printInfoMessages(_printInfoMessages) { switch (result.getResultType()) { case ResultWas::Ok: @@ -134,23 +136,22 @@ public: private: void printResultType() const { if (!passOrFail.empty()) { - Colour colourGuard(colour); - stream << passOrFail << ":\n"; + stream << colourImpl->guardColour(colour) << passOrFail << ":\n"; } } void printOriginalExpression() const { if (result.hasExpression()) { - Colour colourGuard(Colour::OriginalExpression); - stream << " "; - stream << result.getExpressionInMacro(); - stream << '\n'; + stream << colourImpl->guardColour( Colour::OriginalExpression ) + << " " << result.getExpressionInMacro() << '\n'; } } void printReconstructedExpression() const { if (result.hasExpandedExpression()) { stream << "with expansion:\n"; - Colour colourGuard(Colour::ReconstructedExpression); - stream << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; + stream << colourImpl->guardColour( Colour::ReconstructedExpression ) + << TextFlow::Column( result.getExpandedExpression() ) + .indent( 2 ) + << '\n'; } } void printMessage() const { @@ -163,8 +164,8 @@ private: } } void printSourceInfo() const { - Colour colourGuard(Colour::FileName); - stream << result.getSourceInfo() << ": "; + stream << colourImpl->guardColour( Colour::FileName ) + << result.getSourceInfo() << ": "; } std::ostream& stream; @@ -175,15 +176,16 @@ private: std::string messageLabel; std::string message; std::vector<MessageInfo> messages; + ColourImpl* colourImpl; 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 makeRatio( std::uint64_t number, std::uint64_t total ) { + const auto ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; + return (ratio == 0 && number > 0) ? 1 : static_cast<std::size_t>(ratio); } -std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { +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) @@ -196,7 +198,7 @@ enum class Justification { Left, Right }; struct ColumnInfo { std::string name; - int width; + std::size_t width; Justification justification; }; struct ColumnBreak {}; @@ -299,7 +301,8 @@ public: 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)); + assert(info.width > 2); + headerCols += TextFlow::Column(info.name).width(info.width - 2); headerCols += spacer; } m_os << headerCols << '\n'; @@ -333,7 +336,7 @@ public: tp.m_currentColumn++; auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; - auto padding = (strSize + 1 < static_cast<std::size_t>(colInfo.width)) + auto padding = (strSize + 1 < colInfo.width) ? std::string(colInfo.width - (strSize + 1), ' ') : std::string(); if (colInfo.justification == Justification::Left) @@ -352,9 +355,9 @@ public: } }; -ConsoleReporter::ConsoleReporter(ReporterConfig const& config) - : StreamingReporterBase(config), - m_tablePrinter(Detail::make_unique<TablePrinter>(config.stream(), +ConsoleReporter::ConsoleReporter(ReporterConfig&& config): + StreamingReporterBase( CATCH_MOVE( config ) ), + m_tablePrinter(Detail::make_unique<TablePrinter>(m_stream, [&config]() -> std::vector<ColumnInfo> { if (config.fullConfig()->benchmarkNoAnalysis()) { @@ -382,11 +385,11 @@ std::string ConsoleReporter::getDescription() { } void ConsoleReporter::noMatchingTestCases( StringRef unmatchedSpec ) { - stream << "No test cases matched '" << unmatchedSpec << "'\n"; + m_stream << "No test cases matched '" << unmatchedSpec << "'\n"; } -void ConsoleReporter::reportInvalidArguments( StringRef arg ) { - stream << "Invalid Filter: " << arg << '\n'; +void ConsoleReporter::reportInvalidTestSpec( StringRef arg ) { + m_stream << "Invalid Filter: " << arg << '\n'; } void ConsoleReporter::assertionStarting(AssertionInfo const&) {} @@ -402,9 +405,9 @@ void ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { lazyPrint(); - ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); + ConsoleAssertionPrinter printer(m_stream, _assertionStats, m_colour.get(), includeResults); printer.print(); - stream << '\n' << std::flush; + m_stream << '\n' << std::flush; } void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { @@ -416,16 +419,17 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { m_tablePrinter->close(); if (_sectionStats.missingAssertions) { lazyPrint(); - Colour colour(Colour::ResultError); + auto guard = + m_colour->guardColour( Colour::ResultError ).engage( m_stream ); if (m_sectionStack.size() > 1) - stream << "\nNo assertions in section"; + m_stream << "\nNo assertions in section"; else - stream << "\nNo assertions in test case"; - stream << " '" << _sectionStats.sectionInfo.name << "'\n\n" << std::flush; + m_stream << "\nNo assertions in test case"; + m_stream << " '" << _sectionStats.sectionInfo.name << "'\n\n" << std::flush; } double dur = _sectionStats.durationInSeconds; if (shouldShowDuration(*m_config, dur)) { - stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; + m_stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << '\n' << std::flush; } if (m_headerPrinted) { m_headerPrinted = false; @@ -437,8 +441,7 @@ void ConsoleReporter::benchmarkPreparing( StringRef name ) { lazyPrintWithoutClosingBenchmarkTable(); auto nameCol = TextFlow::Column( static_cast<std::string>( name ) ) - .width( static_cast<std::size_t>( - m_tablePrinter->columnInfos()[0].width - 2 ) ); + .width( m_tablePrinter->columnInfos()[0].width - 2 ); bool firstLine = true; for (auto line : nameCol) { @@ -475,7 +478,7 @@ void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) { } void ConsoleReporter::benchmarkFailed( StringRef error ) { - Colour colour(Colour::Red); + auto guard = m_colour->guardColour( Colour::Red ).engage( m_stream ); (*m_tablePrinter) << "Benchmark failed (" << error << ')' << ColumnBreak() << RowBreak(); @@ -489,12 +492,16 @@ void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { printTotalsDivider(_testRunStats.totals); printTotals(_testRunStats.totals); - stream << '\n' << std::flush; + m_stream << '\n' << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { StreamingReporterBase::testRunStarting(_testInfo); - printTestFilters(); + if ( m_config->testSpec().hasFilters() ) { + m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " + << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + } + m_stream << "Randomness seeded to: " << getSeed() << '\n'; } void ConsoleReporter::lazyPrint() { @@ -505,7 +512,7 @@ void ConsoleReporter::lazyPrint() { void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { - if ( !currentTestRunInfo.used ) { + if ( !m_testRunInfoPrinted ) { lazyPrintRunInfo(); } if (!m_headerPrinted) { @@ -514,23 +521,21 @@ void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { } } 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; + m_stream << '\n' + << lineOfChars( '~' ) << '\n' + << m_colour->guardColour( Colour::SecondaryText ) + << currentTestRunInfo.name << " is a Catch2 v" << libraryVersion() + << " host application.\n" + << "Run with -? for options\n\n"; + + m_testRunInfoPrinted = true; } void ConsoleReporter::printTestCaseAndSectionHeader() { assert(!m_sectionStack.empty()); printOpenHeader(currentTestCaseInfo->name); if (m_sectionStack.size() > 1) { - Colour colourGuard(Colour::Headers); + auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream ); auto it = m_sectionStack.begin() + 1, // Skip first section (test case) @@ -542,33 +547,55 @@ void ConsoleReporter::printTestCaseAndSectionHeader() { SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; - stream << lineOfChars('-') << '\n'; - Colour colourGuard(Colour::FileName); - stream << lineInfo << '\n'; - stream << lineOfChars('.') << "\n\n" << std::flush; + m_stream << lineOfChars( '-' ) << '\n' + << m_colour->guardColour( Colour::FileName ) << lineInfo << '\n' + << lineOfChars( '.' ) << "\n\n" + << std::flush; } void ConsoleReporter::printClosedHeader(std::string const& _name) { printOpenHeader(_name); - stream << lineOfChars('.') << '\n'; + m_stream << lineOfChars('.') << '\n'; } void ConsoleReporter::printOpenHeader(std::string const& _name) { - stream << lineOfChars('-') << '\n'; + m_stream << lineOfChars('-') << '\n'; { - Colour colourGuard(Colour::Headers); + auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream ); 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'; + // We want to get a bit fancy with line breaking here, so that subsequent + // lines start after ":" if one is present, e.g. + // ``` + // blablabla: Fancy + // linebreaking + // ``` + // but we also want to avoid problems with overly long indentation causing + // the text to take up too many lines, e.g. + // ``` + // blablabla: F + // a + // n + // c + // y + // . + // . + // . + // ``` + // So we limit the prefix indentation check to first quarter of the possible + // width + std::size_t idx = _string.find( ": " ); + if ( idx != std::string::npos && idx < CATCH_CONFIG_CONSOLE_WIDTH / 4 ) { + idx += 2; + } else { + idx = 0; + } + m_stream << TextFlow::Column( _string ) + .indent( indent + idx ) + .initialIndent( indent ) + << '\n'; } struct SummaryColumn { @@ -576,7 +603,7 @@ struct SummaryColumn { SummaryColumn( std::string _label, Colour::Code _colour ) : label( CATCH_MOVE( _label ) ), colour( _colour ) {} - SummaryColumn addRow( std::size_t count ) { + SummaryColumn addRow( std::uint64_t count ) { ReusableStringStream rss; rss << count; std::string row = rss.str(); @@ -598,10 +625,12 @@ struct SummaryColumn { void ConsoleReporter::printTotals( Totals const& totals ) { if (totals.testCases.total() == 0) { - stream << Colour(Colour::Warning) << "No tests ran\n"; + m_stream << m_colour->guardColour( Colour::Warning ) + << "No tests ran\n"; } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { - stream << Colour(Colour::ResultSuccess) << "All tests passed"; - stream << " (" + m_stream << m_colour->guardColour( Colour::ResultSuccess ) + << "All tests passed"; + m_stream << " (" << pluralise(totals.assertions.passed, "assertion"_sr) << " in " << pluralise(totals.testCases.passed, "test case"_sr) << ')' << '\n'; @@ -627,20 +656,22 @@ void ConsoleReporter::printTotals( Totals const& totals ) { } void ConsoleReporter::printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row) { for (auto col : cols) { - std::string value = col.rows[row]; + std::string const& value = col.rows[row]; if (col.label.empty()) { - stream << label << ": "; - if (value != "0") - stream << value; - else - stream << Colour(Colour::Warning) << "- none -"; + m_stream << label << ": "; + if ( value != "0" ) { + m_stream << value; + } else { + m_stream << m_colour->guardColour( Colour::Warning ) + << "- none -"; + } } else if (value != "0") { - stream << Colour(Colour::LightGrey) << " | "; - stream << Colour(col.colour) - << value << ' ' << col.label; + m_stream << m_colour->guardColour( Colour::LightGrey ) << " | " + << m_colour->guardColour( col.colour ) << value << ' ' + << col.label; } } - stream << '\n'; + m_stream << '\n'; } void ConsoleReporter::printTotalsDivider(Totals const& totals) { @@ -653,26 +684,25 @@ void ConsoleReporter::printTotalsDivider(Totals const& totals) { 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, '='); + m_stream << m_colour->guardColour( Colour::Error ) + << std::string( failedRatio, '=' ) + << m_colour->guardColour( Colour::ResultExpectedFailure ) + << std::string( failedButOkRatio, '=' ); + if ( totals.testCases.allPassed() ) { + m_stream << m_colour->guardColour( Colour::ResultSuccess ) + << std::string( passedRatio, '=' ); + } else { + m_stream << m_colour->guardColour( Colour::Success ) + << std::string( passedRatio, '=' ); + } } else { - stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); + m_stream << m_colour->guardColour( Colour::Warning ) + << std::string( CATCH_CONFIG_CONSOLE_WIDTH - 1, '=' ); } - stream << '\n'; + m_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'; - } + m_stream << lineOfChars('-') << '\n'; } } // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp index ec7430935205769d18d36d91c82394c209d59bfa..719dcc449f73e6aea7d66a9d3928055529509129 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp @@ -16,15 +16,16 @@ namespace Catch { struct SummaryColumn; class TablePrinter; - struct ConsoleReporter final : StreamingReporterBase { + class ConsoleReporter final : public StreamingReporterBase { Detail::unique_ptr<TablePrinter> m_tablePrinter; - ConsoleReporter(ReporterConfig const& config); + public: + ConsoleReporter(ReporterConfig&& config); ~ConsoleReporter() override; static std::string getDescription(); void noMatchingTestCases( StringRef unmatchedSpec ) override; - void reportInvalidArguments( StringRef arg ) override; + void reportInvalidTestSpec( StringRef arg ) override; void assertionStarting(AssertionInfo const&) override; @@ -41,8 +42,8 @@ namespace Catch { void testCaseEnded(TestCaseStats const& _testCaseStats) override; void testRunEnded(TestRunStats const& _testRunStats) override; void testRunStarting(TestRunInfo const& _testRunInfo) override; - private: + private: void lazyPrint(); void lazyPrintWithoutClosingBenchmarkTable(); @@ -62,10 +63,9 @@ namespace Catch { void printTotalsDivider(Totals const& totals); void printSummaryDivider(); - void printTestFilters(); - private: bool m_headerPrinted = false; + bool m_testRunInfoPrinted = false; }; } // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp index 64afac18c93d8303919eba2208b76acfb72dac9c..957880d09ddfd548007f2f6fa8d47de469fe3255 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp @@ -6,7 +6,8 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/reporters/catch_reporter_cumulative_base.hpp> -#include <catch2/reporters/catch_reporter_helpers.hpp> + +#include <catch2/internal/catch_move_and_forward.hpp> #include <algorithm> #include <cassert> @@ -32,9 +33,41 @@ namespace Catch { } // namespace + namespace Detail { + AssertionOrBenchmarkResult::AssertionOrBenchmarkResult( + AssertionStats const& assertion ): + m_assertion( assertion ) {} + + AssertionOrBenchmarkResult::AssertionOrBenchmarkResult( + BenchmarkStats<> const& benchmark ): + m_benchmark( benchmark ) {} + + bool AssertionOrBenchmarkResult::isAssertion() const { + return m_assertion.some(); + } + bool AssertionOrBenchmarkResult::isBenchmark() const { + return m_benchmark.some(); + } + + AssertionStats const& AssertionOrBenchmarkResult::asAssertion() const { + assert(m_assertion.some()); + + return *m_assertion; + } + BenchmarkStats<> const& AssertionOrBenchmarkResult::asBenchmark() const { + assert(m_benchmark.some()); + + return *m_benchmark; + } + + } CumulativeReporterBase::~CumulativeReporterBase() = default; + void CumulativeReporterBase::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { + m_sectionStack.back()->assertionsAndBenchmarks.emplace_back(benchmarkStats); + } + void CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) { SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); @@ -72,10 +105,18 @@ namespace Catch { // 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() ); + if ( m_shouldStoreFailedAssertions && + !assertionStats.assertionResult.isOk() ) { + static_cast<void>( + assertionStats.assertionResult.getExpandedExpression() ); + } + if ( m_shouldStoreSuccesfulAssertions && + assertionStats.assertionResult.isOk() ) { + static_cast<void>( + assertionStats.assertionResult.getExpandedExpression() ); + } SectionNode& sectionNode = *m_sectionStack.back(); - sectionNode.assertions.push_back( assertionStats ); + sectionNode.assertionsAndBenchmarks.emplace_back( assertionStats ); } void CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) { @@ -105,19 +146,13 @@ namespace Catch { 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() ); + bool CumulativeReporterBase::SectionNode::hasAnyAssertions() const { + return std::any_of( + assertionsAndBenchmarks.begin(), + assertionsAndBenchmarks.end(), + []( Detail::AssertionOrBenchmarkResult const& res ) { + return res.isAssertion(); + } ); } } // 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 index a6acc54f75b9c3750c9b9c66ed5d05608260f8cf..c4dcdae0365c0b06dfa2205c642c76efee727f17 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -9,15 +9,59 @@ #define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED #include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/reporters/catch_reporter_common_base.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_optional.hpp> -#include <iosfwd> #include <string> #include <vector> namespace Catch { - struct CumulativeReporterBase : IStreamingReporter { + namespace Detail { + + //! Represents either an assertion or a benchmark result to be handled by cumulative reporter later + class AssertionOrBenchmarkResult { + // This should really be a variant, but this is much faster + // to write and the data layout here is already terrible + // enough that we do not have to care about the object size. + Optional<AssertionStats> m_assertion; + Optional<BenchmarkStats<>> m_benchmark; + public: + AssertionOrBenchmarkResult(AssertionStats const& assertion); + AssertionOrBenchmarkResult(BenchmarkStats<> const& benchmark); + + bool isAssertion() const; + bool isBenchmark() const; + + AssertionStats const& asAssertion() const; + BenchmarkStats<> const& asBenchmark() const; + }; + } + + /** + * Utility base for reporters that need to handle all results at once + * + * It stores tree of all test cases, sections and assertions, and after the + * test run is finished, calls into `testRunEndedCumulative` to pass the + * control to the deriving class. + * + * If you are deriving from this class and override any testing related + * member functions, you should first call into the base's implementation to + * avoid breaking the tree construction. + * + * Due to the way this base functions, it has to expand assertions up-front, + * even if they are later unused (e.g. because the deriving reporter does + * not report successful assertions, or because the deriving reporter does + * not use assertion expansion at all). Derived classes can use two + * customization points, `m_shouldStoreSuccesfulAssertions` and + * `m_shouldStoreFailedAssertions`, to disable the expansion and gain extra + * performance. **Accessing the assertion expansions if it wasn't stored is + * UB.** + */ + class CumulativeReporterBase : public ReporterBase { + public: template<typename T, typename ChildNodeT> struct Node { explicit Node( T const& _value ) : value( _value ) {} @@ -33,9 +77,11 @@ namespace Catch { return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; } + bool hasAnyAssertions() const; + SectionStats stats; std::vector<Detail::unique_ptr<SectionNode>> childSections; - std::vector<AssertionStats> assertions; + std::vector<Detail::AssertionOrBenchmarkResult> assertionsAndBenchmarks; std::string stdOut; std::string stdErr; }; @@ -44,21 +90,22 @@ namespace Catch { using TestCaseNode = Node<TestCaseStats, SectionNode>; using TestRunNode = Node<TestRunStats, TestCaseNode>; - CumulativeReporterBase( ReporterConfig const& _config ): - IStreamingReporter( _config.fullConfig() ), - stream( _config.stream() ) {} + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + CumulativeReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~CumulativeReporterBase() override; void benchmarkPreparing( StringRef ) override {} void benchmarkStarting( BenchmarkInfo const& ) override {} - void benchmarkEnded( BenchmarkStats<> const& ) override {} + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; void benchmarkFailed( StringRef ) override {} void noMatchingTestCases( StringRef ) override {} - void reportInvalidArguments( StringRef ) override {} + void reportInvalidTestSpec( StringRef ) override {} void fatalErrorEncountered( StringRef /*error*/ ) override {} - void testRunStarting( TestRunInfo const& ) override {} void testCaseStarting( TestCaseInfo const& ) override {} @@ -77,21 +124,26 @@ namespace Catch { 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; - protected: - std::ostream& stream; - // Note: We rely on pointer identity being stable, which is why - // we store pointers to the nodes rather than the values. - std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases; + //! Should the cumulative base store the assertion expansion for succesful assertions? + bool m_shouldStoreSuccesfulAssertions = true; + //! Should the cumulative base store the assertion expansion for failed assertions? + bool m_shouldStoreFailedAssertions = true; + // We need lazy construction here. We should probably refactor it // later, after the events are redone. + //! The root node of the test run tree. Detail::unique_ptr<TestRunNode> m_testRun; + private: + // Note: We rely on pointer identity being stable, which is why + // we store pointers to the nodes rather than the values. + std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases; + // Root section of the _current_ test case Detail::unique_ptr<SectionNode> m_rootSection; + // Deepest section of the _current_ test case SectionNode* m_deepestSection = nullptr; + // Stack of _active_ sections in the _current_ test case std::vector<SectionNode*> m_sectionStack; }; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a997a315d667aac202e3f0f124938f153023f318 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.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/reporters/catch_reporter_event_listener.hpp> + +namespace Catch { + + void EventListenerBase::fatalErrorEncountered( StringRef ) {} + + void EventListenerBase::benchmarkPreparing( StringRef ) {} + void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {} + void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {} + void EventListenerBase::benchmarkFailed( StringRef ) {} + + void EventListenerBase::assertionStarting( AssertionInfo const& ) {} + + void EventListenerBase::assertionEnded( AssertionStats const& ) {} + void EventListenerBase::listReporters( + std::vector<ReporterDescription> const& ) {} + void EventListenerBase::listListeners( + std::vector<ListenerDescription> const& ) {} + void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {} + void EventListenerBase::listTags( std::vector<TagInfo> const& ) {} + void EventListenerBase::noMatchingTestCases( StringRef ) {} + void EventListenerBase::reportInvalidTestSpec( StringRef ) {} + void EventListenerBase::testRunStarting( TestRunInfo const& ) {} + void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} + void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {} + void EventListenerBase::sectionStarting( SectionInfo const& ) {} + void EventListenerBase::sectionEnded( SectionStats const& ) {} + void EventListenerBase::testCasePartialEnded(TestCaseStats const&, uint64_t) {} + void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} + void EventListenerBase::testRunEnded( TestRunStats const& ) {} + void EventListenerBase::skipTest( TestCaseInfo const& ) {} +} // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp index d2cccb6be0cc8f58bcdc1db9cb2f52825ddec587..3a6d822cc3432e2a2f9eaec68b98107fdc7b70ab 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp @@ -13,18 +13,17 @@ namespace Catch { /** - * Base class identifying listeners. + * Base class to simplify implementing listeners. * - * Provides empty default implementation for all IStreamingReporter member - * functions, so that listeners implementations can pick which + * Provides empty default implementation for all IEventListener member + * functions, so that a listener implementation can pick which * member functions it actually cares about. */ - class EventListenerBase : public IStreamingReporter { + class EventListenerBase : public IEventListener { public: - EventListenerBase( ReporterConfig const& config ): - IStreamingReporter( config.fullConfig() ) {} + using IEventListener::IEventListener; - void reportInvalidArguments( StringRef unmatchedSpec ) override; + void reportInvalidTestSpec( StringRef unmatchedSpec ) override; void fatalErrorEncountered( StringRef error ) override; void benchmarkPreparing( StringRef name ) override; @@ -37,6 +36,8 @@ namespace Catch { void listReporters( std::vector<ReporterDescription> const& descriptions ) override; + void listListeners( + std::vector<ListenerDescription> const& descriptions ) override; void listTests( std::vector<TestCaseHandle> const& tests ) override; void listTags( std::vector<TagInfo> const& tagInfos ) override; @@ -52,7 +53,6 @@ namespace Catch { void testCaseEnded( TestCaseStats const& testCaseStats ) override; void testRunEnded( TestRunStats const& testRunStats ) override; void skipTest( TestCaseInfo const& testInfo ) override; - }; } // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp similarity index 74% rename from packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp rename to packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp index 2ca76c9351c3c4024e3d0e418ef235e75f31ea14..31df851a834b64ec6916dfebe043057f1bfc3588 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp @@ -5,24 +5,13 @@ // 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_reusable_string_stream.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_console_colour.hpp> #include <catch2/catch_tostring.hpp> @@ -139,7 +128,7 @@ namespace Catch { .width( 5 + maxNameLen ) << '\n'; } else { - out << TextFlow::Column( desc.name + ":" ) + out << TextFlow::Column( desc.name + ':' ) .indent( 2 ) .width( 5 + maxNameLen ) + TextFlow::Column( desc.description ) @@ -152,6 +141,38 @@ namespace Catch { out << '\n' << std::flush; } + void defaultListListeners( std::ostream& out, + std::vector<ListenerDescription> const& descriptions ) { + out << "Registered listeners:\n"; + + if(descriptions.empty()) { + return; + } + + const auto maxNameLen = + std::max_element( descriptions.begin(), + descriptions.end(), + []( ListenerDescription const& lhs, + ListenerDescription const& rhs ) { + return lhs.name.size() < rhs.name.size(); + } ) + ->name.size(); + + for ( auto const& desc : descriptions ) { + out << TextFlow::Column( static_cast<std::string>( desc.name ) + + ':' ) + .indent( 2 ) + .width( maxNameLen + 5 ) + + 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 ) { @@ -174,7 +195,7 @@ namespace Catch { out << pluralise(tags.size(), "tag"_sr) << "\n\n" << std::flush; } - void defaultListTests(std::ostream& out, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity) { + void defaultListTests(std::ostream& out, ColourImpl* streamColour, 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. @@ -194,9 +215,9 @@ namespace Catch { Colour::Code colour = testCaseInfo.isHidden() ? Colour::SecondaryText : Colour::None; - Colour colourGuard(colour); + auto colourGuard = streamColour->guardColour( colour ).engage( out ); - out << TextFlow::Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; + out << TextFlow::Column(testCaseInfo.name).indent(2) << '\n'; if (verbosity >= Verbosity::High) { out << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << '\n'; } @@ -215,35 +236,3 @@ namespace Catch { } } // namespace Catch - - -#include <catch2/reporters/catch_reporter_event_listener.hpp> - -namespace Catch { - - void EventListenerBase::fatalErrorEncountered( StringRef ) {} - - void EventListenerBase::benchmarkPreparing( StringRef ) {} - void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {} - void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {} - void EventListenerBase::benchmarkFailed( StringRef ) {} - - void EventListenerBase::assertionStarting( AssertionInfo const& ) {} - - void EventListenerBase::assertionEnded( AssertionStats const& ) {} - void EventListenerBase::listReporters( - std::vector<ReporterDescription> const& ) {} - void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {} - void EventListenerBase::listTags( std::vector<TagInfo> const& ) {} - void EventListenerBase::noMatchingTestCases( StringRef ) {} - void EventListenerBase::reportInvalidArguments( StringRef ) {} - void EventListenerBase::testRunStarting( TestRunInfo const& ) {} - void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} - void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {} - void EventListenerBase::sectionStarting( SectionInfo const& ) {} - void EventListenerBase::sectionEnded( SectionStats const& ) {} - void EventListenerBase::testCasePartialEnded(TestCaseStats const&, uint64_t) {} - void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} - void EventListenerBase::testRunEnded( TestRunStats const& ) {} - void EventListenerBase::skipTest( TestCaseInfo const& ) {} -} // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp index d16d92f207753780c274a814b2bb778f5cca9ee3..ef43534cba82150c28ce7f073c9f338f6138f134 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp @@ -17,8 +17,9 @@ namespace Catch { - struct IConfig; + class IConfig; class TestCaseHandle; + class ColourImpl; // Returns double formatted as %.3f (format expected on output) std::string getFormattedDuration( double duration ); @@ -48,6 +49,13 @@ namespace Catch { std::vector<ReporterDescription> const& descriptions, Verbosity verbosity ); + /** + * Lists listeners descriptions to the provided stream in user-friendly + * format + */ + void defaultListListeners( std::ostream& out, + std::vector<ListenerDescription> const& descriptions ); + /** * Lists tag information to the provided stream in user-friendly format * @@ -67,6 +75,7 @@ namespace Catch { * `--list-test-names-only` option, for people who used it in integrations. */ void defaultListTests( std::ostream& out, + ColourImpl* streamColour, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity ); diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp index f7420b7ada063b1b48a8d9f68eeb65015fd86a09..c24d1efa253d3226fab22393814bd31a36658367 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp @@ -13,10 +13,12 @@ #include <catch2/internal/catch_textflow.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> #include <cassert> #include <ctime> #include <algorithm> +#include <iomanip> namespace Catch { @@ -54,14 +56,35 @@ namespace Catch { } return std::string(); } + + // Formats the duration in seconds to 3 decimal places. + // This is done because some genius defined Maven Surefire schema + // in a way that only accepts 3 decimal places, and tools like + // Jenkins use that schema for validation JUnit reporter output. + std::string formatDuration( double seconds ) { + ReusableStringStream rss; + rss << std::fixed << std::setprecision( 3 ) << seconds; + return rss.str(); + } + + static void normalizeNamespaceMarkers(std::string& str) { + std::size_t pos = str.find( "::" ); + while ( pos != str.npos ) { + str.replace( pos, 2, "." ); + pos += 1; + pos = str.find( "::", pos ); + } + } + } // anonymous namespace - JunitReporter::JunitReporter( ReporterConfig const& _config ) - : CumulativeReporterBase( _config ), - xml( _config.stream() ) + JunitReporter::JunitReporter( ReporterConfig&& _config ) + : CumulativeReporterBase( CATCH_MOVE(_config) ), + xml( m_stream ) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; + m_shouldStoreSuccesfulAssertions = false; } std::string JunitReporter::getDescription() { @@ -111,22 +134,20 @@ namespace Catch { if( m_config->showDurations() == ShowDurations::Never ) xml.writeAttribute( "time"_sr, ""_sr ); else - xml.writeAttribute( "time"_sr, suiteTime ); + xml.writeAttribute( "time"_sr, formatDuration( suiteTime ) ); xml.writeAttribute( "timestamp"_sr, getCurrentTimestamp() ); - // Write properties if there are any - if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + // Write properties + { auto properties = xml.scopedElement("properties"); + xml.scopedElement("property") + .writeAttribute("name"_sr, "random-seed"_sr) + .writeAttribute("value"_sr, m_config->rngSeed()); if (m_config->hasTestFilters()) { xml.scopedElement("property") .writeAttribute("name"_sr, "filters"_sr) .writeAttribute("value"_sr, serializeFilters(m_config->getTestsOrTags())); } - if (m_config->rngSeed() != 0) { - xml.scopedElement("property") - .writeAttribute("name"_sr, "random-seed"_sr) - .writeAttribute("value"_sr, m_config->rngSeed()); - } } // Write test cases @@ -145,30 +166,35 @@ namespace Catch { assert( testCaseNode.children.size() == 1 ); SectionNode const& rootSection = *testCaseNode.children.front(); - std::string className = stats.testInfo->className; + std::string className = + static_cast<std::string>( stats.testInfo->className ); if( className.empty() ) { className = fileNameTag(stats.testInfo->tags); - if ( className.empty() ) + if ( className.empty() ) { className = "global"; + } } if ( !m_config->name().empty() ) - className = m_config->name() + "." + className; + className = static_cast<std::string>(m_config->name()) + '.' + className; - writeSection( className, "", rootSection ); + normalizeNamespaceMarkers(className); + + writeSection( className, "", rootSection, stats.testInfo->okToFail() ); } - void JunitReporter::writeSection( std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode ) { + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode, + bool testOkToFail) { std::string name = trim( sectionNode.stats.sectionInfo.name ); if( !rootName.empty() ) name = rootName + '/' + name; - if( !sectionNode.assertions.empty() || - !sectionNode.stdOut.empty() || - !sectionNode.stdErr.empty() ) { + if( sectionNode.hasAnyAssertions() + || !sectionNode.stdOut.empty() + || !sectionNode.stdErr.empty() ) { XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); if( className.empty() ) { xml.writeAttribute( "classname"_sr, name ); @@ -178,15 +204,21 @@ namespace Catch { xml.writeAttribute( "classname"_sr, className ); xml.writeAttribute( "name"_sr, name ); } - xml.writeAttribute( "time"_sr, ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); + xml.writeAttribute( "time"_sr, formatDuration( 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"_sr, "run"_sr ); + if (sectionNode.stats.assertions.failedButOk) { + xml.scopedElement("skipped") + .writeAttribute("message", "TEST_CASE tagged with !mayfail"); + } + writeAssertions( sectionNode ); + if( !sectionNode.stdOut.empty() ) xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); if( !sectionNode.stdErr.empty() ) @@ -194,14 +226,17 @@ namespace Catch { } for( auto const& childNode : sectionNode.childSections ) if( className.empty() ) - writeSection( name, "", *childNode ); + writeSection( name, "", *childNode, testOkToFail ); else - writeSection( className, name, *childNode ); + writeSection( className, name, *childNode, testOkToFail ); } void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { - for( auto const& assertion : sectionNode.assertions ) - writeAssertion( assertion ); + for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) { + if (assertionOrBenchmark.isAssertion()) { + writeAssertion(assertionOrBenchmark.asAssertion()); + } + } } void JunitReporter::writeAssertion( AssertionStats const& stats ) { diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp index 6665663cee03082d05cf3b7a4d8b29c9f85c5916..a45344de6f8167a59273b3f207a4c1e50a46a723 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp @@ -17,7 +17,7 @@ namespace Catch { class JunitReporter final : public CumulativeReporterBase { public: - JunitReporter(ReporterConfig const& _config); + JunitReporter(ReporterConfig&& _config); ~JunitReporter() override = default; @@ -39,7 +39,8 @@ namespace Catch { void writeSection( std::string const& className, std::string const& rootName, - SectionNode const& sectionNode ); + SectionNode const& sectionNode, + bool testOkToFail ); void writeAssertions(SectionNode const& sectionNode); void writeAssertion(AssertionStats const& stats); diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp deleted file mode 100644 index f233b0a2ec3f97d67e4d6e11d3c82688b35f0964..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp +++ /dev/null @@ -1,175 +0,0 @@ - -// 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 <catch2/internal/catch_move_and_forward.hpp> - -#include <cassert> - -namespace Catch { - - void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { - m_listeners.push_back( CATCH_MOVE( listener ) ); - } - - void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { - assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); - m_reporter = CATCH_MOVE( reporter ); - m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; - } - - void ListeningReporter::noMatchingTestCases( StringRef unmatchedSpec ) { - for ( auto& listener : m_listeners ) { - listener->noMatchingTestCases( unmatchedSpec ); - } - m_reporter->noMatchingTestCases( unmatchedSpec ); - } - - void ListeningReporter::fatalErrorEncountered( StringRef error ) { - for ( auto& listener : m_listeners ) { - listener->fatalErrorEncountered( error ); - } - m_reporter->fatalErrorEncountered( error ); - } - - void ListeningReporter::reportInvalidArguments( StringRef arg ) { - for ( auto& listener : m_listeners ) { - listener->reportInvalidArguments( arg ); - } - m_reporter->reportInvalidArguments( arg ); - } - - void ListeningReporter::benchmarkPreparing( StringRef name ) { - for (auto& listener : m_listeners) { - listener->benchmarkPreparing(name); - } - m_reporter->benchmarkPreparing(name); - } - void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { - for ( auto& listener : m_listeners ) { - listener->benchmarkStarting( benchmarkInfo ); - } - m_reporter->benchmarkStarting( benchmarkInfo ); - } - void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { - for ( auto& listener : m_listeners ) { - listener->benchmarkEnded( benchmarkStats ); - } - m_reporter->benchmarkEnded( benchmarkStats ); - } - - void ListeningReporter::benchmarkFailed( StringRef error ) { - for (auto& listener : m_listeners) { - listener->benchmarkFailed(error); - } - m_reporter->benchmarkFailed(error); - } - - void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { - for ( auto& listener : m_listeners ) { - listener->testRunStarting( testRunInfo ); - } - m_reporter->testRunStarting( testRunInfo ); - } - - void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - for ( auto& listener : m_listeners ) { - listener->testCaseStarting( testInfo ); - } - m_reporter->testCaseStarting( testInfo ); - } - - void - ListeningReporter::testCasePartialStarting( TestCaseInfo const& testInfo, - uint64_t partNumber ) { - for ( auto& listener : m_listeners ) { - listener->testCasePartialStarting( testInfo, partNumber ); - } - m_reporter->testCasePartialStarting( testInfo, partNumber ); - } - - void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { - for ( auto& listener : m_listeners ) { - listener->sectionStarting( sectionInfo ); - } - m_reporter->sectionStarting( sectionInfo ); - } - - void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { - for ( auto& listener : m_listeners ) { - listener->assertionStarting( assertionInfo ); - } - m_reporter->assertionStarting( assertionInfo ); - } - - // The return value indicates if the messages buffer should be cleared: - void ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { - for( auto& listener : m_listeners ) { - listener->assertionEnded( assertionStats ); - } - m_reporter->assertionEnded( assertionStats ); - } - - void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { - for ( auto& listener : m_listeners ) { - listener->sectionEnded( sectionStats ); - } - m_reporter->sectionEnded( sectionStats ); - } - - void ListeningReporter::testCasePartialEnded( TestCaseStats const& testInfo, - uint64_t partNumber ) { - for ( auto& listener : m_listeners ) { - listener->testCasePartialEnded( testInfo, partNumber ); - } - m_reporter->testCasePartialEnded( testInfo, partNumber ); - } - - void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - for ( auto& listener : m_listeners ) { - listener->testCaseEnded( testCaseStats ); - } - m_reporter->testCaseEnded( testCaseStats ); - } - - void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { - for ( auto& listener : m_listeners ) { - listener->testRunEnded( testRunStats ); - } - m_reporter->testRunEnded( testRunStats ); - } - - - void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { - for ( auto& listener : m_listeners ) { - listener->skipTest( testInfo ); - } - m_reporter->skipTest( testInfo ); - } - - void ListeningReporter::listReporters(std::vector<ReporterDescription> const& descriptions) { - for (auto& listener : m_listeners) { - listener->listReporters(descriptions); - } - m_reporter->listReporters(descriptions); - } - - void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests) { - for (auto& listener : m_listeners) { - listener->listTests(tests); - } - m_reporter->listTests(tests); - } - - void ListeningReporter::listTags(std::vector<TagInfo> const& tags) { - for (auto& listener : m_listeners) { - listener->listTags(tags); - } - m_reporter->listTags(tags); - } - -} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cf18cb81b0373de0c052bc6174d476d82d8a8721 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp @@ -0,0 +1,198 @@ + +// 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_multi.hpp> + +#include <catch2/catch_config.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_stdstreams.hpp> + +#include <ostream> + +namespace Catch { + void MultiReporter::updatePreferences(IEventListener const& reporterish) { + m_preferences.shouldRedirectStdOut |= + reporterish.getPreferences().shouldRedirectStdOut; + m_preferences.shouldReportAllAssertions |= + reporterish.getPreferences().shouldReportAllAssertions; + } + + void MultiReporter::addListener( IEventListenerPtr&& listener ) { + updatePreferences(*listener); + m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) ); + ++m_insertedListeners; + } + + void MultiReporter::addReporter( IEventListenerPtr&& reporter ) { + updatePreferences(*reporter); + + // We will need to output the captured stdout if there are reporters + // that do not want it captured. + // We do not consider listeners, because it is generally assumed that + // listeners are output-transparent, even though they can ask for stdout + // capture to do something with it. + m_haveNoncapturingReporters |= !reporter->getPreferences().shouldRedirectStdOut; + + // Reporters can always be placed to the back without breaking the + // reporting order + m_reporterLikes.push_back( CATCH_MOVE( reporter ) ); + } + + void MultiReporter::noMatchingTestCases( StringRef unmatchedSpec ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->noMatchingTestCases( unmatchedSpec ); + } + } + + void MultiReporter::fatalErrorEncountered( StringRef error ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->fatalErrorEncountered( error ); + } + } + + void MultiReporter::reportInvalidTestSpec( StringRef arg ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->reportInvalidTestSpec( arg ); + } + } + + void MultiReporter::benchmarkPreparing( StringRef name ) { + for (auto& reporterish : m_reporterLikes) { + reporterish->benchmarkPreparing(name); + } + } + void MultiReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->benchmarkStarting( benchmarkInfo ); + } + } + void MultiReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->benchmarkEnded( benchmarkStats ); + } + } + + void MultiReporter::benchmarkFailed( StringRef error ) { + for (auto& reporterish : m_reporterLikes) { + reporterish->benchmarkFailed(error); + } + } + + void MultiReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testRunStarting( testRunInfo ); + } + } + + void MultiReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCaseStarting( testInfo ); + } + } + + void + MultiReporter::testCasePartialStarting( TestCaseInfo const& testInfo, + uint64_t partNumber ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCasePartialStarting( testInfo, partNumber ); + } + } + + void MultiReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->sectionStarting( sectionInfo ); + } + } + + void MultiReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->assertionStarting( assertionInfo ); + } + } + + // The return value indicates if the messages buffer should be cleared: + void MultiReporter::assertionEnded( AssertionStats const& assertionStats ) { + const bool reportByDefault = + assertionStats.assertionResult.getResultType() != ResultWas::Ok || + m_config->includeSuccessfulResults(); + + for ( auto & reporterish : m_reporterLikes ) { + if ( reportByDefault || + reporterish->getPreferences().shouldReportAllAssertions ) { + reporterish->assertionEnded( assertionStats ); + } + } + } + + void MultiReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->sectionEnded( sectionStats ); + } + } + + void MultiReporter::testCasePartialEnded( TestCaseStats const& testStats, + uint64_t partNumber ) { + if ( m_preferences.shouldRedirectStdOut && + m_haveNoncapturingReporters ) { + if ( !testStats.stdOut.empty() ) { + Catch::cout() << testStats.stdOut << std::flush; + } + if ( !testStats.stdErr.empty() ) { + Catch::cerr() << testStats.stdErr << std::flush; + } + } + + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCasePartialEnded( testStats, partNumber ); + } + } + + void MultiReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testCaseEnded( testCaseStats ); + } + } + + void MultiReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->testRunEnded( testRunStats ); + } + } + + + void MultiReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->skipTest( testInfo ); + } + } + + void MultiReporter::listReporters(std::vector<ReporterDescription> const& descriptions) { + for (auto& reporterish : m_reporterLikes) { + reporterish->listReporters(descriptions); + } + } + + void MultiReporter::listListeners( + std::vector<ListenerDescription> const& descriptions ) { + for ( auto& reporterish : m_reporterLikes ) { + reporterish->listListeners( descriptions ); + } + } + + void MultiReporter::listTests(std::vector<TestCaseHandle> const& tests) { + for (auto& reporterish : m_reporterLikes) { + reporterish->listTests(tests); + } + } + + void MultiReporter::listTags(std::vector<TagInfo> const& tags) { + for (auto& reporterish : m_reporterLikes) { + reporterish->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_multi.hpp similarity index 62% rename from packages/Catch2/src/catch2/reporters/catch_reporter_listening.hpp rename to packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp index caa5c1a84540ce176cd8bd313b28a102546a2545..e35ea5041e8fb024ef524c54f6906f6cc6681f6d 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_listening.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp @@ -5,34 +5,40 @@ // 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 +#ifndef CATCH_REPORTER_MULTI_HPP_INCLUDED +#define CATCH_REPORTER_MULTI_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; + class MultiReporter final : public IEventListener { + /* + * Stores all added reporters and listeners + * + * All Listeners are stored before all reporters, and individual + * listeners/reporters are stored in order of insertion. + */ + std::vector<IEventListenerPtr> m_reporterLikes; + bool m_haveNoncapturingReporters = false; - public: - ListeningReporter( IConfig const* config ): - IStreamingReporter( config ) { - // We will assume that listeners will always want all assertions - m_preferences.shouldReportAllAssertions = true; - } + // Keep track of how many listeners we have already inserted, + // so that we can insert them into the main vector at the right place + size_t m_insertedListeners = 0; + + void updatePreferences(IEventListener const& reporterish); + public: + using IEventListener::IEventListener; - void addListener( IStreamingReporterPtr&& listener ); - void addReporter( IStreamingReporterPtr&& reporter ); + void addListener( IEventListenerPtr&& listener ); + void addReporter( IEventListenerPtr&& reporter ); - public: // IStreamingReporter + public: // IEventListener void noMatchingTestCases( StringRef unmatchedSpec ) override; void fatalErrorEncountered( StringRef error ) override; - void reportInvalidArguments( StringRef arg ) override; + void reportInvalidTestSpec( StringRef arg ) override; void benchmarkPreparing( StringRef name ) override; void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; @@ -54,6 +60,7 @@ namespace Catch { void skipTest( TestCaseInfo const& testInfo ) override; void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listListeners(std::vector<ListenerDescription> const& descriptions) override; void listTests(std::vector<TestCaseHandle> const& tests) override; void listTags(std::vector<TagInfo> const& tags) override; @@ -62,4 +69,4 @@ namespace Catch { } // end namespace Catch -#endif // CATCH_REPORTER_LISTENING_HPP_INCLUDED +#endif // CATCH_REPORTER_MULTI_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd1bc76cad823c59c028b208f6b8125a6aa9dd1e --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp @@ -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 + +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <catch2/internal/catch_compiler_capabilities.hpp> + +namespace Catch { + namespace Detail { + + void registerReporterImpl( std::string const& name, + IReporterFactoryPtr reporterPtr ) { + CATCH_TRY { + getMutableRegistryHub().registerReporter( + name, CATCH_MOVE( reporterPtr ) ); + } + CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead + // register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + + } // namespace Detail +} // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e33ecf8b62dcc5c21191ef8215307f8e92a7cb19 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp @@ -0,0 +1,132 @@ + +// 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.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_unique_name.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_void_type.hpp> + +#include <type_traits> + +namespace Catch { + + namespace Detail { + + template <typename T, typename = void> + struct has_description : std::false_type {}; + + template <typename T> + struct has_description< + T, + void_t<decltype( T::getDescription() )>> + : std::true_type {}; + + //! Indirection for reporter registration, so that the error handling is + //! independent on the reporter's concrete type + void registerReporterImpl( std::string const& name, + IReporterFactoryPtr reporterPtr ); + + } // namespace Detail + + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + + template <typename T> + class ReporterFactory : public IReporterFactory { + + IEventListenerPtr create( ReporterConfig&& config ) const override { + return Detail::make_unique<T>( CATCH_MOVE(config) ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; + + + template<typename T> + class ReporterRegistrar { + public: + explicit ReporterRegistrar( std::string const& name ) { + registerReporterImpl( name, + Detail::make_unique<ReporterFactory<T>>() ); + } + }; + + template<typename T> + class ListenerRegistrar { + + class TypedListenerFactory : public EventListenerFactory { + StringRef m_listenerName; + + std::string getDescriptionImpl( std::true_type ) const { + return T::getDescription(); + } + + std::string getDescriptionImpl( std::false_type ) const { + return "(No description provided)"; + } + + public: + TypedListenerFactory( StringRef listenerName ): + m_listenerName( listenerName ) {} + + IEventListenerPtr create( IConfig const* config ) const override { + return Detail::make_unique<T>( config ); + } + + StringRef getName() const override { + return m_listenerName; + } + + std::string getDescription() const override { + return getDescriptionImpl( Detail::has_description<T>{} ); + } + }; + + public: + ListenerRegistrar(StringRef listenerName) { + getMutableRegistryHub().registerListener( Detail::make_unique<TypedListenerFactory>(listenerName) ); + } + }; +} + +#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> INTERNAL_CATCH_UNIQUE_NAME( \ + catch_internal_RegistrarFor )( 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> INTERNAL_CATCH_UNIQUE_NAME( \ + 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/reporters/catch_reporter_sonarqube.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp index e09b51090491372899d7aa4b0fef3da448d19e52..8119c3b8f79fa75dfd9ddb14e4985006f0798d6a 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp @@ -9,13 +9,25 @@ #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> #include <map> namespace Catch { + namespace { + std::string createRngSeedString(uint32_t seed) { + ReusableStringStream sstr; + sstr << "rng-seed=" << seed; + return sstr.str(); + } + } + void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { CumulativeReporterBase::testRunStarting(testRunInfo); + + xml.writeComment( createRngSeedString( m_config->rngSeed() ) ); xml.startElement("testExecutions"); xml.writeAttribute("version"_sr, '1'); } @@ -54,7 +66,9 @@ namespace Catch { if (!rootName.empty()) name = rootName + '/' + name; - if (!sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty()) { + if ( sectionNode.hasAnyAssertions() + || !sectionNode.stdOut.empty() + || !sectionNode.stdErr.empty() ) { XmlWriter::ScopedElement e = xml.scopedElement("testCase"); xml.writeAttribute("name"_sr, name); xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); @@ -67,8 +81,11 @@ namespace Catch { } void SonarQubeReporter::writeAssertions(SectionNode const& sectionNode, bool okToFail) { - for (auto const& assertion : sectionNode.assertions) - writeAssertion(assertion, okToFail); + for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) { + if (assertionOrBenchmark.isAssertion()) { + writeAssertion(assertionOrBenchmark.asAssertion(), okToFail); + } + } } void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp index 720c0ea0fb4f7b63c899cfa4b2c2ad11a9989686..32756b488f43a67191dfac9bb84ae084da86809e 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp @@ -11,16 +11,18 @@ #include <catch2/reporters/catch_reporter_cumulative_base.hpp> #include <catch2/internal/catch_xmlwriter.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> namespace Catch { - struct SonarQubeReporter final : CumulativeReporterBase { - - SonarQubeReporter(ReporterConfig const& config) - : CumulativeReporterBase(config) - , xml(config.stream()) { + class SonarQubeReporter final : public CumulativeReporterBase { + public: + SonarQubeReporter(ReporterConfig&& config) + : CumulativeReporterBase(CATCH_MOVE(config)) + , xml(m_stream) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; + m_shouldStoreSuccesfulAssertions = false; } ~SonarQubeReporter() override = default; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp index 1c2787ca01c31c23e5fdbde7739da2ac88b2784c..a9c898ed8faff456bf79ece61a759b16b8682b45 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp @@ -6,7 +6,6 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/reporters/catch_reporter_streaming_base.hpp> -#include <catch2/reporters/catch_reporter_helpers.hpp> namespace Catch { @@ -19,22 +18,6 @@ namespace Catch { void StreamingReporterBase::testRunEnded( TestRunStats const& ) { currentTestCaseInfo = nullptr; - 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 index e7b6e5b3a61e761a35ac0ec7bea5fd9ee6ebec06..76788d8d5c6c4c55f3f5d7730cc28311a9c2e1d5 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -9,37 +9,20 @@ #define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED #include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/reporters/catch_reporter_common_base.hpp> +#include <catch2/internal/catch_move_and_forward.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() ) {} - - + class StreamingReporterBase : public ReporterBase { + public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 + StreamingReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~StreamingReporterBase() override; void benchmarkPreparing( StringRef ) override {} @@ -49,7 +32,7 @@ namespace Catch { void fatalErrorEncountered( StringRef /*error*/ ) override {} void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {} - void reportInvalidArguments( StringRef /*invalidArgument*/ ) override {} + void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {} void testRunStarting( TestRunInfo const& _testRunInfo ) override; @@ -78,15 +61,11 @@ namespace Catch { // 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; + protected: + TestRunInfo currentTestRunInfo{ "test run has not started yet"_sr }; TestCaseInfo const* currentTestCaseInfo = nullptr; + //! Stack of all _active_ sections in the _current_ test case std::vector<SectionInfo> m_sectionStack; }; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp index 46a0994da8dbd420aea42e7135c7dc17c9947af8..6058f2422ad7216d2fbc7b1ea3d22d0949934b20 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp @@ -9,8 +9,10 @@ #include <catch2/internal/catch_console_colour.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> #include <algorithm> +#include <iterator> #include <ostream> namespace Catch { @@ -20,18 +22,20 @@ namespace Catch { // Making older compiler happy is hard. static constexpr StringRef tapFailedString = "not ok"_sr; static constexpr StringRef tapPassedString = "ok"_sr; + static constexpr Colour::Code tapDimColour = Colour::FileName; class TapAssertionPrinter { public: TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete; TapAssertionPrinter(TapAssertionPrinter const&) = delete; - TapAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter) + TapAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter, ColourImpl* colour_) : stream(_stream) , result(_stats.assertionResult) , messages(_stats.infoMessages) , itMessage(_stats.infoMessages.begin()) , printInfoMessages(true) - , counter(_counter) {} + , counter(_counter) + , colourImpl( colour_ ) {} void print() { itMessage = messages.begin(); @@ -104,13 +108,6 @@ namespace Catch { } 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 << " -"; @@ -124,10 +121,8 @@ namespace Catch { void printExpressionWas() { if (result.hasExpression()) { stream << ';'; - { - Colour colour(dimColour()); - stream << " expression was:"; - } + stream << colourImpl->guardColour( tapDimColour ) + << " expression was:"; printOriginalExpression(); } } @@ -140,10 +135,8 @@ namespace Catch { void printReconstructedExpression() const { if (result.hasExpandedExpression()) { - { - Colour colour(dimColour()); - stream << " for: "; - } + stream << colourImpl->guardColour( tapDimColour ) << " for: "; + std::string expr = result.getExpandedExpression(); std::replace(expr.begin(), expr.end(), '\n', ' '); stream << expr; @@ -157,7 +150,7 @@ namespace Catch { } } - void printRemainingMessages(Colour::Code colour = dimColour()) { + void printRemainingMessages(Colour::Code colour = tapDimColour) { if (itMessage == messages.end()) { return; } @@ -166,18 +159,15 @@ namespace Catch { 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"_sr) << ':'; - } + stream << colourImpl->guardColour( colour ) << " with " + << pluralise( N, "message"_sr ) << ':'; 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"; + stream << colourImpl->guardColour(tapDimColour) << " and"; } } } @@ -190,30 +180,35 @@ namespace Catch { std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; std::size_t counter; + ColourImpl* colourImpl; }; } // End anonymous namespace + void TAPReporter::testRunStarting( TestRunInfo const& ) { + m_stream << "# rng-seed: " << m_config->rngSeed() << '\n'; + } + void TAPReporter::noMatchingTestCases( StringRef unmatchedSpec ) { - stream << "# No test cases matched '" << unmatchedSpec << "'\n"; + m_stream << "# No test cases matched '" << unmatchedSpec << "'\n"; } void TAPReporter::assertionEnded(AssertionStats const& _assertionStats) { ++counter; - stream << "# " << currentTestCaseInfo->name << '\n'; - TapAssertionPrinter printer(stream, _assertionStats, counter); + m_stream << "# " << currentTestCaseInfo->name << '\n'; + TapAssertionPrinter printer(m_stream, _assertionStats, counter, m_colour.get()); printer.print(); - stream << '\n' << std::flush; + m_stream << '\n' << std::flush; } void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) { - stream << "1.." << _testRunStats.totals.assertions.total(); + m_stream << "1.." << _testRunStats.totals.assertions.total(); if (_testRunStats.totals.testCases.total() == 0) { - stream << " # Skipped: No tests ran."; + m_stream << " # Skipped: No tests ran."; } - stream << "\n\n" << std::flush; + m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp index e7c22cfa9c04147b2a5c6ae46de2e79711befb4a..0c4b14b4777c6f3c40b79e504109502c81679791 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp @@ -9,13 +9,14 @@ #define CATCH_REPORTER_TAP_HPP_INCLUDED #include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> namespace Catch { - struct TAPReporter final : StreamingReporterBase { - - TAPReporter( ReporterConfig const& config ): - StreamingReporterBase( config ) { + class TAPReporter final : public StreamingReporterBase { + public: + TAPReporter( ReporterConfig&& config ): + StreamingReporterBase( CATCH_MOVE(config) ) { m_preferences.shouldReportAllAssertions = true; } ~TAPReporter() override = default; @@ -25,6 +26,8 @@ namespace Catch { return "Reports test results in TAP format, suitable for test harnesses"s; } + void testRunStarting( TestRunInfo const& testInfo ) override; + void noMatchingTestCases( StringRef unmatchedSpec ) override; void assertionEnded(AssertionStats const& _assertionStats) override; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp index 1972b8c49ffc60402e22484424bfe6a6a5ac0bc4..142dffbb1d567e26167bd03c754cb79f71f03862 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp @@ -14,6 +14,7 @@ #include <catch2/catch_test_case_info.hpp> #include <cassert> +#include <ostream> namespace Catch { @@ -47,12 +48,12 @@ namespace Catch { TeamCityReporter::~TeamCityReporter() {} void TeamCityReporter::testRunStarting( TestRunInfo const& runInfo ) { - stream << "##teamcity[testSuiteStarted name='" << escape( runInfo.name ) + m_stream << "##teamcity[testSuiteStarted name='" << escape( runInfo.name ) << "']\n"; } void TeamCityReporter::testRunEnded( TestRunStats const& runStats ) { - stream << "##teamcity[testSuiteFinished name='" + m_stream << "##teamcity[testSuiteFinished name='" << escape( runStats.runInfo.name ) << "']\n"; } @@ -112,43 +113,43 @@ namespace Catch { if (currentTestCaseInfo->okToFail()) { msg << "- failure ignore as test marked as 'ok to fail'\n"; - stream << "##teamcity[testIgnored" + m_stream << "##teamcity[testIgnored" << " name='" << escape(currentTestCaseInfo->name) << '\'' << " message='" << escape(msg.str()) << '\'' << "]\n"; } else { - stream << "##teamcity[testFailed" + m_stream << "##teamcity[testFailed" << " name='" << escape(currentTestCaseInfo->name) << '\'' << " message='" << escape(msg.str()) << '\'' << "]\n"; } } - stream.flush(); + m_stream.flush(); } void TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) { m_testTimer.start(); StreamingReporterBase::testCaseStarting(testInfo); - stream << "##teamcity[testStarted name='" + m_stream << "##teamcity[testStarted name='" << escape(testInfo.name) << "']\n"; - stream.flush(); + m_stream.flush(); } void TeamCityReporter::testCaseEnded(TestCaseStats const& testCaseStats) { StreamingReporterBase::testCaseEnded(testCaseStats); auto const& testCaseInfo = *testCaseStats.testInfo; if (!testCaseStats.stdOut.empty()) - stream << "##teamcity[testStdOut name='" + m_stream << "##teamcity[testStdOut name='" << escape(testCaseInfo.name) << "' out='" << escape(testCaseStats.stdOut) << "']\n"; if (!testCaseStats.stdErr.empty()) - stream << "##teamcity[testStdErr name='" + m_stream << "##teamcity[testStdErr name='" << escape(testCaseInfo.name) << "' out='" << escape(testCaseStats.stdErr) << "']\n"; - stream << "##teamcity[testFinished name='" + m_stream << "##teamcity[testFinished name='" << escape(testCaseInfo.name) << "' duration='" << m_testTimer.getElapsedMilliseconds() << "']\n"; - stream.flush(); + m_stream.flush(); } void TeamCityReporter::printSectionHeader(std::ostream& os) { diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp index 7abe8185301f124640e3e71ccbabf1d3f54c5ced..5007193bbe87da02937ccc620e15b9f6dd7dd8be 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp @@ -20,9 +20,10 @@ namespace Catch { - struct TeamCityReporter final : StreamingReporterBase { - TeamCityReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ) + class TeamCityReporter final : public StreamingReporterBase { + public: + TeamCityReporter( ReporterConfig&& _config ) + : StreamingReporterBase( CATCH_MOVE(_config) ) { m_preferences.shouldRedirectStdOut = true; } @@ -52,7 +53,6 @@ namespace Catch { private: void printSectionHeader(std::ostream& os); - private: bool m_headerPrintedForThisSection = false; Timer m_testTimer; }; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp index 4e2a9a34fc9ddb16aacb0206563f6db6e9eefc9f..1e5def4176cc408f3024c51f743af1664abc8da0 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp @@ -13,6 +13,8 @@ #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_list.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/catch_version.hpp> #if defined(_MSC_VER) #pragma warning(push) @@ -22,9 +24,9 @@ #endif namespace Catch { - XmlReporter::XmlReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ), - m_xml(_config.stream()) + XmlReporter::XmlReporter( ReporterConfig&& _config ) + : StreamingReporterBase( CATCH_MOVE(_config) ), + m_xml(m_stream) { m_preferences.shouldRedirectStdOut = true; m_preferences.shouldReportAllAssertions = true; @@ -51,14 +53,12 @@ namespace Catch { std::string stylesheetRef = getStylesheetRef(); if( !stylesheetRef.empty() ) m_xml.writeStylesheetRef( stylesheetRef ); - m_xml.startElement( "Catch2TestRun" ); - if( !m_config->name().empty() ) - m_xml.writeAttribute( "name"_sr, m_config->name() ); + m_xml.startElement("Catch2TestRun") + .writeAttribute("name"_sr, m_config->name()) + .writeAttribute("rng-seed"_sr, m_config->rngSeed()) + .writeAttribute("catch2-version"_sr, libraryVersion()); if (m_config->testSpec().hasFilters()) m_xml.writeAttribute( "filters"_sr, serializeFilters( m_config->getTestsOrTags() ) ); - if( m_config->rngSeed() != 0 ) - m_xml.scopedElement( "Randomness" ) - .writeAttribute( "seed"_sr, m_config->rngSeed() ); } void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { @@ -259,6 +259,19 @@ namespace Catch { } } + void XmlReporter::listListeners(std::vector<ListenerDescription> const& descriptions) { + auto outerTag = m_xml.scopedElement( "RegisteredListeners" ); + for ( auto const& listener : descriptions ) { + auto inner = m_xml.scopedElement( "Listener" ); + m_xml.startElement( "Name", XmlFormatting::Indent ) + .writeText( listener.name, XmlFormatting::None ) + .endElement( XmlFormatting::Newline ); + m_xml.startElement( "Description", XmlFormatting::Indent ) + .writeText( listener.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) { diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp index 46dd667a90d0d6e4ca300cc9470696fcf30bd245..573f9321a3daa58f43e9d2c071a81a5706ad96c4 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp @@ -17,7 +17,7 @@ namespace Catch { class XmlReporter : public StreamingReporterBase { public: - XmlReporter(ReporterConfig const& _config); + XmlReporter(ReporterConfig&& _config); ~XmlReporter() override; @@ -51,6 +51,7 @@ namespace Catch { void benchmarkFailed( StringRef error ) override; void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listListeners(std::vector<ListenerDescription> const& descriptions) override; void listTests(std::vector<TestCaseHandle> const& tests) override; void listTags(std::vector<TagInfo> const& tags) override; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp index bf29c6fe28235950e0995474a4a8d412a79994f5..d3a59eb7dc293106d3968d507d459bce88cf2b3f 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp @@ -22,13 +22,15 @@ #define CATCH_REPORTERS_ALL_HPP_INCLUDED #include <catch2/reporters/catch_reporter_automake.hpp> +#include <catch2/reporters/catch_reporter_common_base.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_multi.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> #include <catch2/reporters/catch_reporter_sonarqube.hpp> #include <catch2/reporters/catch_reporter_streaming_base.hpp> #include <catch2/reporters/catch_reporter_tap.hpp> diff --git a/packages/Catch2/tests/CMakeLists.txt b/packages/Catch2/tests/CMakeLists.txt index 7f7c32fe7e37d2aa477ee491ca414e2fc52f92ac..7f5af9949a822031de5da7fa4c4f203a70041b02 100644 --- a/packages/Catch2/tests/CMakeLists.txt +++ b/packages/Catch2/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -include(MiscFunctions) +include(CatchMiscFunctions) if (CATCH_BUILD_SURROGATES) message(STATUS "Configuring targets for surrogate TUs") @@ -79,6 +79,8 @@ 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/CmdLineHelpers.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/ColourImpl.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Details.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/FloatingPoint.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -87,6 +89,11 @@ set(TEST_SOURCES ${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/TestCaseInfoHasher.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/TestSpecParser.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/TextFlow.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Sharding.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Stream.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp @@ -139,6 +146,12 @@ include(CTest) add_executable(SelfTest ${TEST_SOURCES}) target_link_libraries(SelfTest PRIVATE Catch2WithMain) +if (BUILD_SHARED_LIBS AND WIN32) + add_custom_command(TARGET SelfTest PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Catch2> + $<TARGET_FILE:Catch2WithMain> $<TARGET_FILE_DIR:SelfTest> + ) +endif() if (CATCH_ENABLE_COVERAGE) set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE) @@ -200,20 +213,80 @@ set_tests_properties(List::Reporters::XmlOutput PROPERTIES FAIL_REGULAR_EXPRESSION "Available reporters:" ) - +add_test(NAME List::Listeners::Output + COMMAND + $<TARGET_FILE:SelfTest> --list-listeners +) +set_tests_properties(List::Listeners::Output + PROPERTIES + PASS_REGULAR_EXPRESSION "Registered listeners:" +) +add_test(NAME List::Listeners::ExitCode + COMMAND + $<TARGET_FILE:SelfTest> --list-listeners +) +add_test(NAME List::Listeners::XmlOutput + COMMAND + $<TARGET_FILE:SelfTest> + --list-listeners + --reporter xml +) +set_tests_properties(List::Listeners::XmlOutput + PROPERTIES + PASS_REGULAR_EXPRESSION "<RegisteredListeners>" + FAIL_REGULAR_EXPRESSION "Registered listeners:" +) 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 +# We cannot combine a regular expression on output with return code check +# in one test, so we register two instead of making a checking script because +# the runtime overhead is small enough. +add_test(NAME TestSpecs::CombiningMatchingAndNonMatchingIsOk-1 COMMAND $<TARGET_FILE:SelfTest> Tracker, "___nonexistent_test___") + +add_test(NAME TestSpecs::CombiningMatchingAndNonMatchingIsOk-2 COMMAND $<TARGET_FILE:SelfTest> Tracker, "___nonexistent_test___") +set_tests_properties(TestSpecs::CombiningMatchingAndNonMatchingIsOk-2 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 TestSpecs::NoMatchedTestsFail + COMMAND $<TARGET_FILE:SelfTest> "___nonexistent_test___" +) +set_tests_properties(TestSpecs::NoMatchedTestsFail + PROPERTIES + WILL_FAIL ON +) +add_test(NAME TestSpecs::OverrideFailureWithNoMatchedTests + COMMAND $<TARGET_FILE:SelfTest> "___nonexistent_test___" --allow-running-no-tests +) + +add_test(NAME Warnings::UnmatchedTestSpecIsAccepted + COMMAND $<TARGET_FILE:SelfTest> Tracker --warn UnmatchedTestSpec +) +set_tests_properties(Warnings::UnmatchedTestSpecIsAccepted + PROPERTIES + FAIL_REGULAR_EXPRESSION "Unrecognised warning option: " +) + +add_test(NAME Warnings::MultipleWarningsCanBeSpecified + COMMAND + $<TARGET_FILE:SelfTest> Tracker + --warn NoAssertions + --warn UnmatchedTestSpec +) + +add_test(NAME TestSpecs::WarnUnmatchedTestSpecFailsWithUnmatchedTestSpec + COMMAND + $<TARGET_FILE:SelfTest> Tracker, "___nonexistent_test___" --warn UnmatchedTestSpec +) +set_tests_properties(TestSpecs::WarnUnmatchedTestSpecFailsWithUnmatchedTestSpec + PROPERTIES + WILL_FAIL ON +) -add_test(NAME UnmatchedOutputFilter COMMAND $<TARGET_FILE:SelfTest> [this-tag-does-not-exist] -w NoTests) +add_test(NAME UnmatchedOutputFilter COMMAND $<TARGET_FILE:SelfTest> [this-tag-does-not-exist]) set_tests_properties(UnmatchedOutputFilter PROPERTIES PASS_REGULAR_EXPRESSION "No test cases matched '\\[this-tag-does-not-exist\\]'" @@ -244,6 +317,7 @@ add_test( $<TARGET_FILE:SelfTest> "#2025: same-level sections" -c "A" -c "B" + --colour-mode none ) set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2 PROPERTIES @@ -257,13 +331,14 @@ set_tests_properties(ApprovalTests 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 + LABELS "uses-python" ) 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}") +set_tests_properties(VersionCheck PROPERTIES PASS_REGULAR_EXPRESSION "Catch2 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") @@ -292,14 +367,12 @@ set_tests_properties(TestsInFile::SimpleSpecs PROPERTIES PASS_REGULAR_EXPRESSION 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") +set_tests_properties(TestsInFile::InvalidTestNames-1 + PROPERTIES + PASS_REGULAR_EXPRESSION "Invalid Filter: \"Test with special, characters in \\\\\" name\"" + FAIL_REGULAR_EXPRESSION "No tests ran" +) add_test(NAME TagAlias COMMAND $<TARGET_FILE:SelfTest> [@tricky] --list-tests) set_tests_properties(TagAlias PROPERTIES @@ -309,11 +382,32 @@ set_tests_properties(TagAlias PROPERTIES add_test(NAME RandomTestOrdering COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testRandomOrder.py $<TARGET_FILE:SelfTest>) +set_tests_properties(RandomTestOrdering + PROPERTIES + LABELS "uses-python" +) add_test(NAME CheckConvenienceHeaders COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tools/scripts/checkConvenienceHeaders.py ) +set_tests_properties(CheckConvenienceHeaders + PROPERTIES + LABELS "uses-python" +) + +add_test(NAME "Benchmarking::SkipBenchmarkMacros" + COMMAND + $<TARGET_FILE:SelfTest> "Skip benchmark macros" + --reporter console + --skip-benchmarks + --colour-mode none +) +set_tests_properties("Benchmarking::SkipBenchmarkMacros" + PROPERTIES + PASS_REGULAR_EXPRESSION "All tests passed \\(2 assertions in 1 test case\\)" + FAIL_REGULAR_EXPRESSION "benchmark name" +) add_test(NAME "Benchmarking::FailureReporting::OptimizedOut" @@ -368,14 +462,152 @@ set_tests_properties("Benchmarking::FailureReporting::ShouldFailIsRespected" PASS_REGULAR_EXPRESSION "1 failed as expected" ) +add_test(NAME "ErrorHandling::InvalidTestSpecExitsEarly" + COMMAND + $<TARGET_FILE:SelfTest> "[aa,a]" +) +set_tests_properties("ErrorHandling::InvalidTestSpecExitsEarly" + PROPERTIES + PASS_REGULAR_EXPRESSION "Invalid Filter: \\[aa\,a\\]" + FAIL_REGULAR_EXPRESSION "No tests ran" +) + +if (MSVC) + set(_NullFile "NUL") +else() + set(_NullFile "/dev/null") +endif() + +# This test checks that there is nothing written out from the process, +# but if CMake is running the tests under Valgrind or similar tool, then +# that will write its own output to stdout and the test would fail. +if (NOT MEMORYCHECK_COMMAND) + add_test(NAME "MultiReporter::CapturingReportersDontPropagateStdOut" + COMMAND + $<TARGET_FILE:SelfTest> "Sends stuff to stdout and stderr" + --reporter xml::out=${_NullFile} + --reporter junit::out=${_NullFile} + ) + set_tests_properties("MultiReporter::CapturingReportersDontPropagateStdOut" + PROPERTIES + FAIL_REGULAR_EXPRESSION ".+" + ) +endif() + +add_test(NAME "MultiReporter::NonCapturingReportersPropagateStdout" + COMMAND + $<TARGET_FILE:SelfTest> "Sends stuff to stdout and stderr" + --reporter xml::out=${_NullFile} + --reporter console::out=${_NullFile} +) +set_tests_properties("MultiReporter::NonCapturingReportersPropagateStdout" + PROPERTIES + PASS_REGULAR_EXPRESSION "A string sent to stderr via clog" +) + +add_test(NAME "Outputs::DashAsOutLocationSendsOutputToStdout" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --out=- + --colour-mode none +) +set_tests_properties("Outputs::DashAsOutLocationSendsOutputToStdout" + PROPERTIES + PASS_REGULAR_EXPRESSION "All tests passed \\(5 assertions in 1 test case\\)" +) + +add_test(NAME "Reporters::DashAsLocationInReporterSpecSendsOutputToStdout" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --reporter console::out=- + --colour-mode none +) +set_tests_properties("Reporters::DashAsLocationInReporterSpecSendsOutputToStdout" + PROPERTIES + PASS_REGULAR_EXPRESSION "All tests passed \\(5 assertions in 1 test case\\)" +) + +add_test(NAME "Reporters::ReporterSpecificColourOverridesDefaultColour" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --reporter console::colour-mode=ansi + --colour-mode none +) +set_tests_properties("Reporters::ReporterSpecificColourOverridesDefaultColour" + PROPERTIES + PASS_REGULAR_EXPRESSION "\\[1\;32mAll tests passed" +) + +add_test(NAME "Reporters::UnrecognizedOptionInSpecCausesError" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --reporter console::bad-option=ansi +) +set_tests_properties("Reporters::UnrecognizedOptionInSpecCausesError" + PROPERTIES + WILL_FAIL ON +) -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") +add_test(NAME "Colours::ColourModeCanBeExplicitlySetToAnsi" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --reporter console + --colour-mode ansi +) +set_tests_properties("Colours::ColourModeCanBeExplicitlySetToAnsi" + PROPERTIES + PASS_REGULAR_EXPRESSION "\\[1\;32mAll tests passed" +) + +add_test(NAME "Reporters::JUnit::NamespacesAreNormalized" + COMMAND + $<TARGET_FILE:SelfTest> + --reporter junit + "A TEST_CASE_METHOD testing junit classname normalization" +) +set_tests_properties("Reporters::JUnit::NamespacesAreNormalized" + PROPERTIES + PASS_REGULAR_EXPRESSION "testcase classname=\"SelfTest(\.exe)?\\.A\\.B\\.TestClass\"" +) + +if (CATCH_ENABLE_CONFIGURE_TESTS) + foreach(testName "DefaultReporter" "Disable" "DisableStringification" + "ExperimentalRedirect") + + add_test(NAME "CMakeConfig::${testName}" + COMMAND + "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/TestScripts/testConfigure${testName}.py" "${CATCH_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" + ) + set_tests_properties("CMakeConfig::${testName}" + PROPERTIES + COST 240 + LABELS "uses-python" + ) + + endforeach() endif() +foreach (reporterName # "Automake" - the simple .trs format does not support any kind of comments/metadata + "compact" + "console" + "JUnit" + "SonarQube" + "TAP" + # "TeamCity" - does not seem to support test suite-level metadata/comments + "XML") + add_test(NAME "Reporters:RngSeed:${reporterName}" + COMMAND + $<TARGET_FILE:SelfTest> "Factorials are computed" + --reporter ${reporterName} + --rng-seed 18181818 + ) + set_tests_properties("Reporters:RngSeed:${reporterName}" + PROPERTIES + PASS_REGULAR_EXPRESSION "18181818" + ) + +endforeach() + + 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 index bce10df5b284b070a86270b324a25a44189b60b2..f1a02af3f6a1fc607ea8ae65a3c3aa2d876e015e 100644 --- a/packages/Catch2/tests/ExtraTests/CMakeLists.txt +++ b/packages/Catch2/tests/ExtraTests/CMakeLists.txt @@ -8,6 +8,26 @@ project( Catch2ExtraTests LANGUAGES CXX ) message( STATUS "Extra tests included" ) + +add_test( + NAME TestShardingIntegration + COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testSharding.py $<TARGET_FILE:SelfTest> +) +set_tests_properties(TestShardingIntegration + PROPERTIES + LABELS "uses-python" +) + +add_test( + NAME TestSharding::OverlyLargeShardIndex + COMMAND $<TARGET_FILE:SelfTest> --shard-index 5 --shard-count 5 +) +set_tests_properties( + TestSharding::OverlyLargeShardIndex + PROPERTIES + PASS_REGULAR_EXPRESSION "The shard count \\(5\\) must be greater than the shard index \\(5\\)" +) + # 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. @@ -105,6 +125,30 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "abort;terminate;fatal" ) +add_executable( BazelReporter ${TESTS_DIR}/X30-BazelReporter.cpp ) +target_compile_definitions( BazelReporter PRIVATE CATCH_CONFIG_BAZEL_SUPPORT ) +target_link_libraries(BazelReporter Catch2_buildall_interface) +add_test(NAME CATCH_CONFIG_BAZEL_REPORTER-1 + COMMAND + "${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporter> "${CMAKE_CURRENT_BINARY_DIR}" +) +set_tests_properties(CATCH_CONFIG_BAZEL_REPORTER-1 + PROPERTIES + LABELS "uses-python" +) + +# We must now test this works without the build flag. +add_executable( BazelReporterNoCatchConfig ${TESTS_DIR}/X30-BazelReporter.cpp ) +target_link_libraries(BazelReporterNoCatchConfig Catch2WithMain) +add_test(NAME NO_CATCH_CONFIG_BAZEL_REPORTER-1 + COMMAND + "${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporterNoCatchConfig> "${CMAKE_CURRENT_BINARY_DIR}" +) +set_tests_properties(NO_CATCH_CONFIG_BAZEL_REPORTER-1 + PROPERTIES + LABELS "uses-python" + ENVIRONMENT "BAZEL_TEST=1" +) # 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 @@ -135,6 +179,17 @@ set_tests_properties( ) +add_executable(DeferredStaticChecks ${TESTS_DIR}/X05-DeferredStaticChecks.cpp) +target_link_libraries(DeferredStaticChecks PRIVATE Catch2WithMain) +target_compile_definitions(DeferredStaticChecks PRIVATE "CATCH_CONFIG_RUNTIME_STATIC_REQUIRE") + +add_test(NAME DeferredStaticChecks COMMAND DeferredStaticChecks -r compact) +set_tests_properties( + DeferredStaticChecks + PROPERTIES + PASS_REGULAR_EXPRESSION "Failed 1 test case, failed all 3 assertions." +) + add_executable(FallbackStringifier ${TESTS_DIR}/X10-FallbackStringifier.cpp) target_compile_definitions( FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER=fallbackStringifier ) @@ -179,6 +234,155 @@ add_test( NAME PartialTestCaseEvents COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testPartialTestCaseEvent.py $<TARGET_FILE:PartialTestCaseEvents> ) +set_tests_properties(PartialTestCaseEvents + PROPERTIES + LABELS "uses-python" +) + +add_executable(BenchmarksInCumulativeReporter ${TESTS_DIR}/X22-BenchmarksInCumulativeReporter.cpp) +target_link_libraries(BenchmarksInCumulativeReporter PRIVATE Catch2::Catch2WithMain) +add_test( + NAME BenchmarksInCumulativeReporter + COMMAND BenchmarksInCumulativeReporter --reporter testReporter +) +set_tests_properties( + BenchmarksInCumulativeReporter + PROPERTIES + PASS_REGULAR_EXPRESSION "1\n2\n3\n4\n5\n" +) + + +add_executable(CasingInReporterNames ${TESTS_DIR}/X23-CasingInReporterNames.cpp) +target_link_libraries(CasingInReporterNames PRIVATE Catch2::Catch2WithMain) +add_test( + NAME Reporters::registration-is-case-preserving + COMMAND CasingInReporterNames --list-reporters +) +set_tests_properties( + Reporters::registration-is-case-preserving + PROPERTIES + PASS_REGULAR_EXPRESSION "testReporterCASED" +) +add_test( + NAME Reporters::selection-is-case-insensitive + COMMAND CasingInReporterNames -r testReportercased +) +set_tests_properties( + Reporters::selection-is-case-insensitive + PROPERTIES + PASS_REGULAR_EXPRESSION "TestReporter constructed" +) + +add_executable(CapturedStdoutInTestCaseEvents ${TESTS_DIR}/X27-CapturedStdoutInTestCaseEvents.cpp) +target_link_libraries(CapturedStdoutInTestCaseEvents PRIVATE Catch2::Catch2WithMain) +add_test( + NAME Reporters::CapturedStdOutInEvents + COMMAND CapturedStdoutInTestCaseEvents + --reporter test-reporter +) +set_tests_properties( + Reporters::CapturedStdOutInEvents + PROPERTIES + PASS_REGULAR_EXPRESSION "X27 - TestReporter constructed" + FAIL_REGULAR_EXPRESSION "X27 ERROR" +) + + +if (MSVC) + set(_NullFile "NUL") +else() + set(_NullFile "/dev/null") +endif() + +add_executable(ListenerStdoutCaptureInMultireporter ${TESTS_DIR}/X24-ListenerStdoutCaptureInMultireporter.cpp) +target_link_libraries(ListenerStdoutCaptureInMultireporter PRIVATE Catch2::Catch2WithMain) + +# This test checks that there is nothing written out from the process, +# but if CMake is running the tests under Valgrind or similar tool, then +# that will write its own output to stdout and the test would fail. +if (NOT MEMORYCHECK_COMMAND) + add_test( + NAME MultiReporter::NoncapturingListenerDoesntCauseStdoutPassThrough + COMMAND ListenerStdoutCaptureInMultireporter + --reporter xml::out=${_NullFile} + --reporter junit::out=${_NullFile} + ) + + set_tests_properties( + MultiReporter::NoncapturingListenerDoesntCauseStdoutPassThrough + PROPERTIES + PASS_REGULAR_EXPRESSION "X24 - NonCapturingListener initialized" + FAIL_REGULAR_EXPRESSION "X24 - FooBarBaz" + ) +endif() + + +add_executable(ListenerCanAskForCapturedStdout ${TESTS_DIR}/X25-ListenerCanAskForCapturedStdout.cpp) +target_link_libraries(ListenerCanAskForCapturedStdout PRIVATE Catch2::Catch2WithMain) +add_test( + NAME MultiReporter::CapturingListenerCausesStdoutCapture + COMMAND ListenerCanAskForCapturedStdout + --reporter compact::out=${_NullFile} + --reporter console::out=${_NullFile} +) +set_tests_properties( + MultiReporter::CapturingListenerCausesStdoutCapture + PROPERTIES + PASS_REGULAR_EXPRESSION "CapturingListener initialized" + FAIL_REGULAR_EXPRESSION "X25 - ERROR" +) + +add_executable(ReporterPreferencesForPassingAssertionsIsRespected ${TESTS_DIR}/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp) +target_link_libraries(ReporterPreferencesForPassingAssertionsIsRespected PRIVATE Catch2::Catch2WithMain) +add_test( + NAME Reporters::PreferencesForPassingAssertionsIsRespected + COMMAND ReporterPreferencesForPassingAssertionsIsRespected + --reporter test-reporter +) +set_tests_properties( + Reporters::PreferencesForPassingAssertionsIsRespected + PROPERTIES + PASS_REGULAR_EXPRESSION "X26 - TestReporter constructed" + FAIL_REGULAR_EXPRESSION "X26 - assertionEnded" +) +add_test( + NAME MultiReporter::PreferencesForPassingAssertionsIsRespected + COMMAND ReporterPreferencesForPassingAssertionsIsRespected + --reporter test-reporter + --reporter console::out=${_NullFile} +) +set_tests_properties( + MultiReporter::PreferencesForPassingAssertionsIsRespected + PROPERTIES + PASS_REGULAR_EXPRESSION "X26 - TestReporter constructed" + FAIL_REGULAR_EXPRESSION "X26 - assertionEnded" +) + +add_executable(ListenersGetEventsBeforeReporters ${TESTS_DIR}/X28-ListenersGetEventsBeforeReporters.cpp) +target_link_libraries(ListenersGetEventsBeforeReporters PRIVATE Catch2::Catch2WithMain) +add_test( + NAME ListenersGetEventsBeforeReporters + COMMAND ListenersGetEventsBeforeReporters --reporter test-reporter +) +set_tests_properties( + ListenersGetEventsBeforeReporters + PROPERTIES + PASS_REGULAR_EXPRESSION "X28 - TestReporter constructed" + FAIL_REGULAR_EXPRESSION "X28 - ERROR" +) + +add_executable(CustomArgumentsForReporters ${TESTS_DIR}/X29-CustomArgumentsForReporters.cpp) +target_link_libraries(CustomArgumentsForReporters PRIVATE Catch2::Catch2WithMain) +add_test( + NAME CustomArgumentsForReporters + COMMAND CustomArgumentsForReporters + --reporter "test-reporter::Xa b=c 1::Xz:e = 1234" +) +set_tests_properties( + CustomArgumentsForReporters + PROPERTIES + PASS_REGULAR_EXPRESSION "Xa b=c 1::Xz:e = 1234" +) add_executable(DuplicatedTestCases-SameNameAndTags ${TESTS_DIR}/X31-DuplicatedTestCases.cpp) @@ -229,6 +433,20 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "error: .* already defined\\." ) + +add_executable(DuplicatedReporters ${TESTS_DIR}/X35-DuplicatedReporterNames.cpp) +target_link_libraries(DuplicatedReporters PRIVATE Catch2::Catch2WithMain) +add_test( + NAME Reporters::RegistrationErrorsAreCaught + COMMAND $<TARGET_FILE:DuplicatedReporters> +) +set_tests_properties( + Reporters::RegistrationErrorsAreCaught + PROPERTIES + PASS_REGULAR_EXPRESSION "Errors occurred during startup!" +) + + #add_executable(DebugBreakMacros ${TESTS_DIR}/X12-CustomDebugBreakMacro.cpp) #target_link_libraries(DebugBreakMacros Catch2) #add_test(NAME DebugBreakMacros COMMAND DebugBreakMacros --break) @@ -238,6 +456,25 @@ set_tests_properties( # PASS_REGULAR_EXPRESSION "Pretty please, break into debugger" #) +add_executable(NoTests ${TESTS_DIR}/X92-NoTests.cpp) +target_link_libraries(NoTests PRIVATE Catch2::Catch2WithMain) + +add_test( + NAME TestSpecs::EmptySpecWithNoTestsFails + COMMAND $<TARGET_FILE:NoTests> +) +set_tests_properties(TestSpecs::EmptySpecWithNoTestsFails + PROPERTIES + WILL_FAIL ON +) +add_test( + NAME TestSpecs::OverrideFailureWithEmptySpec + COMMAND $<TARGET_FILE:NoTests> --allow-running-no-tests +) +add_test( + NAME List::Listeners::WorksWithoutRegisteredListeners + COMMAND $<TARGET_FILE:NoTests> --list-listeners +) set( EXTRA_TEST_BINARIES PrefixedMacros DisabledMacros @@ -249,6 +486,8 @@ set( EXTRA_TEST_BINARIES DuplicatedTestCases-SameNameAndTags DuplicatedTestCases-SameNameDifferentTags DuplicatedTestCases-DuplicatedTestCaseMethods + NoTests + ListenersGetEventsBeforeReporters # DebugBreakMacros ) diff --git a/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp index 43452d7669335d9d63ff147ab7cca9fdb60d558a..65235194c3cc4878ba05105212aee0612476a9d2 100644 --- a/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp +++ b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp @@ -1,7 +1,18 @@ -// 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 + +// 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 + * Test that Catch's prefixed macros compile and run properly. + * + * We intentionally do not provide full coverage of all macros, but we + * test a smattering and can add other ones as they have regressions. + */ + #include <catch2/catch_test_macros.hpp> #include <catch2/matchers/catch_matchers_predicate.hpp> @@ -55,6 +66,7 @@ CATCH_TEST_CASE("PrefixedMacros") { CATCH_SECTION("some section") { int i = 1; CATCH_CAPTURE( i ); + CATCH_CAPTURE( i, i + 1 ); CATCH_DYNAMIC_SECTION("Dynamic section: " << i) { CATCH_FAIL_CHECK( "failure" ); } @@ -62,6 +74,8 @@ CATCH_TEST_CASE("PrefixedMacros") { CATCH_STATIC_REQUIRE( std::is_void<void>::value ); CATCH_STATIC_REQUIRE_FALSE( std::is_void<int>::value ); + CATCH_STATIC_CHECK( std::is_void<void>::value ); + CATCH_STATIC_CHECK_FALSE( std::is_void<int>::value ); CATCH_FAIL(""); } diff --git a/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp index c2d997c9ccf37452d0cf4a21fdaf61e7a68039d0..37d35e11cc10c9e83ccb3e4de0e7c846e9efa4fe 100644 --- a/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp @@ -1,8 +1,21 @@ -// X02-DisabledMacros.cpp -// Test that CATCH_CONFIG_DISABLE turns off TEST_CASE autoregistration -// and expressions in assertion macros are not run. + +// 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 + * 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 <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> #include <iostream> @@ -20,7 +33,7 @@ struct foo { #pragma clang diagnostic ignored "-Wglobal-constructors" #endif // Construct foo, but `foo::print` should not be run -foo f; +static foo f; #if defined(__clang__) @@ -30,8 +43,21 @@ foo f; // This test should not be run, because it won't be registered TEST_CASE( "Disabled Macros" ) { + CHECK( 1 == 2 ); + REQUIRE( 1 == 2 ); std::cout << "This should not happen\n"; FAIL(); + + // Test that static assertions don't fire when macros are disabled + STATIC_CHECK( 0 == 1 ); + STATIC_REQUIRE( !true ); + + CAPTURE( 1 ); + CAPTURE( 1, "captured" ); + + REQUIRE_THAT( 1, + Catch::Matchers::Predicate( []( int ) { return false; } ) ); + BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); }; } #if defined(__clang__) diff --git a/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp index c981fa0bb9fdaabae48441ac92c00c049251c139..74b651c7504a222e083000144ee8ab8dccc3f2cc 100644 --- a/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp +++ b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp @@ -1,4 +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 + #include <catch2/catch_test_macros.hpp> +#include <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> TEST_CASE("Tests that run") { // All of these should be run and be reported @@ -20,3 +31,9 @@ TEST_CASE("Tests that abort") { // We should not get here, because the test above aborts REQUIRE(1 != 4); } + +TEST_CASE( "Misc. macros to check that they compile without exceptions" ) { + BENCHMARK( "simple benchmark" ) { return 1 * 2 + 3; }; + REQUIRE_THAT( 1, + Catch::Matchers::Predicate<int>( []( int i ) { return i == 1; } ) ); +} diff --git a/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp index ae698165e2103ec29b908b1f4ee2068fcd63854b..725440ec34d707e757c8d21255279e6aad0edca4 100644 --- a/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp +++ b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp @@ -1,10 +1,20 @@ + +// 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 <iostream> + 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'; + std::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); diff --git a/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp b/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp new file mode 100644 index 0000000000000000000000000000000000000000..62ceb4a770cf53de8e6d1c49217169bbac97e897 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp @@ -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 + +/**\file + * Checks that when `STATIC_CHECK` is deferred to runtime and fails, it + * does not abort the test case. + */ + +#include <catch2/catch_test_macros.hpp> + +TEST_CASE("Deferred static checks") { + STATIC_CHECK(1 == 2); + STATIC_CHECK_FALSE(1 != 2); + // This last assertion must be executed too + CHECK(1 == 2); +} diff --git a/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp index af31047b4f730448deb9e35eb973c7d4632d5df1..61ad62ea10a701e20e4ae2bb8a8c5cec1fc24ad7 100644 --- a/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp +++ b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp @@ -1,5 +1,18 @@ -// X10-FallbackStringifier.cpp -// Test that defining fallbackStringifier compiles + +// 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 + * Test that the user can define custom fallbackStringifier + * + * This is done by defining a custom fallback stringifier that prints + * out a specific string, and then asserting (to cause stringification) + * over a type without stringification support. + */ #include <string> diff --git a/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp index b127d246a838074e8bf08c45cdc3b21bcaa3e573..97dcea7b68e71072e62e08724c1905dd51da7ec5 100644 --- a/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp +++ b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp @@ -1,8 +1,18 @@ -// 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 :-) + +// 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 + * Test that stringification of original expression can be disabled. + * + * This is a workaround for VS 2017, 2019 issue with Raw String literals + * and preprocessor token pasting. + */ + #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp index 25ab4a0ec85494ca6c106cb97feb829b481182e3..e52c1c2b6d8dedc6584e99bb7e6b7482b3f345e3 100644 --- a/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp +++ b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp @@ -1,5 +1,14 @@ -// X12-CustomDebugBreakMacro.cpp -// Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. + +// 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 + * Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. + */ #include <iostream> diff --git a/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp b/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp index 997b9b9f3cf23739b08fc27be460fe0de9beefcf..686b50b1d68a35b83159b63d7b934350eb850915 100644 --- a/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp +++ b/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp @@ -18,7 +18,7 @@ #include <catch2/catch_test_macros.hpp> #include <catch2/reporters/catch_reporter_streaming_base.hpp> #include <catch2/catch_test_case_info.hpp> -#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> #include <catch2/generators/catch_generators.hpp> diff --git a/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp b/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c75d891e5e15de2ef6990c1107ddd264843a4e73 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp @@ -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 + +/**\file + * Test that the cumulative reporter base stores both assertions and + * benchmarks, and stores them in the right order. + * + * This is done through a custom reporter that writes out the assertions + * and benchmarks and checking that the output is in right order. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/reporters/catch_reporter_cumulative_base.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> +#include <utility> + +class CumulativeBenchmarkReporter final : public Catch::CumulativeReporterBase { + +public: + CumulativeBenchmarkReporter(Catch::ReporterConfig&& _config) : + CumulativeReporterBase(std::move(_config)) { + m_preferences.shouldReportAllAssertions = true; + } + + static std::string getDescription() { + return "Custom reporter for testing cumulative reporter base"; + } + + virtual void testRunEndedCumulative() override; +}; + +CATCH_REGISTER_REPORTER("testReporter", CumulativeBenchmarkReporter) + +#include <chrono> +#include <thread> + +TEST_CASE("Some assertions and benchmarks") { + using namespace std::chrono_literals; + + REQUIRE(1); + BENCHMARK("2") { + std::this_thread::sleep_for(1ms); + }; + REQUIRE(3); + BENCHMARK("4") { + std::this_thread::sleep_for(1ms); + }; + REQUIRE(5); +} + +void CumulativeBenchmarkReporter::testRunEndedCumulative() { + auto const& testCases = m_testRun->children; + assert(testCases.size() == 1); + + auto const& testCase = *testCases.front(); + auto const& sections = testCase.children; + assert(sections.size() == 1); + + auto const& section = *sections.front(); + assert(section.childSections.empty()); + for (auto const& aob : section.assertionsAndBenchmarks) { + if (aob.isAssertion()) { + auto const& assertion = aob.asAssertion(); + std::cout << assertion.assertionResult.getExpandedExpression() << '\n'; + } + if (aob.isBenchmark()) { + auto const& bench = aob.asBenchmark(); + std::cout << bench.info.name << '\n'; + } + } +} diff --git a/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp b/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e13f205b22d97b839c1743ffea727c0d54b5b6f --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.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 + +/**\file + * Test that reporter registration is case-preserving, selection is + * case-insensitive. + * + * This is done by registering a custom reporter that prints out a marker + * string upon construction and then invoking the binary with different + * casings of the name. + */ + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> +#include <utility> + +class TestReporter : public Catch::StreamingReporterBase { +public: + TestReporter(Catch::ReporterConfig&& _config): + StreamingReporterBase(std::move(_config)) { + std::cout << "TestReporter constructed\n"; + } + + static std::string getDescription() { + return "Reporter for testing casing handling in reporter registration/selection"; + } + + ~TestReporter() override; +}; + +TestReporter::~TestReporter() = default; + +CATCH_REGISTER_REPORTER("testReporterCASED", TestReporter) + diff --git a/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp b/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..605458515604b374aa7988282f3477b54c37f4ca --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.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 + +/**\file + * Registers custom listener that does not ask for captured stdout/err + * + * Running the binary with this listener, and asking for multiple _capturing_ + * reporters (one would be sufficient, but that would also mean depending on + * implementation details inside Catch2's handling of listeners), we check that + * nothing is written to stdout, because listeners should not be considered in + * whether the stdout should be passed-through or not. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> + +namespace { + class NonCapturingListener : public Catch::EventListenerBase { + public: + NonCapturingListener( Catch::IConfig const* config ): + EventListenerBase( config ) { + m_preferences.shouldRedirectStdOut = false; + std::cerr << "X24 - NonCapturingListener initialized.\n"; + } + }; +} + +CATCH_REGISTER_LISTENER( NonCapturingListener ) + +TEST_CASE( "Writes to stdout" ) { + std::cout << "X24 - FooBarBaz\n"; +} diff --git a/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp b/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a4a55ad75dbe919bd3d459f0fd16bb197a0978fa --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.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 + +/**\file + * Registers custom listener that asks for captured stdout/err + * + * Running the binary with this listener, and asking for multiple _noncapturing_ + * reporters (one would be sufficient, but that would also mean depending on + * implementation details inside Catch2's handling of listeners), we check that + * the listener gets redirected stdout, even though the reporters didn't ask for + * it. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> + +namespace { + class CapturingListener : public Catch::EventListenerBase { + public: + CapturingListener( Catch::IConfig const* config ): + EventListenerBase( config ) { + m_preferences.shouldRedirectStdOut = true; + std::cerr << "CapturingListener initialized\n"; + } + + void + testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override { + if ( testCaseStats.stdOut.empty() ) { + std::cerr << "X25 - ERROR: empty stdout\n"; + } + } + }; +} + +CATCH_REGISTER_LISTENER( CapturingListener ) + +TEST_CASE( "Writes to stdout" ) { + std::cout << "X25 - FooBarBaz\n"; +} diff --git a/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp b/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01aca7c0c8f29262c546183365fe821371fbff3a --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp @@ -0,0 +1,52 @@ + +// 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 + * Test that reporter is not passed passing assertions when it + * doesn't ask for it. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <iostream> +#include <utility> + +namespace { + + class TestReporter : public Catch::StreamingReporterBase { + public: + TestReporter(Catch::ReporterConfig&& _config): + StreamingReporterBase(std::move(_config)) { + m_preferences.shouldReportAllAssertions = false; + std::cout << "X26 - TestReporter constructed\n"; + } + + static std::string getDescription() { + return "X26 - test reporter that opts out of passing assertions"; + } + + void + assertionEnded( Catch::AssertionStats const& ) override { + std::cerr << "X26 - assertionEnded\n"; + } + + ~TestReporter() override; + }; + + TestReporter::~TestReporter() = default; + +} + +CATCH_REGISTER_REPORTER("test-reporter", TestReporter) + +TEST_CASE( "Test with only passing assertions" ) { + REQUIRE( 1 == 1 ); + REQUIRE( 2 == 2 ); +} diff --git a/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp b/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb29be0c1ed265d44763831a6c2ad47659daf998 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp @@ -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 + +/**\file + * Test that the captured stdout/err in (partial) testCaseEnded events + * is correct (e.g. that the partial test case event does not get accumulated + * output). + * + * This is done by having a single test case that is entered multiple + * times through generator, and a custom capturing reporter that knows + * what it should expect captured from the test case. + */ + + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/generators/catch_generators_range.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + + +#include <iostream> +#include <string> +#include <utility> + +class TestReporter : public Catch::StreamingReporterBase { + std::string stdOutString( uint64_t iter ){ + return "stdout " + std::to_string( iter ) + '\n'; + } + std::string stdErrString(uint64_t iter) { + return "stderr " + std::to_string( iter ) + '\n'; + } + +public: + TestReporter( Catch::ReporterConfig&& _config ): + StreamingReporterBase( std::move(_config) ) { + m_preferences.shouldRedirectStdOut = true; + std::cout << "X27 - TestReporter constructed\n"; + } + + static std::string getDescription() { + return "X27 test reporter"; + } + + void testCasePartialEnded( Catch::TestCaseStats const& stats, + uint64_t iter ) override { + if ( stats.stdOut != stdOutString( iter ) ) { + std::cerr << "X27 ERROR in partial stdout\n" << stats.stdOut; + } + if ( stats.stdErr != stdErrString( iter ) ) { + std::cerr << "X27 ERROR in partial stderr\n" << stats.stdErr; + } + } + + void testCaseEnded( Catch::TestCaseStats const& stats ) override { + if ( stats.stdOut != "stdout 0\nstdout 1\nstdout 2\nstdout 3\nstdout 4\nstdout 5\n" ) { + std::cerr << "X27 ERROR in full stdout\n" << stats.stdOut; + } + if ( stats.stdErr != "stderr 0\nstderr 1\nstderr 2\nstderr 3\nstderr 4\nstderr 5\n" ) { + std::cerr << "X27 ERROR in full stderr\n" << stats.stdErr; + } + } + + ~TestReporter() override; +}; + +TestReporter::~TestReporter() = default; + +CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) + +TEST_CASE( "repeatedly entered test case" ) { + auto i = GENERATE( range(0, 6) ); + std::cout << "stdout " << i << '\n'; + // Switch between writing to std::cerr and std::clog just to make sure + // both are properly captured and redirected. + ( ( i % 2 == 0 ) ? std::cerr : std::clog ) << "stderr " << i << '\n'; +} diff --git a/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp b/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8102edb23d6c5084564993f13b15b5cc2a4b504 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.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 + * Test that the different events are sent to listeners before they are + * sent to the reporters. + * + * We only do this for a subset of the events, as doing all of them would + * be annoying, and we can assume that their implementation is roughly + * the same, and thus if few work, all work. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + +#include <iostream> +#include <utility> + +namespace { + + static bool testRunStartingReceivedByListener = false; + static bool testRunEndedReceivedByListener = false; + static bool assertionStartingReceivedByListener = false; + static bool assertionEndedReceivedByListener = false; + + class TestListener : public Catch::EventListenerBase { + public: + TestListener( Catch::IConfig const* config ): + EventListenerBase( config ) { + std::cout << "X28 - TestListener constructed.\n"; + } + + void testRunStarting( Catch::TestRunInfo const& ) override { + testRunStartingReceivedByListener = true; + } + + void testRunEnded( Catch::TestRunStats const& ) override { + testRunEndedReceivedByListener = true; + } + + void assertionStarting( Catch::AssertionInfo const& ) override { + assertionStartingReceivedByListener = true; + } + + void assertionEnded( Catch::AssertionStats const& ) override { + assertionEndedReceivedByListener = true; + } + }; + + class TestReporter : public Catch::StreamingReporterBase { + public: + TestReporter( Catch::ReporterConfig&& _config ): + StreamingReporterBase( std::move(_config) ) { + std::cout << "X28 - TestReporter constructed\n"; + } + + void testRunStarting( Catch::TestRunInfo const& ) override { + if ( !testRunStartingReceivedByListener ) { + std::cout << "X28 - ERROR\n"; + } + } + + void testRunEnded( Catch::TestRunStats const& ) override { + if ( !testRunEndedReceivedByListener ) { + std::cout << "X28 - ERROR\n"; + } + } + + void assertionStarting( Catch::AssertionInfo const& ) override { + if ( !assertionStartingReceivedByListener ) { + std::cout << "X28 - ERROR\n"; + } + } + + void assertionEnded( Catch::AssertionStats const& ) override { + if ( !assertionEndedReceivedByListener ) { + std::cout << "X28 - ERROR\n"; + } + } + + static std::string getDescription() { return "X28 test reporter"; } + ~TestReporter() override; + }; + + TestReporter::~TestReporter() = default; + +} // end unnamed namespace + +CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) +CATCH_REGISTER_LISTENER( TestListener ) + +TEST_CASE( "Dummy test case" ) { REQUIRE( 1 == 1 ); } diff --git a/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp b/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d3af7dc75bf3758a45eeaf6dc432ff52323af7eb --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.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 + +/**\file + * Test that custom options are properly passed down to the reporter. + * + * We print out the arguments sorted by key, to have a stable expected + * output. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> + +#include <algorithm> +#include <iostream> +#include <string> +#include <utility> +#include <vector> + +class TestReporter : public Catch::StreamingReporterBase { +public: + TestReporter( Catch::ReporterConfig&& _config ): + StreamingReporterBase( std::move(_config) ) { + std::cout << "X29 - TestReporter constructed\n"; + } + + static std::string getDescription() { + return "X29 test reporter"; + } + + void testRunStarting( Catch::TestRunInfo const& ) override { + std::vector<std::pair<std::string, std::string>> options; + for ( auto const& kv : m_customOptions ) { + options.push_back( kv ); + } + std::sort( options.begin(), options.end() ); + bool first = true; + for ( auto const& kv : options ) { + if ( !first ) { std::cout << "::"; } + std::cout << kv.first << "=" << kv.second; + first = false; + } + std::cout << '\n'; + } + + ~TestReporter() override; +}; + +TestReporter::~TestReporter() = default; + +CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) + +TEST_CASE( "Just a test case to run things" ) {} diff --git a/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp b/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a6168dbe4c89b990068eb92398bd43040d02218 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp @@ -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 + +/**\file + * Test the Bazel report functionality with a simple set + * of dummy test cases. + */ + +#include <catch2/catch_test_macros.hpp> + +TEST_CASE( "Passing test case" ) { REQUIRE( 1 == 1 ); } +TEST_CASE( "Failing test case" ) { REQUIRE( 2 == 1 ); } diff --git a/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp b/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc0dd0b97f5d67df726bae8d320274443fb7758d --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp @@ -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 + * Checks that reporter registration errors are caught and handled as + * startup errors, by causing a registration error by registering multiple + * reporters with the same name. + */ + +#include <catch2/catch_test_macros.hpp> + +#include <catch2/reporters/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + +namespace { + //! Trivial custom reporter for registration + class TestReporter : public Catch::StreamingReporterBase { + public: + using StreamingReporterBase::StreamingReporterBase; + + static std::string getDescription() { return "X35 test reporter"; } + }; +} + +CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) +CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) diff --git a/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp index 307e877f21504d5df77e99f44f0b191eeb342ca8..739b34d409335694e119ca78fcc35bd954948692 100644 --- a/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp +++ b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp @@ -1,7 +1,17 @@ -// 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. + +// 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 + * 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> diff --git a/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp index e3b31f9b26285411ca68447669cb17f8bf61bbae..d77f55d5ba93013f499b57e6dbce72b79ada8641 100644 --- a/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp +++ b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp @@ -1,5 +1,12 @@ + +// 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 file serves as a simple compilation test against the amalgamated * version of Catch2. */ diff --git a/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp b/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc6bf597ac5a9aabd7497d690c4df9c6757feff6 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp @@ -0,0 +1,11 @@ + +// 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 + * Links into executable with no tests which should fail when run + */ diff --git a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt index 5d599b6efac9828ca918af303ab3c4a2140c945f..b8b5956601f0348b9da829840b5490bac8cb6242 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -1,5 +1,4 @@ :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 @@ -29,7 +28,7 @@ Nor would this :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: XFAIL #835 -- errno should not be touched by Catch2 :test-result: PASS #872 :test-result: PASS #961 -- Dynamically created sections should all be reported :test-result: FAIL 'Not' checks that should fail @@ -100,8 +99,12 @@ Nor would this :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 CaseInsensitiveEqualsTo is case insensitive +:test-result: PASS CaseInsensitiveLess is case insensitive :test-result: PASS Character pretty printing :test-result: PASS Clara::Arg supports single-arg parse the way Opt does +:test-result: PASS Clara::Opt supports accept-many lambdas +:test-result: PASS ColourGuard behaviour :test-result: PASS Combining MatchAllOfGeneric does not nest :test-result: PASS Combining MatchAnyOfGeneric does not nest :test-result: PASS Combining MatchNotOfGeneric does not nest @@ -120,11 +123,14 @@ Nor would this :test-result: PASS Composed matchers shortcircuit :test-result: FAIL Contains string matcher :test-result: PASS Copy and then generate a range +:test-result: PASS Cout stream properly declares it writes to stdout :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: PASS Empty stream name opens cout stream +:test-result: PASS Empty tag is not allowed :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 @@ -149,6 +155,10 @@ Nor would this :test-result: PASS Generators -- simple :test-result: PASS Generators internals :test-result: PASS Greater-than inequalities with different epsilons +:test-result: PASS Hashers with different seed produce different hash with same test case +:test-result: PASS Hashers with same seed produce same hash +:test-result: PASS Hashing different test cases produces different result +:test-result: PASS Hashing test case produces same hash across multiple calls :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 @@ -164,7 +174,10 @@ Nor would this :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: XFAIL Mayfail test case with nested sections :test-result: FAIL Mismatching exception messages failing the test +:test-result: PASS Multireporter calls reporters and listeners in correct order +:test-result: PASS Multireporter updates ReporterPreferences properly :test-result: PASS Nested generators and captured variables :test-result: FAIL Nice descriptive name :test-result: FAIL Non-std exceptions can be translated @@ -176,6 +189,10 @@ Nor would this :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 Parsed tags are matched case insensitive +:test-result: PASS Parsing sharding-related cli flags +:test-result: PASS Parsing tags with non-alphabetical characters is pass-through +:test-result: PASS Parsing warnings :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* @@ -183,11 +200,15 @@ Nor would this :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 Random seed generation accepts known methods +:test-result: PASS Random seed generation reports unknown methods :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 Registering reporter with '::' in name fails :test-result: PASS Regression test #1 :test-result: PASS Reporter's write listings to provided stream +:test-result: PASS Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla :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 @@ -215,6 +236,7 @@ Message from section two :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 Tags with spaces and non-alphanumerical characters are accepted :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 @@ -233,6 +255,7 @@ Message from section two :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 identical tags keeps just one :test-result: PASS Test case with one argument :test-result: PASS Test enum bit values :test-result: PASS Test with special, characters "in name @@ -248,8 +271,11 @@ Message from section two :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 AllTrue range matcher :test-result: PASS Usage of AnyMatch range matcher +:test-result: PASS Usage of AnyTrue range matcher :test-result: PASS Usage of NoneMatch range matcher +:test-result: PASS Usage of NoneTrue range matcher :test-result: PASS Usage of the SizeIs range matcher :test-result: PASS Use a custom approx :test-result: PASS Variadic macros @@ -264,8 +290,6 @@ Message from section two :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 @@ -274,7 +298,6 @@ Message from section two :test-result: PASS XmlWriter writes boolean attributes as true/false :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 @@ -292,6 +315,7 @@ Message from section two :test-result: FAIL first tag loose text artifact :test-result: FAIL has printf +:test-result: PASS is_unary_function :test-result: FAIL just failure :test-result: FAIL just failure after unscoped info :test-result: FAIL just info @@ -299,6 +323,7 @@ loose text artifact :test-result: PASS long long :test-result: FAIL looped SECTION tests :test-result: FAIL looped tests +:test-result: PASS makeStream recognizes %debug stream name :test-result: PASS make_unique reimplementation :test-result: PASS mean :test-result: PASS measure @@ -321,6 +346,7 @@ loose text artifact :test-result: FAIL prints unscoped info only for the first assertion :test-result: PASS random SECTION tests :test-result: PASS replaceInPlace +:test-result: PASS request an unknown %-starting stream fails :test-result: PASS resolution :test-result: PASS run_for_at_least, chronometer :test-result: PASS run_for_at_least, int @@ -330,12 +356,13 @@ loose text artifact :test-result: PASS shortened hide tags are split apart :test-result: PASS splitString :test-result: FAIL stacks unscoped info in loops +:test-result: PASS startsWith :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 stdout and stderr streams have %-starting name :test-result: PASS stringify ranges :test-result: PASS stringify( has_maker ) :test-result: PASS stringify( has_maker_and_operator ) @@ -360,7 +387,6 @@ loose text artifact :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 diff --git a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..2afd308bc4a723ce00eff68d06f6284388fc7197 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -0,0 +1,394 @@ +:test-result: PASS # A test name that starts with a # +: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 +: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: PASS #2152 - ULP checks between differently signed values were wrong - double +:test-result: PASS #2152 - ULP checks between differently signed values were wrong - float +: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 Catch2 +: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 CaseInsensitiveEqualsTo is case insensitive +:test-result: PASS CaseInsensitiveLess is case insensitive +:test-result: PASS Character pretty printing +:test-result: PASS Clara::Arg supports single-arg parse the way Opt does +:test-result: PASS Clara::Opt supports accept-many lambdas +:test-result: PASS ColourGuard behaviour +: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: PASS Cout stream properly declares it writes to stdout +: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: PASS Empty stream name opens cout stream +:test-result: PASS Empty tag is not allowed +: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: PASS Hashers with different seed produce different hash with same test case +:test-result: PASS Hashers with same seed produce same hash +:test-result: PASS Hashing different test cases produces different result +:test-result: PASS Hashing test case produces same hash across multiple calls +: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: XFAIL Mayfail test case with nested sections +:test-result: FAIL Mismatching exception messages failing the test +:test-result: PASS Multireporter calls reporters and listeners in correct order +:test-result: PASS Multireporter updates ReporterPreferences properly +: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 Parsed tags are matched case insensitive +:test-result: PASS Parsing sharding-related cli flags +:test-result: PASS Parsing tags with non-alphabetical characters is pass-through +:test-result: PASS Parsing warnings +: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 Random seed generation accepts known methods +:test-result: PASS Random seed generation reports unknown methods +: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 Registering reporter with '::' in name fails +:test-result: PASS Regression test #1 +:test-result: PASS Reporter's write listings to provided stream +:test-result: PASS Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla +: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 +:test-result: FAIL Sends stuff to stdout and stderr +:test-result: PASS Some simple comparisons between doubles +: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 char arrays with statically known sizes - char +:test-result: PASS Stringifying char arrays with statically known sizes - signed char +:test-result: PASS Stringifying char arrays with statically known sizes - unsigned char +: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 Tags with spaces and non-alphanumerical characters are accepted +: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 identical tags keeps just one +: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: PASS Testing checked-if +:test-result: XFAIL Testing checked-if 2 +:test-result: XFAIL Testing checked-if 3 +: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 AllTrue range matcher +:test-result: PASS Usage of AnyMatch range matcher +:test-result: PASS Usage of AnyTrue range matcher +:test-result: PASS Usage of NoneMatch range matcher +:test-result: PASS Usage of NoneTrue 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: 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 XmlWriter writes boolean attributes as true/false +:test-result: PASS analyse no analysis +:test-result: PASS array<int, N> -> toString +: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 convertToBits +:test-result: PASS empty tags are not allowed +:test-result: PASS erfc_inv +:test-result: PASS estimate_clock_resolution +:test-result: PASS even more nested SECTION tests +:test-result: FAIL first tag +:test-result: FAIL has printf +:test-result: PASS is_unary_function +: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 makeStream recognizes %debug stream name +: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 request an unknown %-starting stream fails +: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 startsWith +: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: PASS stdout and stderr streams have %-starting name +: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: PASS tags with dots in later positions are not parsed as hidden +: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<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 index 556db26166f4eb203ca15903d7f08e132e6002f8..6d23d01de2d5942b83d5fe94205ab9d425db0dd2 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1,6 +1,6 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * +RNG seed: 1 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: {?} == {?} @@ -96,7 +96,7 @@ 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 +Misc.tests.cpp:<line number>: passed: errno_after == 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' @@ -334,6 +334,21 @@ Message.tests.cpp:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2 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' +Details.tests.cpp:<line number>: passed: eq( "", "" ) for: true +Details.tests.cpp:<line number>: passed: !(eq( "", "a" )) for: !false +Details.tests.cpp:<line number>: passed: eq( "a", "a" ) for: true +Details.tests.cpp:<line number>: passed: eq( "a", "A" ) for: true +Details.tests.cpp:<line number>: passed: eq( "A", "a" ) for: true +Details.tests.cpp:<line number>: passed: eq( "A", "A" ) for: true +Details.tests.cpp:<line number>: passed: !(eq( "a", "b" )) for: !false +Details.tests.cpp:<line number>: passed: !(eq( "a", "B" )) for: !false +Details.tests.cpp:<line number>: passed: lt( "", "a" ) for: true +Details.tests.cpp:<line number>: passed: !(lt( "a", "a" )) for: !false +Details.tests.cpp:<line number>: passed: !(lt( "", "" )) for: !false +Details.tests.cpp:<line number>: passed: lt( "a", "b" ) for: true +Details.tests.cpp:<line number>: passed: lt( "a", "B" ) for: true +Details.tests.cpp:<line number>: passed: lt( "A", "b" ) for: true +Details.tests.cpp:<line number>: passed: lt( "A", "B" ) for: true 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' @@ -350,33 +365,63 @@ 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" +Clara.tests.cpp:<line number>: passed: !(parse_result) for: !{?} +Clara.tests.cpp:<line number>: passed: parse_result for: {?} +Clara.tests.cpp:<line number>: passed: res == std::vector<std::string>{ "aaa", "bbb" } for: { "aaa", "bbb" } == { "aaa", "bbb" } +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str().empty() for: true +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" for: "1 +Using code: 2 +2 +Using code: 0 +3 +" +== +"1 +Using code: 2 +2 +Using code: 0 +3 +" +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 +A +B +Using code: 0 +C +" +== +"Using code: 2 +A +B +Using code: 0 +C +" 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: 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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: 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" 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: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" 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: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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" ) @@ -447,8 +492,8 @@ 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" +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), ContainsSubstring( "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(), ContainsSubstring( "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 @@ -463,6 +508,7 @@ 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 +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isConsole() for: true 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' @@ -473,6 +519,8 @@ ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: V ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true +Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) 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" @@ -528,8 +576,8 @@ Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" fo Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" Exception.tests.cpp:<line number>: passed: thisThrows(), EndsWith( "exception" ) for: "expected exception" ends with: "exception" -Exception.tests.cpp:<line number>: passed: thisThrows(), Contains( "except" ) for: "expected exception" contains: "except" -Exception.tests.cpp:<line number>: passed: thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) for: "expected exception" contains: "except" (case insensitive) +Exception.tests.cpp:<line number>: passed: thisThrows(), ContainsSubstring( "except" ) for: "expected exception" contains: "except" +Exception.tests.cpp:<line number>: passed: thisThrows(), ContainsSubstring( "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" @@ -692,7 +740,12 @@ 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() == 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: filter([](int) { return false; }, values({ 1, 2, 3 })), 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 @@ -865,6 +918,24 @@ Approx.tests.cpp:<line number>: passed: d >= Approx( 1.22 ) for: 1.23 >= Approx( 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 ) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h1( dummy ) != h2( dummy ) for: 3422778688 (0x<hex digits>) +!= +130711275 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h1( dummy ) == h2( dummy ) for: 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x<hex digits>) +!= +2668622104 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) +!= +3916075712 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) +!= +3429949824 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) 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' @@ -904,15 +975,38 @@ Approx.tests.cpp:<line number>: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( 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" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) +Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), !ContainsSubstring( "different" ) for: "this string contains 'abc' as a substring" not contains: "different" +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), !ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly 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" +Reporters.tests.cpp:<line number>: passed: records == expected for: { "Hello", "world", "Goodbye", "world" } +== +{ "Hello", "world", "Goodbye", "world" } +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true 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 @@ -936,6 +1030,8 @@ 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)' +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 @@ -1174,6 +1270,32 @@ CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("hidden an 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 +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-count=8" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardCount == 8 for: 8 == 8 +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=2" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 2 for: 2 == 2 +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=0" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 0 for: 0 == 0 +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == WarnAbout::NoAssertions for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 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 @@ -1194,8 +1316,12 @@ CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "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: config.reporterSpecifications.empty() for: true CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false +CmdLine.tests.cpp:<line number>: passed: cfg.getReporterSpecs().size() == 1 for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } for: {?} == {?} +CmdLine.tests.cpp:<line number>: passed: cfg.getProcessedReporterSpecs().size() == 1 for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } for: {?} == {?} 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 @@ -1208,15 +1334,24 @@ 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: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } for: { {?}, {?} } == { {?}, {?} } +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } 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: result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") for: "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." 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: {?} @@ -1226,7 +1361,7 @@ 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: result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("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: {?} @@ -1236,29 +1371,29 @@ CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(i 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: result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("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: config.defaultOutputFilename == "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: config.defaultOutputFilename == "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: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--colour-mode", "default" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "ansi"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::ANSI for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "none"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::None for: 3 == 3 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: result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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: {?} @@ -1272,146 +1407,151 @@ CmdLine.tests.cpp:<line number>: passed: config.benchmarkWarmupTime == 10 for: 1 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 2 >= 1 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 1 +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) 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 +Reporters.tests.cpp:<line number>: passed: registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag -" contains: "fakeTag" with 1 message: 'Tested reporter: automake' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fake reporter"s) for: "Available reporters: fake reporter: fake description -" contains: "fake reporter" with 1 message: 'Tested reporter: automake' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +" ( 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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' +" 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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' +" 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +" ( 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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' +" 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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' +" 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +" ( 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag -" contains: "fakeTag" with 1 message: 'Tested reporter: tap' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fake reporter"s) for: "Available reporters: fake reporter: fake description -" contains: "fake reporter" with 1 message: 'Tested reporter: tap' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +" ( 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag -" contains: "fakeTag" with 1 message: 'Tested reporter: teamcity' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fake reporter"s) for: "Available reporters: fake reporter: fake description -" contains: "fake reporter" with 1 message: 'Tested reporter: teamcity' +" 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +" ( 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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> <TagsFromMatchingTests> <Tag> <Count>1</Count> @@ -1419,17 +1559,17 @@ Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) f <Alias>fakeTag</Alias> </Aliases> </Tag> -</TagsFromMatchingTests>" contains: "fakeTag" with 1 message: 'Tested reporter: xml' +</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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("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' +</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"?> +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> <MatchingTests> <TestCase> <Name>fake test name</Name> @@ -1440,7 +1580,8 @@ Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test n <Line>123456789</Line> </SourceInfo> </TestCase> -</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: xml' +</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: XML' +Reporters.tests.cpp:<line number>: passed: 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 @@ -1476,10 +1617,10 @@ ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify(arr) = 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(), ContainsSubstring( "string" ) for: "this string contains 'abc' as a substring" contains: "string" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "abc" ) for: "this string contains 'abc' as a substring" contains: "abc" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "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" @@ -1493,6 +1634,8 @@ String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 fo 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.data() +String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string" +String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string" 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 @@ -1560,22 +1703,24 @@ Misc.tests.cpp:<line number>: failed: s1 == s2 for: "if ($b == 10) { $a = 20; } " -Tag.tests.cpp:<line number>: passed: what, Contains( "[@zzz]" ) for: "error: tag alias, '[@zzz]' already registered. +Tag.tests.cpp:<line number>: passed: what, ContainsSubstring( "[@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. +Tag.tests.cpp:<line number>: passed: what, ContainsSubstring( "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. +Tag.tests.cpp:<line number>: passed: what, ContainsSubstring( "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. +Tag.tests.cpp:<line number>: passed: what, ContainsSubstring( "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 ) ) +Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2 +Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) 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 @@ -1722,6 +1867,8 @@ 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 +Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 1 for: 1 == 1 +Tag.tests.cpp:<line number>: passed: testCase.tags[0] == Tag( "tag1" ) for: {?} == {?} 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: @@ -1736,21 +1883,25 @@ Misc.tests.cpp:<line number>: failed: explicitly Misc.tests.cpp:<line number>: failed - but was ok: false Misc.tests.cpp:<line number>: failed: explicitly 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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("[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: +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"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: +" ( contains: "fake reporter" and contains: "fake description" ) +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) for: "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) 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 @@ -1851,47 +2002,104 @@ MatchersRanges.tests.cpp:<line number>: passed: data, AllMatch(SizeIs(5)) for: { 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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { false, false, false, false, false } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { false, false, false, false, false } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { true, true, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { false, false, true, false, false } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { true, true, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { false, false, true, false, false } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AnyTrue() for: { false, false, false, false, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AnyTrue() for: { false, false, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { true, true, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { } contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { false, false, true, false, false } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { true, true, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { false, false, true, false, false } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !NoneTrue() for: { false, false, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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 @@ -1965,8 +2173,6 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'e 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: @@ -1987,7 +2193,7 @@ Xml.tests.cpp:<line number>: passed: encode( stringWithQuotes, Catch::XmlEncode: "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]" -Xml.tests.cpp:<line number>: passed: stream.str(), Contains(R"(attr1="true")") && Contains(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> +Xml.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.point.count() == 23 for: 23.0 == 23 @@ -2006,7 +2212,6 @@ InternalBenchmark.tests.cpp:<line number>: passed: analysis.outlier_variance == 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 @@ -2090,6 +2295,18 @@ Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: loose text artifact +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<int>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<std::string const&>::value)' 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>) @@ -2113,6 +2330,7 @@ Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 mes 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' +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%debug" ) 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: {?} == {?} @@ -2184,6 +2402,7 @@ StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x 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" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%somestream" ) 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>) @@ -2218,12 +2437,15 @@ InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.itera 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: . ) +Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} 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' +StringManip.tests.cpp:<line number>: passed: !(startsWith("", 'c')) for: !false +StringManip.tests.cpp:<line number>: passed: startsWith(std::string("abc"), 'a') for: true +StringManip.tests.cpp:<line number>: passed: startsWith("def"_catch_sr, 'd') for: true 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 } }" @@ -2239,7 +2461,8 @@ ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( set ) 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" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isConsole() for: true +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isConsole() for: true ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" @@ -2301,9 +2524,6 @@ ToStringTuple.tests.cpp:<line number>: passed: "{ }" == ::Catch::Detail::stringi 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" }" @@ -2379,5 +2599,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 146 assertions. +Failed 83 test cases, failed 143 assertions. diff --git a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3500a352d5d15e9548f7c92be723e5b00ffd66b --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -0,0 +1,2595 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * +RNG seed: 1 +Misc.tests.cpp:<line number>: passed: with 1 message: 'yay' +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' +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: +Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, 4.9406564584124654e-324]) +Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) +Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) +Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +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_after == 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' +Details.tests.cpp:<line number>: passed: eq( "", "" ) for: true +Details.tests.cpp:<line number>: passed: !(eq( "", "a" )) for: !false +Details.tests.cpp:<line number>: passed: eq( "a", "a" ) for: true +Details.tests.cpp:<line number>: passed: eq( "a", "A" ) for: true +Details.tests.cpp:<line number>: passed: eq( "A", "a" ) for: true +Details.tests.cpp:<line number>: passed: eq( "A", "A" ) for: true +Details.tests.cpp:<line number>: passed: !(eq( "a", "b" )) for: !false +Details.tests.cpp:<line number>: passed: !(eq( "a", "B" )) for: !false +Details.tests.cpp:<line number>: passed: lt( "", "a" ) for: true +Details.tests.cpp:<line number>: passed: !(lt( "a", "a" )) for: !false +Details.tests.cpp:<line number>: passed: !(lt( "", "" )) for: !false +Details.tests.cpp:<line number>: passed: lt( "a", "b" ) for: true +Details.tests.cpp:<line number>: passed: lt( "a", "B" ) for: true +Details.tests.cpp:<line number>: passed: lt( "A", "b" ) for: true +Details.tests.cpp:<line number>: passed: lt( "A", "B" ) for: true +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" +Clara.tests.cpp:<line number>: passed: !(parse_result) for: !{?} +Clara.tests.cpp:<line number>: passed: parse_result for: {?} +Clara.tests.cpp:<line number>: passed: res == std::vector<std::string>{ "aaa", "bbb" } for: { "aaa", "bbb" } == { "aaa", "bbb" } +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str().empty() for: true +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" for: "1 +Using code: 2 +2 +Using code: 0 +3 +" +== +"1 +Using code: 2 +2 +Using code: 0 +3 +" +ColourImpl.tests.cpp:<line number>: passed: streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 +A +B +Using code: 0 +C +" +== +"Using code: 2 +A +B +Using code: 0 +C +" +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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" +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 (string) "1" +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 (string) "1" +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 (string) "1" +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 (string) "1" 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 (string) "1" 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 (string) "1" 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(), ContainsSubstring( "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(), ContainsSubstring( "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 +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isConsole() for: true +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 **}" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true +Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) +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(), ContainsSubstring( "except" ) for: "expected exception" contains: "except" +Exception.tests.cpp:<line number>: passed: thisThrows(), ContainsSubstring( "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: -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: 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: filter([](int) { return false; }, values({ 1, 2, 3 })), 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 ) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h1( dummy ) != h2( dummy ) for: 3422778688 (0x<hex digits>) +!= +130711275 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h1( dummy ) == h2( dummy ) for: 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x<hex digits>) +!= +2668622104 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) +!= +3916075712 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) +!= +3429949824 (0x<hex digits>) +TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) +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(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) +Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), !ContainsSubstring( "different" ) for: "this string contains 'abc' as a substring" not contains: "different" +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), !ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly +Condition.tests.cpp:<line number>: failed: explicitly +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" +Reporters.tests.cpp:<line number>: passed: records == expected for: { "Hello", "world", "Goodbye", "world" } +== +{ "Hello", "world", "Goodbye", "world" } +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +Reporters.tests.cpp:<line number>: passed: multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +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)' +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 +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-count=8" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardCount == 8 for: 8 == 8 +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=2" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 2 for: 2 == 2 +CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=0" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 0 for: 0 == 0 +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true with 1 message: 'tagString := "[tag with spaces]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == WarnAbout::NoAssertions for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 +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.reporterSpecifications.empty() for: true +CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false +CmdLine.tests.cpp:<line number>: passed: cfg.getReporterSpecs().size() == 1 for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } for: {?} == {?} +CmdLine.tests.cpp:<line number>: passed: cfg.getProcessedReporterSpecs().size() == 1 for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } for: {?} == {?} +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: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: result for: {?} with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } for: { {?}, {?} } == { {?}, {?} } +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } for: { {?}, {?} } == { {?}, {?} } +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") for: "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." +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(), ContainsSubstring("convert") && ContainsSubstring("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(), ContainsSubstring("never") && ContainsSubstring("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.defaultOutputFilename == "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.defaultOutputFilename == "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.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--colour-mode", "default" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "ansi"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::ANSI for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "none"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::None for: 3 == 3 +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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 +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(method) +RandomNumberGeneration.tests.cpp:<line number>: passed: Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) +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 +Reporters.tests.cpp:<line number>: passed: registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" +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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +Reporters.tests.cpp:<line number>: passed: +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 +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 +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(), ContainsSubstring( "string" ) for: "this string contains 'abc' as a substring" contains: "string" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "abc" ) for: "this string contains 'abc' as a substring" contains: "abc" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "this" ) for: "this string contains 'abc' as a substring" starts with: "this" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( "substring" ) for: "this string contains 'abc' as a substring" ends with: "substring" +Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) +String.tests.cpp:<line number>: passed: empty.empty() for: true +String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: std::strcmp( empty.data(), "" ) == 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: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 +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.data() +String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string" +String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string" +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.data(), "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.data(), "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.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: '!(sr1.empty())' +String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3' +String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()' +String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0' +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +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, ContainsSubstring( "[@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, ContainsSubstring( "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, ContainsSubstring( "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, ContainsSubstring( "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 ) ) +Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2 +Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +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 +Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 1 for: 1 == 1 +Tag.tests.cpp:<line number>: passed: testCase.tags[0] == Tag( "tag1" ) for: {?} == {?} +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: +Misc.tests.cpp:<line number>: passed: true +Misc.tests.cpp:<line number>: passed: +Misc.tests.cpp:<line number>: failed - but was ok: false +Misc.tests.cpp:<line number>: passed: true +Misc.tests.cpp:<line number>: failed - but was ok: false +Misc.tests.cpp:<line number>: passed: +Misc.tests.cpp:<line number>: passed: true +Misc.tests.cpp:<line number>: failed: explicitly +Misc.tests.cpp:<line number>: failed - but was ok: false +Misc.tests.cpp:<line number>: failed: explicitly +Message.tests.cpp:<line number>: failed - but was ok: 1 == 2 +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("[fakeTag]"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "[fakeTag]" +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) for: "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) for: "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) +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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { false, false, false, false, false } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: data, !AllTrue() for: { false, false, false, false, false } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AllTrue() for: { true, true, true, true, true } contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !AllTrue() for: { true, true, false, true, true } not contains only true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { true, true, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { false, false, true, false, false } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { true, true, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, AnyTrue() for: { false, false, true, false, false } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AnyTrue() for: { false, false, false, false, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, AnyTrue() for: { false, false, true, true, true } contains at least one true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_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.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { true, true, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { } contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { false, false, true, false, false } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { true, true, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneTrue() for: { false, false, true, false, false } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: data, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked, NoneTrue() for: { false, false, false, false, false } contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !NoneTrue() for: { false, false, true, true, true } not contains no true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_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>: 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]" +Xml.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> +<Element1 attr1="true" attr2="false"/> +" ( contains: "attr1="true"" and contains: "attr2="false"" ) +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 }" +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 - but was ok: 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 - but was ok: 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 +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( 0.f ) == 0 for: 0 == 0 +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( -0.f ) == ( 1ULL << 31 ) for: 2147483648 (0x<hex digits>) +== +2147483648 (0x<hex digits>) +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( 0. ) == 0 for: 0 == 0 +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( -0. ) == ( 1ULL << 63 ) for: 9223372036854775808 (0x<hex digits>) +== +9223372036854775808 (0x<hex digits>) +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 +FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) +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: +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<int>::value)' +Clara.tests.cpp:<line number>: passed: with 1 message: '!(Catch::Clara::Detail::is_unary_function<std::string const&>::value)' +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' +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%debug" ) +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" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%somestream" ) +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: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} 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' +StringManip.tests.cpp:<line number>: passed: !(startsWith("", 'c')) for: !false +StringManip.tests.cpp:<line number>: passed: startsWith(std::string("abc"), 'a') for: true +StringManip.tests.cpp:<line number>: passed: startsWith("def"_catch_sr, 'd') for: true +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 } }" +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isConsole() for: true +Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isConsole() for: true +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 +Tag.tests.cpp:<line number>: passed: testcase.tags.size() == 1 for: 1 == 1 +Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +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: "{ \"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 83 test cases, failed 143 assertions. + diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt index 8704f8b373385c0d6b778d9b731a3bc19844e0aa..6962e50826101c2e9d072f04c20170c8ea9b1a9f 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt @@ -1,11 +1,10 @@ Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -<exe-name> is a <version> host application. +<exe-name> is a Catch2 v<version> host application. Run with -? for options -Randomness seeded to: 1 - ------------------------------------------------------------------------------- #1455 - INFO and WARN can start with a linebreak ------------------------------------------------------------------------------- @@ -54,7 +53,7 @@ due to unexpected exception with messages: expected exception ------------------------------------------------------------------------------- -#835 -- errno should not be touched by Catch +#835 -- errno should not be touched by Catch2 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -332,13 +331,13 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" @@ -678,7 +677,7 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -690,10 +689,50 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" +------------------------------------------------------------------------------- +Mayfail test case with nested sections + A + 1 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + A + 2 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + B + 1 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + B + 2 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + ------------------------------------------------------------------------------- Mismatching exception messages failing the test ------------------------------------------------------------------------------- @@ -1125,26 +1164,6 @@ 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 ------------------------------------------------------------------------------- @@ -1364,17 +1383,6 @@ with messages: 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 ------------------------------------------------------------------------------- @@ -1386,6 +1394,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 368 | 292 passed | 70 failed | 6 failed as expected -assertions: 2103 | 1951 passed | 129 failed | 23 failed as expected +test cases: 394 | 318 passed | 69 failed | 7 failed as expected +assertions: 2284 | 2129 passed | 128 failed | 27 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 index 08cef9ace3d04e517a50191c4466ac7fe89d7520..63dd231e89388f1ff7507f579243d648913cf245 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt @@ -1,11 +1,10 @@ Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -<exe-name> is a <version> host application. +<exe-name> is a Catch2 v<version> host application. Run with -? for options -Randomness seeded to: 1 - ------------------------------------------------------------------------------- # A test name that starts with a # ------------------------------------------------------------------------------- @@ -16,23 +15,6 @@ 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 ------------------------------------------------------------------------------- @@ -863,7 +845,7 @@ with expansion: true ------------------------------------------------------------------------------- -#835 -- errno should not be touched by Catch +#835 -- errno should not be touched by Catch2 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -874,7 +856,7 @@ with expansion: 1 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( errno == 1 ) + REQUIRE( errno_after == 1 ) with expansion: 1 == 1 @@ -2801,6 +2783,109 @@ ToStringGeneral.tests.cpp:<line number>: PASSED: with message: 3 +------------------------------------------------------------------------------- +CaseInsensitiveEqualsTo is case insensitive + Degenerate cases +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "", "" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "", "a" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveEqualsTo is case insensitive + Plain comparisons +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "a", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "a", "A" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "A", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "A", "A" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "a", "b" ) ) +with expansion: + !false + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "a", "B" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveLess is case insensitive + Degenerate cases +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lt( "a", "a" ) ) +with expansion: + !false + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lt( "", "" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveLess is case insensitive + Plain comparisons +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "a", "b" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "a", "B" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "A", "b" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "A", "B" ) ) +with expansion: + true + ------------------------------------------------------------------------------- Character pretty printing Specifically escaped @@ -2908,6 +2993,95 @@ Clara.tests.cpp:<line number>: PASSED: with expansion: "foo" == "foo" +------------------------------------------------------------------------------- +Clara::Opt supports accept-many lambdas + Parsing fails on multiple options without accept_many +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: + CHECK_FALSE( parse_result ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Clara::Opt supports accept-many lambdas + Parsing succeeds on multiple options with accept_many +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: + CHECK( parse_result ) +with expansion: + {?} + +Clara.tests.cpp:<line number>: PASSED: + CHECK( res == std::vector<std::string>{ "aaa", "bbb" } ) +with expansion: + { "aaa", "bbb" } == { "aaa", "bbb" } + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard is disengaged by default +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str().empty() ) +with expansion: + true + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard is engaged by op<< +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" ) +with expansion: + "1 + Using code: 2 + 2 + Using code: 0 + 3 + " + == + "1 + Using code: 2 + 2 + Using code: 0 + 3 + " + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard can be engaged explicitly +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" ) +with expansion: + "Using code: 2 + A + B + Using code: 0 + C + " + == + "Using code: 2 + A + B + Using code: 0 + C + " + ------------------------------------------------------------------------------- Combining MatchAllOfGeneric does not nest ------------------------------------------------------------------------------- @@ -2922,7 +3096,7 @@ with message: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: @@ -2933,7 +3107,7 @@ with message: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: @@ -2945,7 +3119,7 @@ with message: 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 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) ------------------------------------------------------------------------------- @@ -2962,7 +3136,7 @@ with message: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: @@ -2973,7 +3147,7 @@ with message: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: @@ -2985,7 +3159,7 @@ with message: 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 + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) ------------------------------------------------------------------------------- @@ -3002,7 +3176,7 @@ with message: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THAT( 0, !MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:<line number>: PASSED: with message: @@ -3011,7 +3185,7 @@ with message: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THAT( 1, !!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" Matchers.tests.cpp:<line number>: PASSED: with message: @@ -3021,7 +3195,7 @@ with message: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THAT( 0, !!!MatcherA() ) with expansion: - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" Matchers.tests.cpp:<line number>: PASSED: with message: @@ -3030,7 +3204,7 @@ with message: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THAT( 1, !!!!MatcherA() ) with expansion: - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" ------------------------------------------------------------------------------- Combining concrete matchers does not use templated matchers @@ -3058,7 +3232,7 @@ with message: 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 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) Matchers.tests.cpp:<line number>: PASSED: with message: @@ -3068,7 +3242,7 @@ with message: 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 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) Matchers.tests.cpp:<line number>: PASSED: with message: @@ -3079,7 +3253,7 @@ with message: 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 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) ------------------------------------------------------------------------------- Combining templated and concrete matchers @@ -3519,13 +3693,13 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" @@ -3690,6 +3864,17 @@ Generators.tests.cpp:<line number>: PASSED: with expansion: 6 == 6 +------------------------------------------------------------------------------- +Cout stream properly declares it writes to stdout +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "-" )->isConsole() ) +with expansion: + true + ------------------------------------------------------------------------------- Custom exceptions can be translated when testing for nothrow ------------------------------------------------------------------------------- @@ -3761,6 +3946,26 @@ with expansion: == "{** unexpected enum value **}" +------------------------------------------------------------------------------- +Empty stream name opens cout stream +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "" )->isConsole() ) +with expansion: + true + +------------------------------------------------------------------------------- +Empty tag is not allowed +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) ) + ------------------------------------------------------------------------------- EndsWith string matcher ------------------------------------------------------------------------------- @@ -4119,12 +4324,12 @@ with expansion: "expected exception" ends with: "exception" Exception.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS_WITH( thisThrows(), Contains( "except" ) ) + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "except" ) ) with expansion: "expected exception" contains: "except" Exception.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS_WITH( thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) ) + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) ) with expansion: "expected exception" contains: "except" (case insensitive) @@ -5411,6 +5616,35 @@ with expansion: ------------------------------------------------------------------------------- Generators internals Filter generator + Simple filtering +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Generators internals + Filter generator + Filter out multiple elements at the start and end ------------------------------------------------------------------------------- GeneratorsImpl.tests.cpp:<line number> ............................................................................... @@ -5435,8 +5669,19 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED: with expansion: !false +------------------------------------------------------------------------------- +Generators internals + Filter generator + Throws on construction if it can't get initial element +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS_AS( filter([] (int) { return false; }, value(1)), Catch::GeneratorException ) + REQUIRE_THROWS_AS( filter([](int) { return false; }, value(1)), Catch::GeneratorException ) + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException ) ------------------------------------------------------------------------------- Generators internals @@ -6586,6 +6831,87 @@ Approx.tests.cpp:<line number>: PASSED: with expansion: 1.23 >= Approx( 1.24 ) +------------------------------------------------------------------------------- +Hashers with different seed produce different hash with same test case +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h1( dummy ) != h2( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + != + 130711275 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashers with same seed produce same hash +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h1( dummy ) == h2( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + == + 3422778688 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different test name +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2903002874 (0x<hex digits>) + != + 2668622104 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different classname +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2673152918 (0x<hex digits>) + != + 3916075712 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different tags +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2074929312 (0x<hex digits>) + != + 3429949824 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing test case produces same hash across multiple calls +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy ) == h( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + == + 3422778688 (0x<hex digits>) + ------------------------------------------------------------------------------- INFO and WARN do not abort tests ------------------------------------------------------------------------------- @@ -6893,7 +7219,7 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) ) with expansion: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) @@ -6905,13 +7231,13 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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" ) ) + CHECK_THAT( testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) ) with expansion: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) @@ -6923,7 +7249,7 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) ) + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) @@ -6935,7 +7261,7 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -6947,7 +7273,7 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), !Contains( "different" ) ) + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "different" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "different" @@ -6958,39 +7284,198 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" ------------------------------------------------------------------------------- -Mismatching exception messages failing the test +Mayfail test case with nested sections + A + 1 ------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> +Condition.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" +Condition.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -Nested generators and captured variables +Mayfail test case with nested sections + A + 2 ------------------------------------------------------------------------------- -Generators.tests.cpp:<line number> +Condition.tests.cpp:<line number> ............................................................................... -Generators.tests.cpp:<line number>: PASSED: - REQUIRE( values > -6 ) -with expansion: - 3 > -6 +Condition.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -Nested generators and captured variables +Mayfail test case with nested sections + B + 1 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + B + 2 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Multireporter calls reporters and listeners in correct order +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( records == expected ) +with expansion: + { "Hello", "world", "Goodbye", "world" } + == + { "Hello", "world", "Goodbye", "world" } + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly + Adding listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly + Adding reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +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> ............................................................................... @@ -7203,6 +7688,14 @@ 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) + Compilation.tests.cpp:<line number>: PASSED: with message: std::is_void<void>::value @@ -8563,155 +9056,401 @@ with expansion: true ------------------------------------------------------------------------------- -Pointers can be compared to null +Parsed tags are matched case insensitive ------------------------------------------------------------------------------- -Condition.tests.cpp:<line number> +TestSpecParser.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 ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - 0x<hex digits> != 0 + true -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cp != 0 ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - 0x<hex digits> != 0 + true -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cpc != 0 ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - 0x<hex digits> != 0 + true -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsNull() == 0 ) -with expansion: - {null string} == 0 +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + shard-count +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsConstNull() == 0 ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--shard-count=8" }) ) with expansion: - {null string} == 0 + {?} -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( 0 != p ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.shardCount == 8 ) with expansion: - 0 != 0x<hex digits> + 8 == 8 ------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Floats +Parsing sharding-related cli flags + Negative shard count reports error ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 3 + 5 ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( result ) with expansion: - 8 == 8 + !{?} -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 3 + 10 ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) with expansion: - 13 == 13 + "Shard count must be a positive number" contains: "Shard count must be a + positive number" ------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Double +Parsing sharding-related cli flags + Zero shard count reports error ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 2 + 5 ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( result ) with expansion: - 7 == 7 + !{?} -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 2 + 15 ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) with expansion: - 17 == 17 + "Shard count must be a positive number" contains: "Shard count must be a + positive number" ------------------------------------------------------------------------------- -Predicate matcher can accept const char* +Parsing sharding-related cli flags + shard-index ------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--shard-index=2" }) ) with expansion: - "foo" matches undescribed predicate + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.shardIndex == 2 ) +with expansion: + 2 == 2 ------------------------------------------------------------------------------- -Process can be configured on command line - empty args don't cause a crash +Parsing sharding-related cli flags + Negative shard index reports error ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) + CHECK_FALSE( result ) with expansion: - {?} + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "" ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") ) with expansion: - "" == "" + "Shard index must be a non-negative number" contains: "Shard index must be a + non-negative number" ------------------------------------------------------------------------------- -Process can be configured on command line - default - no arguments +Parsing sharding-related cli flags + Shard index 0 is accepted ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) + CHECK( cli.parse({ "test", "--shard-index=0" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "test" ) + REQUIRE( config.shardIndex == 0 ) with expansion: - "test" == "test" + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.shouldDebugBreak == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.abortAfter == -1 ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - -1 == -1 + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.noThrow == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.reporterName == "console" ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - "console" == "console" + true +with message: + tagString := "[tag with spaces]" + +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +------------------------------------------------------------------------------- +Parsing warnings + NoAssertions +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == WarnAbout::NoAssertions ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Parsing warnings + NoTests is no longer supported +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Parsing warnings + Combining multiple warnings +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +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.reporterSpecifications.empty() ) +with expansion: + true CmdLine.tests.cpp:<line number>: PASSED: CHECK_FALSE( cfg.hasTestFilters() ) with expansion: !false +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getReporterSpecs().size() == 1 ) +with expansion: + 1 == 1 + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) +with expansion: + {?} == {?} + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) +with expansion: + 1 == 1 + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) +with expansion: + {?} == {?} + ------------------------------------------------------------------------------- Process can be configured on command line test lists @@ -8805,14 +9544,18 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-r", "console"}) ) + CHECK( result ) with expansion: {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterName == "console" ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) with expansion: - "console" == "console" + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- Process can be configured on command line @@ -8823,14 +9566,18 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-r", "xml"}) ) + CHECK( result ) with expansion: {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterName == "xml" ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) with expansion: - "xml" == "xml" + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- Process can be configured on command line @@ -8841,27 +9588,18 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--reporter", "junit"}) ) + CHECK( result ) with expansion: {?} +with message: + result.errorMessage() := "" 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" }) ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) with expansion: - !{?} + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- Process can be configured on command line @@ -8877,62 +9615,164 @@ with expansion: true CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), Contains("Unrecognized reporter") ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Unrecognized reporter") ) with expansion: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" ------------------------------------------------------------------------------- Process can be configured on command line - debugger - -b + reporter + With output file ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-b"}) ) + CHECK( result ) with expansion: {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- Process can be configured on command line - debugger - --break + reporter + With Windows-like absolute path as output file ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--break"}) ) + CHECK( result ) with expansion: {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) with expansion: - true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- Process can be configured on command line - abort - -a aborts after first failure + reporter + Multiple reporters + All with output files ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-a"}) ) + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.abortAfter == 1 ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) +with expansion: + { {?}, {?} } == { {?}, {?} } + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + Mixed output files and default output +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) +with expansion: + { {?}, {?} } == { {?}, {?} } + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + cannot have multiple reporters with default output +------------------------------------------------------------------------------- +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(), ContainsSubstring("Only one reporter may have unspecified output file.") ) +with expansion: + "Only one reporter may have unspecified output file." contains: "Only one + reporter may have unspecified output file." + +------------------------------------------------------------------------------- +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 @@ -8968,7 +9808,7 @@ with expansion: true CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), Contains("convert") && Contains("oops") ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") ) with expansion: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) @@ -9064,7 +9904,7 @@ with expansion: true CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), Contains("never") && Contains("both") ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") ) with expansion: "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) @@ -9119,7 +9959,7 @@ with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.outputFilename == "filename.ext" ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: "filename.ext" == "filename.ext" @@ -9137,7 +9977,7 @@ with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.outputFilename == "filename.ext" ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: "filename.ext" == "filename.ext" @@ -9183,7 +10023,7 @@ with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.useColour == UseColour::Auto ) + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: 0 == 0 @@ -9196,12 +10036,12 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--use-colour", "auto"}) ) + CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.useColour == UseColour::Auto ) + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: 0 == 0 @@ -9214,12 +10054,12 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--use-colour", "yes"}) ) + CHECK( cli.parse({"test", "--colour-mode", "ansi"}) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.useColour == UseColour::Yes ) + REQUIRE( config.defaultColourMode == ColourMode::ANSI ) with expansion: 1 == 1 @@ -9232,14 +10072,14 @@ CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--use-colour", "no"}) ) + CHECK( cli.parse({"test", "--colour-mode", "none"}) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.useColour == UseColour::No ) + REQUIRE( config.defaultColourMode == ColourMode::None ) with expansion: - 2 == 2 + 3 == 3 ------------------------------------------------------------------------------- Process can be configured on command line @@ -9255,10 +10095,10 @@ with expansion: true CmdLine.tests.cpp:<line number>: PASSED: - CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) ) + CHECK_THAT( result.errorMessage(), ContainsSubstring( "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" + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not + recognised" contains: "colour mode must be one of" ------------------------------------------------------------------------------- Process can be configured on command line @@ -9383,6 +10223,42 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 1 >= 1 +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation reports unknown methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) ) + ------------------------------------------------------------------------------- Range type with sentinel ------------------------------------------------------------------------------- @@ -9429,6 +10305,18 @@ with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively +------------------------------------------------------------------------------- +Registering reporter with '::' in name fails +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_WITH( registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" ) +with expansion: + "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is + not allowed in reporter name: 'with::doublecolons'" + ------------------------------------------------------------------------------- Regression test #1 ------------------------------------------------------------------------------- @@ -9453,13 +10341,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - automake reporter lists tags + Automake reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -9467,7 +10355,7 @@ with expansion: " contains: "fakeTag" with message: - Tested reporter: automake + Tested reporter: Automake ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9482,20 +10370,20 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - automake reporter lists reporters + Automake reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "Available reporters: fake reporter: fake description " contains: "fake reporter" with message: - Tested reporter: automake + Tested reporter: Automake ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9510,13 +10398,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - automake reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -9525,7 +10413,7 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: automake + Tested reporter: Automake ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9546,7 +10434,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -9575,7 +10463,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "Available reporters: fake reporter: fake description @@ -9603,7 +10491,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -9633,7 +10521,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -9662,7 +10550,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "Available reporters: fake reporter: fake description @@ -9690,7 +10578,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -9714,13 +10602,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - junit reporter lists tags + JUnit reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> All available tags: @@ -9729,7 +10617,7 @@ with expansion: " contains: "fakeTag" with message: - Tested reporter: junit + Tested reporter: JUnit ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9744,13 +10632,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - junit reporter lists reporters + JUnit reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> Available reporters: @@ -9758,7 +10646,7 @@ with expansion: " contains: "fake reporter" with message: - Tested reporter: junit + Tested reporter: JUnit ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9773,13 +10661,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - junit reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> All available test cases: @@ -9789,7 +10677,7 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: junit + Tested reporter: JUnit ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9804,13 +10692,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - sonarqube reporter lists tags + SonarQube reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> All available tags: @@ -9819,7 +10707,7 @@ with expansion: " contains: "fakeTag" with message: - Tested reporter: sonarqube + Tested reporter: SonarQube ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9834,13 +10722,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - sonarqube reporter lists reporters + SonarQube reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> Available reporters: @@ -9848,7 +10736,7 @@ with expansion: " contains: "fake reporter" with message: - Tested reporter: sonarqube + Tested reporter: SonarQube ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9863,13 +10751,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - sonarqube reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> All available test cases: @@ -9879,7 +10767,7 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: sonarqube + Tested reporter: SonarQube ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9894,13 +10782,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - tap reporter lists tags + TAP reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -9908,7 +10796,7 @@ with expansion: " contains: "fakeTag" with message: - Tested reporter: tap + Tested reporter: TAP ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9923,20 +10811,20 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - tap reporter lists reporters + TAP reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "Available reporters: fake reporter: fake description " contains: "fake reporter" with message: - Tested reporter: tap + Tested reporter: TAP ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9951,13 +10839,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - tap reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -9966,7 +10854,7 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: tap + Tested reporter: TAP ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -9981,13 +10869,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - teamcity reporter lists tags + TeamCity reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -9995,7 +10883,7 @@ with expansion: " contains: "fakeTag" with message: - Tested reporter: teamcity + Tested reporter: TeamCity ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -10010,20 +10898,20 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - teamcity reporter lists reporters + TeamCity reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "Available reporters: fake reporter: fake description " contains: "fake reporter" with message: - Tested reporter: teamcity + Tested reporter: TeamCity ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -10038,13 +10926,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - teamcity reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -10053,7 +10941,7 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: teamcity + Tested reporter: TeamCity ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -10068,13 +10956,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - xml reporter lists tags + XML reporter lists tags ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fakeTag"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> <TagsFromMatchingTests> @@ -10086,7 +10974,7 @@ with expansion: </Tag> </TagsFromMatchingTests>" contains: "fakeTag" with message: - Tested reporter: xml + Tested reporter: XML ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -10101,13 +10989,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - xml reporter lists reporters + XML reporter lists reporters ------------------------------------------------------------------------------- Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> <AvailableReporters> @@ -10117,7 +11005,7 @@ with expansion: </Reporter> </AvailableReporters>" contains: "fake reporter" with message: - Tested reporter: xml + Tested reporter: XML ------------------------------------------------------------------------------- Reporter's write listings to provided stream @@ -10132,13 +11020,13 @@ with expansion: ------------------------------------------------------------------------------- Reporter's write listings to provided stream - xml reporter lists tests + 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 ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> <MatchingTests> @@ -10153,7 +11041,16 @@ with expansion: </TestCase> </MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) with message: - Tested reporter: xml + Tested reporter: XML + +------------------------------------------------------------------------------- +Reproducer for #2309 - a very long description past 80 chars (default console +width) with a late colon : blablabla +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: ------------------------------------------------------------------------------- SUCCEED counts as a test pass @@ -10474,23 +11371,23 @@ Matchers.tests.cpp:<line number> ............................................................................... Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ) + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "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 ) ) + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "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" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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 ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) @@ -10579,6 +11476,30 @@ String.tests.cpp:<line number>: PASSED: String.tests.cpp:<line number>: PASSED: REQUIRE_NOTHROW( original.data() ) +------------------------------------------------------------------------------- +StringRef + Copy construction is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) +with expansion: + "original string" == "original string" + +------------------------------------------------------------------------------- +StringRef + Copy assignment is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) +with expansion: + "original string" == "original string" + ------------------------------------------------------------------------------- StringRef Substrings @@ -11035,28 +11956,28 @@ Tag.tests.cpp:<line number> ............................................................................... Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, Contains( "[@zzz]" ) ) + CHECK_THAT( what, ContainsSubstring( "[@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" ) ) + CHECK_THAT( what, ContainsSubstring( "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" ) ) + CHECK_THAT( what, ContainsSubstring( "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" ) ) + CHECK_THAT( what, ContainsSubstring( "10" ) ) with expansion: "error: tag alias, '[@zzz]' already registered. First seen at: file:2 @@ -11081,6 +12002,22 @@ Tag.tests.cpp:<line number>: PASSED: Tag.tests.cpp:<line number>: PASSED: CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) +------------------------------------------------------------------------------- +Tags with spaces and non-alphanumerical characters are accepted +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 2 ) +with expansion: + 2 == 2 + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) +with expansion: + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + ------------------------------------------------------------------------------- Template test case method with test types specified inside std::tuple - MyTypes - 0 @@ -12358,6 +13295,22 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 15 >= 15 +------------------------------------------------------------------------------- +Test case with identical tags keeps just one +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 1 ) +with expansion: + 1 == 1 + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) +with expansion: + {?} == {?} + ------------------------------------------------------------------------------- Test case with one argument ------------------------------------------------------------------------------- @@ -12451,7 +13404,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("[fakeTag]"s) ) + REQUIRE_THAT( listingString, ContainsSubstring("[fakeTag]"s) ) with expansion: "All available tags: 1 [fakeTag] @@ -12467,12 +13420,12 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains("fake reporter"s) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) with expansion: "Available reporters: fake reporter: fake description -" contains: "fake reporter" +" ( contains: "fake reporter" and contains: "fake description" ) ------------------------------------------------------------------------------- The default listing implementation write to provided stream @@ -12482,7 +13435,7 @@ Reporters.tests.cpp:<line number> ............................................................................... Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: "All available test cases: fake test name @@ -12491,6 +13444,21 @@ with expansion: " ( contains: "fake test name" and contains: "fakeTestTag" ) +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) +with expansion: + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) + ------------------------------------------------------------------------------- This test 'should' fail but doesn't ------------------------------------------------------------------------------- @@ -13032,78 +14000,520 @@ with expansion: 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 + 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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + One false evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { false, false, false, false, false } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + One false evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { false, false, false, false, false } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[1] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[2] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Basic usage + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) +with expansion: + { true, true, true, true, true } contains at least one true ------------------------------------------------------------------------------- -Unexpected exceptions can be translated +Usage of AnyTrue range matcher + Basic usage + Empty evaluates to false ------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -Exception.tests.cpp:<line number>: FAILED: -due to unexpected exception with message: - 3.14 +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyTrue() ) +with expansion: + { } not contains at least one true ------------------------------------------------------------------------------- -Upcasting special member functions - Move constructor +Usage of AnyTrue range matcher + Basic usage + One true evalutes to true ------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) with expansion: - 3 == 3 + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Upcasting special member functions - move assignment +Usage of AnyTrue range matcher + Basic usage + All false evaluates to false ------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - 3 == 3 + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher - Basic usage +Usage of AnyTrue range matcher + Contained type is convertible to bool + All true evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) + REQUIRE_THAT( data, AnyTrue() ) 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 + { true, true, true, true, true } contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Contained type is convertible to bool + One true evalutes to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) + REQUIRE_THAT( data, AnyTrue() ) 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 ) + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher - Type requires ADL found begin and end +Usage of AnyTrue range matcher + Contained type is convertible to bool + All false evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -13111,37 +14521,37 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, allMatch ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { false, false, false, false, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[1] ) + REQUIRE( mocked.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[2] ) + REQUIRE( mocked.m_derefed[2] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[3] ) + REQUIRE( mocked.m_derefed[3] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[4] ) + REQUIRE( mocked.m_derefed[4] ) with expansion: true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -13149,69 +14559,69 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !allMatch ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + { false, false, true, true, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[1] ) + REQUIRE( mocked.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[2] ) + REQUIRE( mocked.m_derefed[2] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[3] ) + REQUIRE_FALSE( mocked.m_derefed[3] ) with expansion: !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[4] ) + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: !false ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Basic usage ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) + 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 } } any match has size == 5 + }, { 1, 0, 0, -1, 5 } } none match has size == 6 MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) + 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 any match ( contains element 0 and contains - element 10 ) + }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains + element 1 ) ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +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, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) + REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -13219,37 +14629,37 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !anyMatch ) + REQUIRE_THAT( mocked, noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[1] ) + REQUIRE( mocked.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[2] ) + REQUIRE( mocked.m_derefed[2] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[3] ) + REQUIRE( mocked.m_derefed[3] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[4] ) + REQUIRE( mocked.m_derefed[4] ) with expansion: true ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -13257,69 +14667,128 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, anyMatch ) + REQUIRE_THAT( mocked, !noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[1] ) + REQUIRE_FALSE( mocked.m_derefed[1] ) with expansion: !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[2] ) + REQUIRE_FALSE( mocked.m_derefed[2] ) with expansion: !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[3] ) + REQUIRE_FALSE( mocked.m_derefed[3] ) with expansion: !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[4] ) + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: !false ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher +Usage of NoneTrue range matcher Basic usage + All true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) + REQUIRE_THAT( data, !NoneTrue() ) 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 + { true, true, true, true, true } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) + REQUIRE_THAT( data, NoneTrue() ) 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 ) + { } contains no true ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Type requires ADL found begin and end +Usage of NoneTrue range matcher + Basic usage + One true evalutes to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { false, false, true, false, false } not contains no true ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher +Usage of NoneTrue range matcher + Basic usage + All false evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneTrue() ) +with expansion: + { false, false, false, false, false } contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + All true evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { true, true, true, true, true } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + One true evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { false, false, true, false, false } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + All false evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneTrue() ) +with expansion: + { false, false, false, false, false } contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -13327,37 +14796,37 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, noneMatch ) + REQUIRE_THAT( mocked, NoneTrue() ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { false, false, false, false, false } contains no true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[1] ) + REQUIRE( mocked.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[2] ) + REQUIRE( mocked.m_derefed[2] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[3] ) + REQUIRE( mocked.m_derefed[3] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[4] ) + REQUIRE( mocked.m_derefed[4] ) with expansion: true ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher +Usage of NoneTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -13365,32 +14834,32 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !noneMatch ) + REQUIRE_THAT( mocked, !NoneTrue() ) with expansion: - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { false, false, true, true, true } not contains no true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.derefed[0] ) + REQUIRE( mocked.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[1] ) + REQUIRE( mocked.m_derefed[1] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[2] ) + REQUIRE( mocked.m_derefed[2] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[3] ) + REQUIRE_FALSE( mocked.m_derefed[3] ) with expansion: !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.derefed[4] ) + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: !false @@ -13939,32 +15408,6 @@ 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 ------------------------------------------------------------------------------- @@ -14116,7 +15559,7 @@ Xml.tests.cpp:<line number> ............................................................................... Xml.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( stream.str(), Contains(R"(attr1="true")") && Contains(R"(attr2="false")") ) + REQUIRE_THAT( stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") ) with expansion: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> @@ -14214,17 +15657,6 @@ ToStringVector.tests.cpp:<line number>: PASSED: 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 @@ -14772,6 +16204,60 @@ Tricky.tests.cpp:<line number> No assertions in test case 'has printf' +------------------------------------------------------------------------------- +is_unary_function +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<int>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<std::string const&>::value) + ------------------------------------------------------------------------------- just failure ------------------------------------------------------------------------------- @@ -15005,6 +16491,15 @@ with expansion: with message: Testing if fib[7] (21) is even +------------------------------------------------------------------------------- +makeStream recognizes %debug stream name +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::makeStream( "%debug" ) ) + ------------------------------------------------------------------------------- make_unique reimplementation From lvalue copies @@ -15591,6 +17086,15 @@ StringManip.tests.cpp:<line number>: PASSED: with expansion: "didn|'t" == "didn|'t" +------------------------------------------------------------------------------- +request an unknown %-starting stream fails +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ) + ------------------------------------------------------------------------------- resolution ------------------------------------------------------------------------------- @@ -15808,9 +17312,9 @@ Tag.tests.cpp:<line number> ............................................................................... Tag.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) ) + REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) ) with expansion: - { ., magic-tag } ( Contains: magic-tag and Contains: . ) + { {?}, {?} } ( Contains: {?} and Contains: {?} ) ------------------------------------------------------------------------------- splitString @@ -15855,6 +17359,27 @@ with messages: 5 6 +------------------------------------------------------------------------------- +startsWith +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_FALSE( startsWith("", 'c') ) +with expansion: + !false + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( startsWith(std::string("abc"), 'a') ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( startsWith("def"_catch_sr, 'd') ) +with expansion: + true + ------------------------------------------------------------------------------- std::map is convertible string empty @@ -15967,15 +17492,20 @@ with expansion: "{ { "green", 55 } }" ------------------------------------------------------------------------------- -string literals of different sizes can be compared +stdout and stderr streams have %-starting name ------------------------------------------------------------------------------- -Tricky.tests.cpp:<line number> +Stream.tests.cpp:<line number> ............................................................................... -Tricky.tests.cpp:<line number>: FAILED: - REQUIRE( std::string( "first" ) == "second" ) +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "%stderr" )->isConsole() ) +with expansion: + true + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "%stdout" )->isConsole() ) with expansion: - "first" == "second" + true ------------------------------------------------------------------------------- stringify ranges @@ -16381,19 +17911,6 @@ ToStringTuple.tests.cpp:<line number>: PASSED: 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> ------------------------------------------------------------------------------- @@ -16933,6 +18450,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 368 | 276 passed | 86 failed | 6 failed as expected -assertions: 2120 | 1951 passed | 146 failed | 23 failed as expected +test cases: 394 | 304 passed | 83 failed | 7 failed as expected +assertions: 2299 | 2129 passed | 143 failed | 27 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cba323d9b0a409c01f7ee93fbc323babda82f4f --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -0,0 +1,18447 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Randomness seeded to: 1 + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +<exe-name> is a Catch2 v<version> host application. +Run with -? for options + +------------------------------------------------------------------------------- +# A test name that starts with a # +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: +with message: + yay + +------------------------------------------------------------------------------- +#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' + +------------------------------------------------------------------------------- +#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: + +------------------------------------------------------------------------------- +#2152 - ULP checks between differently signed values were wrong - double +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) ) +with expansion: + 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, + 4.9406564584124654e-324]) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) ) +with expansion: + 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e- + 324, -0.0000000000000000e+00]) + +------------------------------------------------------------------------------- +#2152 - ULP checks between differently signed values were wrong - float +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) ) +with expansion: + 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) ) +with expansion: + 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0. + 00000000e+00]) + +------------------------------------------------------------------------------- +#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 Catch2 +------------------------------------------------------------------------------- +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_after == 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 + +------------------------------------------------------------------------------- +CaseInsensitiveEqualsTo is case insensitive + Degenerate cases +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "", "" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "", "a" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveEqualsTo is case insensitive + Plain comparisons +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "a", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "a", "A" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "A", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( eq( "A", "A" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "a", "b" ) ) +with expansion: + !false + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( eq( "a", "B" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveLess is case insensitive + Degenerate cases +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "", "a" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lt( "a", "a" ) ) +with expansion: + !false + +Details.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lt( "", "" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +CaseInsensitiveLess is case insensitive + Plain comparisons +------------------------------------------------------------------------------- +Details.tests.cpp:<line number> +............................................................................... + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "a", "b" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "a", "B" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "A", "b" ) ) +with expansion: + true + +Details.tests.cpp:<line number>: PASSED: + REQUIRE( lt( "A", "B" ) ) +with expansion: + true + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Clara::Opt supports accept-many lambdas + Parsing fails on multiple options without accept_many +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: + CHECK_FALSE( parse_result ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Clara::Opt supports accept-many lambdas + Parsing succeeds on multiple options with accept_many +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: + CHECK( parse_result ) +with expansion: + {?} + +Clara.tests.cpp:<line number>: PASSED: + CHECK( res == std::vector<std::string>{ "aaa", "bbb" } ) +with expansion: + { "aaa", "bbb" } == { "aaa", "bbb" } + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard is disengaged by default +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str().empty() ) +with expansion: + true + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard is engaged by op<< +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" ) +with expansion: + "1 + Using code: 2 + 2 + Using code: 0 + 3 + " + == + "1 + Using code: 2 + 2 + Using code: 0 + 3 + " + +------------------------------------------------------------------------------- +ColourGuard behaviour + ColourGuard can be engaged explicitly +------------------------------------------------------------------------------- +ColourImpl.tests.cpp:<line number> +............................................................................... + +ColourImpl.tests.cpp:<line number>: PASSED: + REQUIRE( streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" ) +with expansion: + "Using code: 2 + A + B + Using code: 0 + C + " + == + "Using code: 2 + A + B + Using code: 0 + C + " + +------------------------------------------------------------------------------- +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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" + +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 (string) "1" + +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 (string) "1" + +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 (string) "1" + +------------------------------------------------------------------------------- +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 (string) "1" 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 (string) "1" 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 (string) "1" 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(), ContainsSubstring( "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(), ContainsSubstring( "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 + +------------------------------------------------------------------------------- +Cout stream properly declares it writes to stdout +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "-" )->isConsole() ) +with expansion: + true + +------------------------------------------------------------------------------- +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 **}" + +------------------------------------------------------------------------------- +Empty stream name opens cout stream +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "" )->isConsole() ) +with expansion: + true + +------------------------------------------------------------------------------- +Empty tag is not allowed +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) ) + +------------------------------------------------------------------------------- +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(), ContainsSubstring( "except" ) ) +with expansion: + "expected exception" contains: "except" + +Exception.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "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( -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 + Simple filtering +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Generators internals + Filter generator + Filter out multiple elements at the start and end +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Generators internals + Filter generator + Throws on construction if it can't get initial element +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter([](int) { return false; }, value(1)), Catch::GeneratorException ) + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter([](int) { return false; }, values({ 1, 2, 3 })), 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 ) + +------------------------------------------------------------------------------- +Hashers with different seed produce different hash with same test case +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h1( dummy ) != h2( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + != + 130711275 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashers with same seed produce same hash +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h1( dummy ) == h2( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + == + 3422778688 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different test name +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2903002874 (0x<hex digits>) + != + 2668622104 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different classname +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2673152918 (0x<hex digits>) + != + 3916075712 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different tags +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2074929312 (0x<hex digits>) + != + 3429949824 (0x<hex digits>) + +------------------------------------------------------------------------------- +Hashing test case produces same hash across multiple calls +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp:<line number> +............................................................................... + +TestCaseInfoHasher.tests.cpp:<line number>: PASSED: + REQUIRE( h( dummy ) == h( dummy ) ) +with expansion: + 3422778688 (0x<hex digits>) + == + 3422778688 (0x<hex digits>) + +------------------------------------------------------------------------------- +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(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "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(), !ContainsSubstring( "substring" ) ) +with expansion: + "this string contains 'abc' as a substring" not contains: "substring" + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + A + 1 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + A + 2 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + B + 1 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Mayfail test case with nested sections + B + 2 +------------------------------------------------------------------------------- +Condition.tests.cpp:<line number> +............................................................................... + +Condition.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Multireporter calls reporters and listeners in correct order +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( records == expected ) +with expansion: + { "Hello", "world", "Goodbye", "world" } + == + { "Hello", "world", "Goodbye", "world" } + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly + Adding listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +Multireporter updates ReporterPreferences properly + Adding reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ) +with expansion: + false == false + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ) +with expansion: + true == true + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +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) + +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 + +------------------------------------------------------------------------------- +Parsed tags are matched case insensitive +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) +with expansion: + true + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) +with expansion: + true + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + shard-count +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--shard-count=8" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.shardCount == 8 ) +with expansion: + 8 == 8 + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Negative shard count reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( result ) +with expansion: + !{?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) +with expansion: + "Shard count must be a positive number" contains: "Shard count must be a + positive number" + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Zero shard count reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( result ) +with expansion: + !{?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) +with expansion: + "Shard count must be a positive number" contains: "Shard count must be a + positive number" + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + shard-index +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--shard-index=2" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.shardIndex == 2 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Negative shard index reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( result ) +with expansion: + !{?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") ) +with expansion: + "Shard index must be a non-negative number" contains: "Shard index must be a + non-negative number" + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Shard index 0 is accepted +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--shard-index=0" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.shardIndex == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) +with expansion: + true +with message: + tagString := "[tag with spaces]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) +with expansion: + true +with message: + tagString := "[tag with spaces]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) +with expansion: + true +with message: + tagString := "[tag with spaces]" + +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) +with expansion: + true +with message: + tagString := "[I said "good day" sir!]" + +------------------------------------------------------------------------------- +Parsing warnings + NoAssertions +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == WarnAbout::NoAssertions ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Parsing warnings + NoTests is no longer supported +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Parsing warnings + Combining multiple warnings +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +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.reporterSpecifications.empty() ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( cfg.hasTestFilters() ) +with expansion: + !false + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getReporterSpecs().size() == 1 ) +with expansion: + 1 == 1 + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) +with expansion: + {?} == {?} + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) +with expansion: + 1 == 1 + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) +with expansion: + {?} == {?} + +------------------------------------------------------------------------------- +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( result ) +with expansion: + {?} +with message: + result.errorMessage() := "" + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) +with expansion: + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + -r/xml +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( result ) +with expansion: + {?} +with message: + result.errorMessage() := "" + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) +with expansion: + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + --reporter/junit +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( result ) +with expansion: + {?} +with message: + result.errorMessage() := "" + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) +with expansion: + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +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(), ContainsSubstring("Unrecognized reporter") ) +with expansion: + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" + contains: "Unrecognized reporter" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + With output file +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( result ) +with expansion: + {?} +with message: + result.errorMessage() := "" + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) +with expansion: + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + With Windows-like absolute path as output file +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( result ) +with expansion: + {?} +with message: + result.errorMessage() := "" + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) +with expansion: + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + All with output files +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) +with expansion: + { {?}, {?} } == { {?}, {?} } + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + Mixed output files and default output +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) +with expansion: + { {?}, {?} } == { {?}, {?} } + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + cannot have multiple reporters with default output +------------------------------------------------------------------------------- +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(), ContainsSubstring("Only one reporter may have unspecified output file.") ) +with expansion: + "Only one reporter may have unspecified output file." contains: "Only one + reporter may have unspecified output file." + +------------------------------------------------------------------------------- +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(), ContainsSubstring("convert") && ContainsSubstring("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(), ContainsSubstring("never") && ContainsSubstring("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.defaultOutputFilename == "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.defaultOutputFilename == "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.defaultColourMode == ColourMode::PlatformDefault ) +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", "--colour-mode", "default" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) +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", "--colour-mode", "ansi"}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.defaultColourMode == ColourMode::ANSI ) +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", "--colour-mode", "none"}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.defaultColourMode == ColourMode::None ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +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(), ContainsSubstring( "colour mode must be one of" ) ) +with expansion: + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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 + +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation accepts known methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::generateRandomSeed(method) ) + +------------------------------------------------------------------------------- +Random seed generation reports unknown methods +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) ) + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Registering reporter with '::' in name fails +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_WITH( registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" ) +with expansion: + "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is + not allowed in reporter name: 'with::doublecolons'" + +------------------------------------------------------------------------------- +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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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 + +------------------------------------------------------------------------------- +Reproducer for #2309 - a very long description past 80 chars (default console +width) with a late colon : blablabla +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Standard output from all sections is reported + one +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'one' + +------------------------------------------------------------------------------- +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(), ContainsSubstring( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "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(), ContainsSubstring( "abc" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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( std::strcmp( empty.data(), "" ) == 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( std::strcmp( rawChars, "hello" ) == 0 ) +with expansion: + 0 == 0 + +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_NOTHROW( original.data() ) + +------------------------------------------------------------------------------- +StringRef + Copy construction is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) +with expansion: + "original string" == "original string" + +------------------------------------------------------------------------------- +StringRef + Copy assignment is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) +with expansion: + "original string" == "original string" + +------------------------------------------------------------------------------- +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.data(), "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.data(), "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.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() + +------------------------------------------------------------------------------- +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: + sr2.empty() + +String.tests.cpp:<line number>: PASSED: +with message: + sr2.size() == 0 + +------------------------------------------------------------------------------- +Stringifying char arrays with statically known sizes - char +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +------------------------------------------------------------------------------- +Stringifying char arrays with statically known sizes - signed char +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +------------------------------------------------------------------------------- +Stringifying char arrays with statically known sizes - unsigned char +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" + +------------------------------------------------------------------------------- +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, ContainsSubstring( "[@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, ContainsSubstring( "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, ContainsSubstring( "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, ContainsSubstring( "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 ) ) ) + +------------------------------------------------------------------------------- +Tags with spaces and non-alphanumerical characters are accepted +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 2 ) +with expansion: + 2 == 2 + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) +with expansion: + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + +------------------------------------------------------------------------------- +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 identical tags keeps just one +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 1 ) +with expansion: + 1 == 1 + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) +with expansion: + {?} == {?} + +------------------------------------------------------------------------------- +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: + +------------------------------------------------------------------------------- +Testing checked-if +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECKED_IF( true ) + +Misc.tests.cpp:<line number>: PASSED: + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_IF( false ) + +Misc.tests.cpp:<line number>: PASSED: + CHECKED_ELSE( true ) + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +Testing checked-if 2 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECKED_IF( true ) + +Misc.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +Testing checked-if 3 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) + +Misc.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +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, ContainsSubstring("[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, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) +with expansion: + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) + +------------------------------------------------------------------------------- +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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + One false evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { false, false, false, false, false } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + One false evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) +with expansion: + { false, false, false, false, false } not contains only true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AllTrue() ) +with expansion: + { true, true, true, true, true } contains only true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[1] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[2] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Basic usage + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) +with expansion: + { true, true, true, true, true } contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Basic usage + Empty evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyTrue() ) +with expansion: + { } not contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Basic usage + One true evalutes to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) +with expansion: + { false, false, true, false, false } contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Basic usage + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyTrue() ) +with expansion: + { false, false, false, false, false } not contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Contained type is convertible to bool + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) +with expansion: + { true, true, true, true, true } contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Contained type is convertible to bool + One true evalutes to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyTrue() ) +with expansion: + { false, false, true, false, false } contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Contained type is convertible to bool + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyTrue() ) +with expansion: + { false, false, false, false, false } not contains at least one true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AnyTrue() ) +with expansion: + { false, false, false, false, true } contains at least one true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of AnyTrue range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AnyTrue() ) +with expansion: + { false, false, true, true, true } contains at least one true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_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.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[1] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[2] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Basic usage + All true evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { true, true, true, true, true } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneTrue() ) +with expansion: + { } contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Basic usage + One true evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { false, false, true, false, false } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Basic usage + All false evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneTrue() ) +with expansion: + { false, false, false, false, false } contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + All true evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { true, true, true, true, true } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + One true evalutes to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneTrue() ) +with expansion: + { false, false, true, false, false } not contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Contained type is convertible to bool + All false evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneTrue() ) +with expansion: + { false, false, false, false, false } contains no true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, NoneTrue() ) +with expansion: + { false, false, false, false, false } contains no true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of NoneTrue range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !NoneTrue() ) +with expansion: + { false, false, true, true, true } not contains no true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_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' + +------------------------------------------------------------------------------- +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]" + +------------------------------------------------------------------------------- +XmlWriter writes boolean attributes as true/false +------------------------------------------------------------------------------- +Xml.tests.cpp:<line number> +............................................................................... + +Xml.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + <Element1 attr1="true" attr2="false"/> + " ( contains: "attr1="true"" and contains: "attr2="false"" ) + +------------------------------------------------------------------------------- +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 }" + +------------------------------------------------------------------------------- +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 - but was ok: + 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 - but was ok: + 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 + +------------------------------------------------------------------------------- +convertToBits +------------------------------------------------------------------------------- +FloatingPoint.tests.cpp:<line number> +............................................................................... + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( 0.f ) == 0 ) +with expansion: + 0 == 0 + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( -0.f ) == ( 1ULL << 31 ) ) +with expansion: + 2147483648 (0x<hex digits>) + == + 2147483648 (0x<hex digits>) + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( 0. ) == 0 ) +with expansion: + 0 == 0 + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( -0. ) == ( 1ULL << 63 ) ) +with expansion: + 9223372036854775808 (0x<hex digits>) + == + 9223372036854775808 (0x<hex digits>) + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 ) +with expansion: + 1 == 1 + +FloatingPoint.tests.cpp:<line number>: PASSED: + CHECK( convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +empty tags are not allowed +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) ) + +------------------------------------------------------------------------------- +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' + +------------------------------------------------------------------------------- +has printf +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + + +No assertions in test case 'has printf' + +------------------------------------------------------------------------------- +is_unary_function +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<int>::value) + +Clara.tests.cpp:<line number>: PASSED: +with message: + !(Catch::Clara::Detail::is_unary_function<std::string const&>::value) + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +makeStream recognizes %debug stream name +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( Catch::makeStream( "%debug" ) ) + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +request an unknown %-starting stream fails +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ) + +------------------------------------------------------------------------------- +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( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) ) +with expansion: + { {?}, {?} } ( Contains: {?} 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 + +------------------------------------------------------------------------------- +startsWith +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_FALSE( startsWith("", 'c') ) +with expansion: + !false + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( startsWith(std::string("abc"), 'a') ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( startsWith("def"_catch_sr, 'd') ) +with expansion: + true + +------------------------------------------------------------------------------- +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 } }" + +------------------------------------------------------------------------------- +stdout and stderr streams have %-starting name +------------------------------------------------------------------------------- +Stream.tests.cpp:<line number> +............................................................................... + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "%stderr" )->isConsole() ) +with expansion: + true + +Stream.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::makeStream( "%stdout" )->isConsole() ) +with expansion: + true + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +tags with dots in later positions are not parsed as hidden +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testcase.tags.size() == 1 ) +with expansion: + 1 == 1 + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testcase.tags[0].original == "magic.tag"_catch_sr ) +with expansion: + magic.tag == magic.tag + +------------------------------------------------------------------------------- +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<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: 394 | 304 passed | 83 failed | 7 failed as expected +assertions: 2299 | 2129 passed | 143 failed | 27 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 index df003bd3fc778c80d54b9fb07f58916df32a027e..ede2d59ccf17f8d576d2f42646d84a7dfa044e29 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -1,11 +1,10 @@ Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -<exe-name> is a <version> host application. +<exe-name> is a Catch2 v<version> host application. Run with -? for options -Randomness seeded to: 1 - ------------------------------------------------------------------------------- # A test name that starts with a # ------------------------------------------------------------------------------- @@ -16,23 +15,6 @@ 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 ------------------------------------------------------------------------------- @@ -863,7 +845,7 @@ with expansion: true ------------------------------------------------------------------------------- -#835 -- errno should not be touched by Catch +#835 -- errno should not be touched by Catch2 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -874,7 +856,7 @@ with expansion: 1 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( errno == 1 ) + REQUIRE( errno_after == 1 ) with expansion: 1 == 1 @@ -959,6 +941,6 @@ Condition.tests.cpp:<line number>: FAILED: CHECK( true != true ) =============================================================================== -test cases: 33 | 28 passed | 3 failed | 2 failed as expected -assertions: 103 | 96 passed | 4 failed | 3 failed as expected +test cases: 32 | 27 passed | 3 failed | 2 failed as expected +assertions: 101 | 94 passed | 4 failed | 3 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..12717aa5f9f952bf9128bbb1dcc76d27196adbbf --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt @@ -0,0 +1,8 @@ +This would not be caught previously +Nor would this +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 +loose text artifact diff --git a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt index 88e96b0fcf64e556af68cca1df002ade68794c7b..f7411501da435924af1beab2f932c8a6be983a1a 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="129" tests="2120" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="126" tests="2299" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> - <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> <property name="random-seed" value="1"/> + <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> </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"/> @@ -50,6 +49,7 @@ Nor would this <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - double" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - float" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> <error type="TEST_CASE"> FAILED: expected exception @@ -58,6 +58,7 @@ 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"> + <skipped message="TEST_CASE tagged with !mayfail"/> <error message="thisThrows()" type="REQUIRE_NOTHROW"> FAILED: REQUIRE_NOTHROW( thisThrows() ) @@ -69,7 +70,8 @@ Exception.tests.cpp:<line number> <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"> + <testcase classname="<exe-name>.global" name="#835 -- errno should not be touched by Catch2" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> <failure message="f() == 0" type="CHECK"> FAILED: CHECK( f() == 0 ) @@ -375,10 +377,19 @@ Exception.tests.cpp:<line number> <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="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Degenerate cases" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Plain comparisons" 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="Clara::Opt supports accept-many lambdas/Parsing fails on multiple options without accept_many" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Clara::Opt supports accept-many lambdas/Parsing succeeds on multiple options with accept_many" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard is disengaged by default" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard is engaged by op<<" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard can be engaged explicitly" 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"/> @@ -398,17 +409,17 @@ Exception.tests.cpp:<line number> <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"> + <failure message="testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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"> + <failure message="testStringForMatching(), ContainsSubstring( "STRING" )" type="CHECK_THAT"> FAILED: - CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" Matchers.tests.cpp:<line number> @@ -417,6 +428,7 @@ Matchers.tests.cpp:<line number> <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="Cout stream properly declares it writes to stdout" 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: @@ -442,6 +454,8 @@ Exception.tests.cpp:<line number> </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="Empty stream name opens cout stream" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Empty tag is not allowed" 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: @@ -463,6 +477,7 @@ Matchers.tests.cpp:<line number> <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"> + <skipped message="TEST_CASE tagged with !mayfail"/> <failure message="data.int_seven == 6" type="CHECK"> FAILED: CHECK( data.int_seven == 6 ) @@ -692,7 +707,9 @@ Message.tests.cpp:<line number> <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/Filter generator/Simple filtering" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Filter generator/Filter out multiple elements at the start and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Filter generator/Throws on construction if it can't get initial element" 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"/> @@ -711,6 +728,12 @@ Message.tests.cpp:<line number> <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="Hashers with different seed produce different hash with same test case" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashers with same seed produce same hash" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different test name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different classname" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing test case produces same hash across multiple calls" 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"> @@ -756,6 +779,7 @@ Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should fail" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> <failure message="data.int_seven != 7" type="CHECK"> FAILED: CHECK( data.int_seven != 7 ) @@ -800,9 +824,9 @@ Condition.tests.cpp:<line number> <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"> + <failure message="testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" )" type="CHECK_THAT"> FAILED: - CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -811,14 +835,42 @@ Matchers.tests.cpp:<line number> </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"> + <failure message="testStringForMatching(), !ContainsSubstring( "substring" )" type="CHECK_THAT"> FAILED: - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "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="Mayfail test case with nested sections/1/A" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/A" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/B" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/B" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.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: @@ -828,6 +880,10 @@ with expansion: Exception.tests.cpp:<line number> </failure> </testcase> + <testcase classname="<exe-name>.global" name="Multireporter calls reporters and listeners in correct order" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly/Adding listeners" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly/Adding reporters" time="{duration}" status="run"/> <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"> @@ -1027,6 +1083,17 @@ Message.tests.cpp:<line number> <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="Parsed tags are matched case insensitive" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-count" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard count reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Zero shard count reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-index" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard index reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Shard index 0 is accepted" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing tags with non-alphabetical characters is pass-through" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoAssertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoTests is no longer supported" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/Combining multiple warnings" 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"/> @@ -1039,8 +1106,12 @@ Message.tests.cpp:<line number> <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/reporter/With output file" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/With Windows-like absolute path as output file" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/All with output files" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/Mixed output files and default output" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/cannot have multiple reporters with default output" 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"/> @@ -1066,6 +1137,8 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double, float>" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double>" 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="Random seed generation accepts known methods" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Random seed generation reports unknown methods" 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"> @@ -1102,32 +1175,34 @@ with expansion: Matchers.tests.cpp:<line number> </failure> </testcase> + <testcase classname="<exe-name>.global" name="Registering reporter with '::' in name fails" time="{duration}" status="run"/> <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/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="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="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" 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"/> @@ -1179,6 +1254,8 @@ Matchers.tests.cpp:<line number> <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/Copy construction is shallow" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Copy assignment is shallow" 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"/> @@ -1220,6 +1297,7 @@ Misc.tests.cpp:<line number> </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>.global" name="Tags with spaces and non-alphanumerical characters are accepted" 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"/> @@ -1278,17 +1356,20 @@ Misc.tests.cpp:<line number> <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 identical tags keeps just one" 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="Testing checked-if" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Testing checked-if 2" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Testing checked-if 3" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: Misc.tests.cpp:<line number> @@ -1298,6 +1379,7 @@ Misc.tests.cpp:<line number> <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="The default listing implementation write to provided stream/Listing listeners" 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"> @@ -1330,14 +1412,41 @@ Exception.tests.cpp:<line number> <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 AllTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue 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 AnyTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue 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 NoneTrue range matcher/Basic usage/All true evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue 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"/> @@ -1501,8 +1610,6 @@ 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"/> @@ -1518,7 +1625,6 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="XmlWriter writes boolean attributes as true/false" 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"/> @@ -1557,6 +1663,7 @@ Misc.tests.cpp:<line number> <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="is_unary_function" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="just failure" time="{duration}" status="run"> <failure type="FAIL"> FAILED: @@ -1648,6 +1755,7 @@ Testing if fib[7] (21) is even Misc.tests.cpp:<line number> </failure> </testcase> + <testcase classname="<exe-name>.global" name="makeStream recognizes %debug stream name" time="{duration}" status="run"/> <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"/> @@ -1714,6 +1822,7 @@ Message.tests.cpp:<line number> <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="request an unknown %-starting stream fails" 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"/> @@ -1756,6 +1865,7 @@ Count 4 to 6... Message.tests.cpp:<line number> </failure> </testcase> + <testcase classname="<exe-name>.global" name="startsWith" time="{duration}" status="run"/> <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"/> @@ -1765,15 +1875,7 @@ Message.tests.cpp:<line number> <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="stdout and stderr streams have %-starting name" time="{duration}" status="run"/> <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"/> @@ -1804,7 +1906,6 @@ Exception.tests.cpp:<line number> <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"/> diff --git a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa0860a3c9ac8cae0b873305b50103cf93a29d71 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -0,0 +1,1946 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuites> + <testsuite name="<exe-name>" errors="17" failures="126" tests="2299" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <properties> + <property name="random-seed" value="1"/> + <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> + </properties> + <testcase classname="<exe-name>.global" name="# A test name that starts with a #" 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="#2152 - ULP checks between differently signed values were wrong - double" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <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"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <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 Catch2" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <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="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Degenerate cases" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Plain comparisons" 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="Clara::Opt supports accept-many lambdas/Parsing fails on multiple options without accept_many" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Clara::Opt supports accept-many lambdas/Parsing succeeds on multiple options with accept_many" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard is disengaged by default" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard is engaged by op<<" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ColourGuard behaviour/ColourGuard can be engaged explicitly" 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(), ContainsSubstring( "not there", Catch::CaseSensitive::No )" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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(), ContainsSubstring( "STRING" )" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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="Cout stream properly declares it writes to stdout" 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="Empty stream name opens cout stream" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Empty tag is not allowed" 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"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <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/Simple filtering" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Filter generator/Filter out multiple elements at the start and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Filter generator/Throws on construction if it can't get initial element" 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="Hashers with different seed produce different hash with same test case" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashers with same seed produce same hash" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different test name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different classname" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Hashing test case produces same hash across multiple calls" 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"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" )" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "substring" )" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "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="Mayfail test case with nested sections/1/A" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/A" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/B" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/B" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Condition.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="Multireporter calls reporters and listeners in correct order" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly/Adding listeners" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Multireporter updates ReporterPreferences properly/Adding reporters" time="{duration}" status="run"/> + <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="Parsed tags are matched case insensitive" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-count" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard count reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Zero shard count reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-index" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard index reports error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Shard index 0 is accepted" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing tags with non-alphabetical characters is pass-through" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoAssertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoTests is no longer supported" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/Combining multiple warnings" 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/must match one of the available ones" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/With output file" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/With Windows-like absolute path as output file" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/All with output files" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/Mixed output files and default output" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Multiple reporters/cannot have multiple reporters with default output" 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="Random seed generation accepts known methods" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Random seed generation reports unknown methods" 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="Registering reporter with '::' in name fails" time="{duration}" status="run"/> + <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="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" 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/Copy construction is shallow" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Copy assignment is shallow" 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 char arrays with statically known sizes - char" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Stringifying char arrays with statically known sizes - signed char" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Stringifying char arrays with statically known sizes - unsigned char" 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>.global" name="Tags with spaces and non-alphanumerical characters are accepted" 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 identical tags keeps just one" 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="Testing checked-if" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Testing checked-if 2" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Testing checked-if 3" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +Misc.tests.cpp:<line number> + </failure> + </testcase> + <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="The default listing implementation write to provided stream/Listing listeners" 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 AllTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue 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 AnyTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue 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 NoneTrue range matcher/Basic usage/All true evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue 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="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="XmlWriter writes boolean attributes as true/false" 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="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="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="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="convertToBits" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="empty tags are not allowed" 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="is_unary_function" 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="makeStream recognizes %debug stream name" time="{duration}" status="run"/> + <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="request an unknown %-starting stream fails" 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="startsWith" time="{duration}" status="run"/> + <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="stdout and stderr streams have %-starting name" time="{duration}" status="run"/> + <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="tags with dots in later positions are not parsed as hidden" 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<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 index 924a14b19c3ec7e2a7f70e94c6f47483e0a3ae6f..a9319a62800b1b8db2548b700c25d6ff75422164 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- rng-seed=1 --> <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}"/> + <testCase name="Clara::Opt supports accept-many lambdas/Parsing fails on multiple options without accept_many" duration="{duration}"/> + <testCase name="Clara::Opt supports accept-many lambdas/Parsing succeeds on multiple options with accept_many" duration="{duration}"/> + <testCase name="is_unary_function" 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}"/> @@ -43,6 +47,15 @@ <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="Parsing sharding-related cli flags/shard-count" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Negative shard count reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Zero shard count reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/shard-index" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Negative shard index reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Shard index 0 is accepted" duration="{duration}"/> + <testCase name="Parsing warnings/NoAssertions" duration="{duration}"/> + <testCase name="Parsing warnings/NoTests is no longer supported" duration="{duration}"/> + <testCase name="Parsing warnings/Combining multiple warnings" 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}"/> @@ -51,8 +64,12 @@ <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/reporter/With output file" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/With Windows-like absolute path as output file" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/All with output files" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/Mixed output files and default output" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/cannot have multiple reporters with default output" 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}"/> @@ -77,6 +94,17 @@ <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/ColourImpl.tests.cpp"> + <testCase name="ColourGuard behaviour/ColourGuard is disengaged by default" duration="{duration}"/> + <testCase name="ColourGuard behaviour/ColourGuard is engaged by op<<" duration="{duration}"/> + <testCase name="ColourGuard behaviour/ColourGuard can be engaged explicitly" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp"> + <testCase name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" duration="{duration}"/> + <testCase name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" duration="{duration}"/> + <testCase name="CaseInsensitiveLess is case insensitive/Degenerate cases" duration="{duration}"/> + <testCase name="CaseInsensitiveLess is case insensitive/Plain comparisons" duration="{duration}"/> + </file> <file path="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp"> <testCase name="convertToBits" duration="{duration}"/> </file> @@ -85,7 +113,9 @@ <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/Filter generator/Simple filtering" duration="{duration}"/> + <testCase name="Generators internals/Filter generator/Filter out multiple elements at the start and end" duration="{duration}"/> + <testCase name="Generators internals/Filter generator/Throws on construction if it can't get initial element" 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}"/> @@ -152,41 +182,59 @@ <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}"/> + <testCase name="Random seed generation accepts known methods" duration="{duration}"/> + <testCase name="Random seed generation reports unknown methods" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp"> + <testCase name="Multireporter calls reporters and listeners in correct order" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly/Adding listeners" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly/Adding reporters" duration="{duration}"/> + <testCase name="Registering reporter with '::' in name fails" duration="{duration}"/> <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/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="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="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" 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}"/> + <testCase name="The default listing implementation write to provided stream/Listing listeners" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp"> + <testCase name="Cout stream properly declares it writes to stdout" duration="{duration}"/> + <testCase name="Empty stream name opens cout stream" duration="{duration}"/> + <testCase name="makeStream recognizes %debug stream name" duration="{duration}"/> + <testCase name="request an unknown %-starting stream fails" duration="{duration}"/> + <testCase name="stdout and stderr streams have %-starting name" 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/Copy construction is shallow" duration="{duration}"/> + <testCase name="StringRef/Copy assignment is shallow" 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}"/> @@ -215,14 +263,30 @@ <testCase name="replaceInPlace/replace no chars" duration="{duration}"/> <testCase name="replaceInPlace/escape '" duration="{duration}"/> <testCase name="splitString" duration="{duration}"/> + <testCase name="startsWith" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> + <testCase name="Empty tag is not allowed" duration="{duration}"/> <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="Tags with spaces and non-alphanumerical characters are accepted" duration="{duration}"/> + <testCase name="Test case with identical tags keeps just one" duration="{duration}"/> <testCase name="empty tags are not allowed" duration="{duration}"/> <testCase name="shortened hide tags are split apart" duration="{duration}"/> <testCase name="tags with dots in later positions are not parsed as hidden" duration="{duration}"/> </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp"> + <testCase name="Hashers with different seed produce different hash with same test case" duration="{duration}"/> + <testCase name="Hashers with same seed produce same hash" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different test name" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different classname" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different tags" duration="{duration}"/> + <testCase name="Hashing test case produces same hash across multiple calls" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp"> + <testCase name="Parsed tags are matched case insensitive" duration="{duration}"/> + <testCase name="Parsing tags with non-alphabetical characters is pass-through" 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}"/> @@ -657,6 +721,30 @@ Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Inequality checks that should succeed" duration="{duration}"/> + <testCase name="Mayfail test case with nested sections/1/A" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/2/A" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/1/B" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/2/B" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> <testCase name="Ordering comparison checks that should fail" duration="{duration}"> <failure message="CHECK(data.int_seven > 7)"> FAILED: @@ -798,7 +886,6 @@ Condition.tests.cpp:<line number> <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: @@ -1007,16 +1094,16 @@ Exception.tests.cpp:<line number> <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 ))"> + <failure message="CHECK_THAT(testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ))"> FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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" ))"> + <failure message="CHECK_THAT(testStringForMatching(), ContainsSubstring( "STRING" ))"> FAILED: - CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" Matchers.tests.cpp:<line number> @@ -1115,9 +1202,9 @@ Matchers.tests.cpp:<line number> <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" ))"> + <failure message="CHECK_THAT(testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ))"> FAILED: - CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ) + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) Matchers.tests.cpp:<line number> @@ -1125,9 +1212,9 @@ Matchers.tests.cpp:<line number> </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" ))"> + <failure message="CHECK_THAT(testStringForMatching(), !ContainsSubstring( "substring" ))"> FAILED: - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ) + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" Matchers.tests.cpp:<line number> @@ -1310,14 +1397,41 @@ Matchers.tests.cpp:<line number> <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 AllTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AllTrue 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 AnyTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AnyTrue 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 NoneTrue range matcher/Basic usage/All true evaluates to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of NoneTrue 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}"/> @@ -1486,7 +1600,7 @@ Message.tests.cpp:<line number> <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}"> + <testCase name="#835 -- errno should not be touched by Catch2" duration="{duration}"> <skipped message="CHECK(f() == 0)"> FAILED: CHECK( f() == 0 ) @@ -1608,7 +1722,6 @@ Misc.tests.cpp:<line number> </skipped> </testCase> <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="REQUIRE(testCheckedElse( false ))"> @@ -1781,7 +1894,6 @@ Misc.tests.cpp:<line number> <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> @@ -1842,8 +1954,6 @@ Tricky.tests.cpp:<line number> <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}"/> @@ -1853,15 +1963,6 @@ Tricky.tests.cpp:<line number> <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}"/> diff --git a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..97b2d988175f0bf3ff007e9364015e972e9dbb52 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -0,0 +1,1971 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- rng-seed=1 --> +<testExecutions version="1"> + <file path="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp"> + <testCase name="Clara::Arg supports single-arg parse the way Opt does" duration="{duration}"/> + <testCase name="Clara::Opt supports accept-many lambdas/Parsing fails on multiple options without accept_many" duration="{duration}"/> + <testCase name="Clara::Opt supports accept-many lambdas/Parsing succeeds on multiple options with accept_many" duration="{duration}"/> + <testCase name="is_unary_function" 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="Parsing sharding-related cli flags/shard-count" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Negative shard count reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Zero shard count reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/shard-index" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Negative shard index reports error" duration="{duration}"/> + <testCase name="Parsing sharding-related cli flags/Shard index 0 is accepted" duration="{duration}"/> + <testCase name="Parsing warnings/NoAssertions" duration="{duration}"/> + <testCase name="Parsing warnings/NoTests is no longer supported" duration="{duration}"/> + <testCase name="Parsing warnings/Combining multiple warnings" 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/must match one of the available ones" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/With output file" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/With Windows-like absolute path as output file" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/All with output files" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/Mixed output files and default output" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Multiple reporters/cannot have multiple reporters with default output" 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/ColourImpl.tests.cpp"> + <testCase name="ColourGuard behaviour/ColourGuard is disengaged by default" duration="{duration}"/> + <testCase name="ColourGuard behaviour/ColourGuard is engaged by op<<" duration="{duration}"/> + <testCase name="ColourGuard behaviour/ColourGuard can be engaged explicitly" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp"> + <testCase name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" duration="{duration}"/> + <testCase name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" duration="{duration}"/> + <testCase name="CaseInsensitiveLess is case insensitive/Degenerate cases" duration="{duration}"/> + <testCase name="CaseInsensitiveLess is case insensitive/Plain comparisons" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp"> + <testCase name="convertToBits" 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/Simple filtering" duration="{duration}"/> + <testCase name="Generators internals/Filter generator/Filter out multiple elements at the start and end" duration="{duration}"/> + <testCase name="Generators internals/Filter generator/Throws on construction if it can't get initial element" 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}"/> + <testCase name="Random seed generation accepts known methods" duration="{duration}"/> + <testCase name="Random seed generation reports unknown methods" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp"> + <testCase name="Multireporter calls reporters and listeners in correct order" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly/Adding listeners" duration="{duration}"/> + <testCase name="Multireporter updates ReporterPreferences properly/Adding reporters" duration="{duration}"/> + <testCase name="Registering reporter with '::' in name fails" duration="{duration}"/> + <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="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" 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}"/> + <testCase name="The default listing implementation write to provided stream/Listing listeners" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp"> + <testCase name="Cout stream properly declares it writes to stdout" duration="{duration}"/> + <testCase name="Empty stream name opens cout stream" duration="{duration}"/> + <testCase name="makeStream recognizes %debug stream name" duration="{duration}"/> + <testCase name="request an unknown %-starting stream fails" duration="{duration}"/> + <testCase name="stdout and stderr streams have %-starting name" 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/Copy construction is shallow" duration="{duration}"/> + <testCase name="StringRef/Copy assignment is shallow" 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}"/> + <testCase name="startsWith" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> + <testCase name="Empty tag is not allowed" duration="{duration}"/> + <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="Tags with spaces and non-alphanumerical characters are accepted" duration="{duration}"/> + <testCase name="Test case with identical tags keeps just one" duration="{duration}"/> + <testCase name="empty tags are not allowed" duration="{duration}"/> + <testCase name="shortened hide tags are split apart" duration="{duration}"/> + <testCase name="tags with dots in later positions are not parsed as hidden" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp"> + <testCase name="Hashers with different seed produce different hash with same test case" duration="{duration}"/> + <testCase name="Hashers with same seed produce same hash" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different test name" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different classname" duration="{duration}"/> + <testCase name="Hashing different test cases produces different result/Different tags" duration="{duration}"/> + <testCase name="Hashing test case produces same hash across multiple calls" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp"> + <testCase name="Parsed tags are matched case insensitive" duration="{duration}"/> + <testCase name="Parsing tags with non-alphabetical characters is pass-through" 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="Stringifying char arrays with statically known sizes - char" duration="{duration}"/> + <testCase name="Stringifying char arrays with statically known sizes - signed char" duration="{duration}"/> + <testCase name="Stringifying char arrays with statically known sizes - unsigned char" 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}"/> + <testCase name="XmlWriter writes boolean attributes as true/false" 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="Mayfail test case with nested sections/1/A" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/2/A" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/1/B" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Mayfail test case with nested sections/2/B" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <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="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="#2152 - ULP checks between differently signed values were wrong - double" duration="{duration}"/> + <testCase name="#2152 - ULP checks between differently signed values were wrong - float" duration="{duration}"/> + <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(), ContainsSubstring( "not there", Catch::CaseSensitive::No ))"> +FAILED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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(), ContainsSubstring( "STRING" ))"> +FAILED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ))"> +FAILED: + CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "substring" ))"> +FAILED: + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "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 AllTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AllTrue 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 AnyTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AnyTrue 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 NoneTrue range matcher/Basic usage/All true evaluates to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of NoneTrue 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 Catch2" 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="Testing checked-if" duration="{duration}"/> + <testCase name="Testing checked-if 2" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Misc.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Testing checked-if 3" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +Misc.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="This test 'should' fail but doesn't" duration="{duration}"/> + <testCase name="checkedElse" duration="{duration}"/> + <testCase name="checkedElse, failing" duration="{duration}"> + <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="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<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="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}"/> + </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 index 724cd499b98562199eb6310762be5a583eaf25a5..2c7adae54de162c2d455a82333d4cc393fb727d8 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1,9 +1,6 @@ +# rng-seed: 1 # # 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 @@ -188,10 +185,10 @@ ok {test-number} - throws_int(false) 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 +# #835 -- errno should not be touched by Catch2 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 +# #835 -- errno should not be touched by Catch2 +ok {test-number} - errno_after == 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 @@ -666,6 +663,36 @@ ok {test-number} - with 11 messages: '("comma, in string", "escaped, \", ") := " ok {test-number} - true with 1 message: 'i := 2' # Capture and info messages ok {test-number} - true with 1 message: '3' +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "", "" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "", "a" )) for: !false +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "a", "a" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "a", "A" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "A", "a" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "A", "A" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "a", "b" )) for: !false +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "a", "B" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "", "a" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - !(lt( "a", "a" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - !(lt( "", "" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "a", "b" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "a", "B" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "A", "b" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "A", "B" ) for: true # Character pretty printing ok {test-number} - tab == '\t' for: '\t' == '\t' # Character pretty printing @@ -698,60 +725,72 @@ ok {test-number} - c == i for: 5 == 5 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" +# Clara::Opt supports accept-many lambdas +ok {test-number} - !(parse_result) for: !{?} +# Clara::Opt supports accept-many lambdas +ok {test-number} - parse_result for: {?} +# Clara::Opt supports accept-many lambdas +ok {test-number} - res == std::vector<std::string>{ "aaa", "bbb" } for: { "aaa", "bbb" } == { "aaa", "bbb" } +# ColourGuard behaviour +ok {test-number} - streamWrapper.str().empty() for: true +# ColourGuard behaviour +ok {test-number} - streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" for: "1 Using code: 2 2 Using code: 0 3 " == "1 Using code: 2 2 Using code: 0 3 " +# ColourGuard behaviour +ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 A B Using code: 0 C " == "Using code: 2 A B Using code: 0 C " # 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 ) +ok {test-number} - 1, ( MatcherA() && MatcherB() ) && MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, MatcherA() && ( MatcherB() && MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, ( MatcherA() && MatcherB() ) && ( MatcherC() && MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, ( MatcherA() || MatcherB() ) || MatcherC() for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, MatcherA() || ( MatcherB() || MatcherC() ) for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, ( MatcherA() || MatcherB() ) || ( MatcherC() || MatcherD() ) for: 1 ( equals: (int) 1 or (string) "1" 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 +ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (string) "1" # 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 +ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (string) "1" # 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 +ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (string) "1" # 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 +ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (string) "1" # 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 ) +ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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 ) +ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (string) "1" 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 @@ -893,9 +932,9 @@ 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) +not ok {test-number} - testStringForMatching(), ContainsSubstring( "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" +not ok {test-number} - testStringForMatching(), ContainsSubstring( "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 @@ -924,6 +963,8 @@ ok {test-number} - elem % 2 == 1 for: 1 == 1 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 +# Cout stream properly declares it writes to stdout +ok {test-number} - Catch::makeStream( "-" )->isConsole() for: true # 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 @@ -940,6 +981,10 @@ ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1" 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 **}" +# Empty stream name opens cout stream +ok {test-number} - Catch::makeStream( "" )->isConsole() for: true +# Empty tag is not allowed +ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) # EndsWith string matcher not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" # EndsWith string matcher @@ -1039,9 +1084,9 @@ ok {test-number} - thisThrows(), StartsWith( "expected" ) for: "expected excepti # 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" +ok {test-number} - thisThrows(), ContainsSubstring( "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) +ok {test-number} - thisThrows(), ContainsSubstring( "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 @@ -1367,7 +1412,17 @@ 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 +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} - filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException # Generators internals ok {test-number} - gen.get() == 1 for: 1 == 1 # Generators internals @@ -1712,6 +1767,18 @@ ok {test-number} - d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) 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 ) +# Hashers with different seed produce different hash with same test case +ok {test-number} - h1( dummy ) != h2( dummy ) for: 3422778688 (0x<hex digits>) != 130711275 (0x<hex digits>) +# Hashers with same seed produce same hash +ok {test-number} - h1( dummy ) == h2( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x<hex digits>) != 2668622104 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) != 3916075712 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) != 3429949824 (0x<hex digits>) +# Hashing test case produces same hash across multiple calls +ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>) # 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 @@ -1791,23 +1858,65 @@ 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" ) +ok {test-number} - testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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" ) +ok {test-number} - testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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" ) +ok {test-number} - testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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" ) +ok {test-number} - testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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" ) +not ok {test-number} - testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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" +ok {test-number} - testStringForMatching(), !ContainsSubstring( "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" +not ok {test-number} - testStringForMatching(), !ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly # 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" +# Multireporter calls reporters and listeners in correct order +ok {test-number} - records == expected for: { "Hello", "world", "Goodbye", "world" } == { "Hello", "world", "Goodbye", "world" } +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true # Nested generators and captured variables ok {test-number} - values > -6 for: 3 > -6 # Nested generators and captured variables @@ -1854,6 +1963,10 @@ ok {test-number} - !(False) for: !{?} 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)' +# 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 @@ -2270,6 +2383,58 @@ ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !fal 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 +# Parsed tags are matched case insensitive +ok {test-number} - spec.hasFilters() for: true +# Parsed tags are matched case insensitive +ok {test-number} - spec.getInvalidSpecs().empty() for: true +# Parsed tags are matched case insensitive +ok {test-number} - spec.matches( testCase ) for: true +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-count=8" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardCount == 8 for: 8 == 8 +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-index=2" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardIndex == 2 for: 2 == 2 +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-index=0" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardIndex == 0 for: 0 == 0 +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.matches( testCase ) for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.hasFilters() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.matches( testCase ) for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing warnings +ok {test-number} - cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == WarnAbout::NoAssertions for: 1 == 1 +# Parsing warnings +ok {test-number} - !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +# Parsing warnings +ok {test-number} - cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 # Pointers can be compared to null ok {test-number} - p == 0 for: 0 == 0 # Pointers can be compared to null @@ -2311,10 +2476,18 @@ 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" +ok {test-number} - config.reporterSpecifications.empty() for: true # Process can be configured on command line ok {test-number} - !(cfg.hasTestFilters()) for: !false # Process can be configured on command line +ok {test-number} - cfg.getReporterSpecs().size() == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } for: {?} == {?} +# Process can be configured on command line +ok {test-number} - cfg.getProcessedReporterSpecs().size() == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } for: {?} == {?} +# 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 @@ -2339,23 +2512,41 @@ ok {test-number} - cfg.testSpec().matches(*fakeTestCase("test1")) == false for: # 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: {?} +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' # Process can be configured on command line -ok {test-number} - config.reporterName == "console" for: "console" == "console" +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - !result for: true # Process can be configured on command line -ok {test-number} - cli.parse({"test", "-r", "xml"}) for: {?} +ok {test-number} - result.errorMessage(), ContainsSubstring("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" # Process can be configured on command line -ok {test-number} - config.reporterName == "xml" for: "xml" == "xml" +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' # Process can be configured on command line -ok {test-number} - cli.parse({"test", "--reporter", "junit"}) for: {?} +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' # Process can be configured on command line -ok {test-number} - config.reporterName == "junit" for: "junit" == "junit" +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' # Process can be configured on command line -ok {test-number} - !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?} +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } for: { {?}, {?} } == { {?}, {?} } +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } 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" +ok {test-number} - result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") for: "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." # Process can be configured on command line ok {test-number} - cli.parse({"test", "-b"}) for: {?} # Process can be configured on command line @@ -2375,7 +2566,7 @@ 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" ) +ok {test-number} - result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("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 @@ -2395,7 +2586,7 @@ 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" ) +ok {test-number} - result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("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 @@ -2407,11 +2598,11 @@ 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" +ok {test-number} - config.defaultOutputFilename == "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" +ok {test-number} - config.defaultOutputFilename == "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 @@ -2423,23 +2614,23 @@ 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 +ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 # Process can be configured on command line -ok {test-number} - cli.parse({"test", "--use-colour", "auto"}) for: {?} +ok {test-number} - cli.parse( { "test", "--colour-mode", "default" } ) for: {?} # Process can be configured on command line -ok {test-number} - config.useColour == UseColour::Auto for: 0 == 0 +ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 # Process can be configured on command line -ok {test-number} - cli.parse({"test", "--use-colour", "yes"}) for: {?} +ok {test-number} - cli.parse({"test", "--colour-mode", "ansi"}) for: {?} # Process can be configured on command line -ok {test-number} - config.useColour == UseColour::Yes for: 1 == 1 +ok {test-number} - config.defaultColourMode == ColourMode::ANSI for: 1 == 1 # Process can be configured on command line -ok {test-number} - cli.parse({"test", "--use-colour", "no"}) for: {?} +ok {test-number} - cli.parse({"test", "--colour-mode", "none"}) for: {?} # Process can be configured on command line -ok {test-number} - config.useColour == UseColour::No for: 2 == 2 +ok {test-number} - config.defaultColourMode == ColourMode::None 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( "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" +ok {test-number} - result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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 @@ -2466,6 +2657,14 @@ ok {test-number} - std::tuple_size<TestType>::value >= 1 for: 3 >= 1 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 +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation reports unknown methods +ok {test-number} - Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) # Range type with sentinel ok {test-number} - Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }" # Reconstruction should be based on stringification: #914 @@ -2476,104 +2675,108 @@ not ok {test-number} - testStringForMatching(), Matches( "this STRING contains ' 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 +# Registering reporter with '::' in name fails +ok {test-number} - registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" # 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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring("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' +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +# Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla +ok {test-number} - # SUCCEED counts as a test pass ok {test-number} - with 1 message: 'this is a success' # SUCCEED does not require an argument @@ -2636,13 +2839,13 @@ ok {test-number} - Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" for: "{ 3, 2, # 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" +ok {test-number} - testStringForMatching(), ContainsSubstring( "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) +ok {test-number} - testStringForMatching(), ContainsSubstring( "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" +ok {test-number} - testStringForMatching(), ContainsSubstring( "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) +ok {test-number} - testStringForMatching(), ContainsSubstring( "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 @@ -2670,6 +2873,10 @@ ok {test-number} - original == "original" # StringRef ok {test-number} - original.data() # StringRef +ok {test-number} - original.begin() == copy.begin() for: "original string" == "original string" +# StringRef +ok {test-number} - original.begin() == copy.begin() for: "original string" == "original string" +# StringRef ok {test-number} - ss.empty() == false for: false == false # StringRef ok {test-number} - ss.size() == 5 for: 5 == 5 @@ -2782,13 +2989,13 @@ 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]" +ok {test-number} - what, ContainsSubstring( "[@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" +ok {test-number} - what, ContainsSubstring( "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" +ok {test-number} - what, ContainsSubstring( "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" +ok {test-number} - what, ContainsSubstring( "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 @@ -2797,6 +3004,10 @@ ok {test-number} - registry.add( "[the @ is not at the start]", "", Catch::Sourc 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 ) ) +# Tags with spaces and non-alphanumerical characters are accepted +ok {test-number} - testCase.tags.size() == 2 for: 2 == 2 +# Tags with spaces and non-alphanumerical characters are accepted +ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) # 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 @@ -3089,6 +3300,10 @@ ok {test-number} - v.capacity() >= V for: 15 >= 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 identical tags keeps just one +ok {test-number} - testCase.tags.size() == 1 for: 1 == 1 +# Test case with identical tags keeps just one +ok {test-number} - testCase.tags[0] == Tag( "tag1" ) for: {?} == {?} # Test case with one argument ok {test-number} - with 1 message: 'no assertions' # Test enum bit values @@ -3118,11 +3333,13 @@ not ok {test-number} - explicitly # 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]" +ok {test-number} - listingString, ContainsSubstring("[fakeTag]"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "[fakeTag]" +# The default listing implementation write to provided stream +ok {test-number} - listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) for: "Available reporters: fake reporter: fake description " ( contains: "fake reporter" and contains: "fake description" ) # 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" +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) # 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" ) +ok {test-number} - listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) for: "Registered listeners: fakeListener: fake description " ( contains: "fakeListener" and contains: "fake description" ) # This test 'should' fail but doesn't ok {test-number} - with 1 message: 'oops!' # Thrown string literals are translated @@ -3292,27 +3509,65 @@ ok {test-number} - needs_adl, AllMatch( Predicate<int>( []( int elem ) { return # 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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[1] for: true +ok {test-number} - mocked.m_derefed[1] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[2] for: true +ok {test-number} - mocked.m_derefed[2] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[3] for: true +ok {test-number} - mocked.m_derefed[3] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[4] for: true +ok {test-number} - mocked.m_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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[1] for: true +ok {test-number} - mocked.m_derefed[1] for: true # Usage of AllMatch range matcher -ok {test-number} - mocked.derefed[2] for: true +ok {test-number} - mocked.m_derefed[2] for: true # Usage of AllMatch range matcher -ok {test-number} - !(mocked.derefed[3]) for: !false +ok {test-number} - !(mocked.m_derefed[3]) for: !false # Usage of AllMatch range matcher -ok {test-number} - !(mocked.derefed[4]) for: !false +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { false, false, false, false, false } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { false, false, false, false, false } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AllTrue range matcher +ok {test-number} - !(mocked.m_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 @@ -3322,27 +3577,65 @@ ok {test-number} - needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return # 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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of AnyMatch range matcher -ok {test-number} - mocked.derefed[1] for: true +ok {test-number} - mocked.m_derefed[1] for: true # Usage of AnyMatch range matcher -ok {test-number} - mocked.derefed[2] for: true +ok {test-number} - mocked.m_derefed[2] for: true # Usage of AnyMatch range matcher -ok {test-number} - mocked.derefed[3] for: true +ok {test-number} - mocked.m_derefed[3] for: true # Usage of AnyMatch range matcher -ok {test-number} - mocked.derefed[4] for: true +ok {test-number} - mocked.m_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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of AnyMatch range matcher -ok {test-number} - !(mocked.derefed[1]) for: !false +ok {test-number} - !(mocked.m_derefed[1]) for: !false # Usage of AnyMatch range matcher -ok {test-number} - !(mocked.derefed[2]) for: !false +ok {test-number} - !(mocked.m_derefed[2]) for: !false # Usage of AnyMatch range matcher -ok {test-number} - !(mocked.derefed[3]) for: !false +ok {test-number} - !(mocked.m_derefed[3]) for: !false # Usage of AnyMatch range matcher -ok {test-number} - !(mocked.derefed[4]) for: !false +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { true, true, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { false, false, true, false, false } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { true, true, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { false, false, true, false, false } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked, AnyTrue() for: { false, false, false, false, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked, AnyTrue() for: { false, false, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AnyTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AnyTrue range matcher +ok {test-number} - !(mocked.m_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 @@ -3352,27 +3645,65 @@ ok {test-number} - needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return # 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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of NoneMatch range matcher -ok {test-number} - mocked.derefed[1] for: true +ok {test-number} - mocked.m_derefed[1] for: true # Usage of NoneMatch range matcher -ok {test-number} - mocked.derefed[2] for: true +ok {test-number} - mocked.m_derefed[2] for: true # Usage of NoneMatch range matcher -ok {test-number} - mocked.derefed[3] for: true +ok {test-number} - mocked.m_derefed[3] for: true # Usage of NoneMatch range matcher -ok {test-number} - mocked.derefed[4] for: true +ok {test-number} - mocked.m_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 +ok {test-number} - mocked.m_derefed[0] for: true # Usage of NoneMatch range matcher -ok {test-number} - !(mocked.derefed[1]) for: !false +ok {test-number} - !(mocked.m_derefed[1]) for: !false # Usage of NoneMatch range matcher -ok {test-number} - !(mocked.derefed[2]) for: !false +ok {test-number} - !(mocked.m_derefed[2]) for: !false # Usage of NoneMatch range matcher -ok {test-number} - !(mocked.derefed[3]) for: !false +ok {test-number} - !(mocked.m_derefed[3]) for: !false # Usage of NoneMatch range matcher -ok {test-number} - !(mocked.derefed[4]) for: !false +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { true, true, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { false, false, true, false, false } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { true, true, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { false, false, true, false, false } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked, !NoneTrue() for: { false, false, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of NoneTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of NoneTrue range matcher +ok {test-number} - !(mocked.m_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 @@ -3519,10 +3850,6 @@ not ok {test-number} - unexpected exception with message: 'expected exception'; 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 @@ -3552,7 +3879,7 @@ ok {test-number} - encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" # XmlEncode ok {test-number} - encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" # XmlWriter writes boolean attributes as true/false -ok {test-number} - stream.str(), Contains(R"(attr1="true")") && Contains(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +ok {test-number} - stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) # analyse no analysis ok {test-number} - analysis.mean.point.count() == 23 for: 23.0 == 23 # analyse no analysis @@ -3585,8 +3912,6 @@ ok {test-number} - Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ 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 @@ -3744,6 +4069,30 @@ ok {test-number} - # even more nested SECTION tests ok {test-number} - loose text artifact +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<int>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<std::string const&>::value)' # just failure not ok {test-number} - explicitly with 1 message: 'Previous info should not be seen' # just failure after unscoped info @@ -3786,6 +4135,8 @@ ok {test-number} - ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if f 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' +# makeStream recognizes %debug stream name +ok {test-number} - Catch::makeStream( "%debug" ) # make_unique reimplementation ok {test-number} - !(lval.has_moved) for: !false # make_unique reimplementation @@ -3924,6 +4275,8 @@ ok {test-number} - letters == letters for: "abcdefcg" == "abcdefcg" ok {test-number} - Catch::replaceInPlace(s, "'", "|'") for: true # replaceInPlace ok {test-number} - s == "didn|'t" for: "didn|'t" == "didn|'t" +# request an unknown %-starting stream fails +ok {test-number} - Catch::makeStream( "%somestream" ) # resolution ok {test-number} - res.size() == count for: 10 == 10 # resolution @@ -3993,7 +4346,7 @@ 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: . ) +ok {test-number} - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) # splitString ok {test-number} - splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } # splitString @@ -4004,6 +4357,12 @@ ok {test-number} - splitStringRef("abc,def", ','), Equals(std::vector<StringRef> 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' +# startsWith +ok {test-number} - !(startsWith("", 'c')) for: !false +# startsWith +ok {test-number} - startsWith(std::string("abc"), 'a') for: true +# startsWith +ok {test-number} - startsWith("def"_catch_sr, 'd') for: true # std::map is convertible string ok {test-number} - Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }" # std::map is convertible string @@ -4022,8 +4381,10 @@ ok {test-number} - Catch::Detail::stringify( set ) == "{ \"one\" }" for: "{ "one 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" +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stderr" )->isConsole() for: true +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stdout" )->isConsole() for: true # stringify ranges ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" # stringify ranges @@ -4106,8 +4467,6 @@ ok {test-number} - "1.2f" == ::Catch::Detail::stringify(float(1.2)) for: "1.2f" 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> @@ -4242,5 +4601,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2120 +1..2299 diff --git a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..d13b493c904716a157a80e11c1fb2a89a91d7d5c --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -0,0 +1,4597 @@ +# rng-seed: 1 +# # A test name that starts with a # +ok {test-number} - with 1 message: 'yay' +# #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' +# #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} - +# #2152 - ULP checks between differently signed values were wrong - double +ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, 4.9406564584124654e-324]) +# #2152 - ULP checks between differently signed values were wrong - double +ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) +# #2152 - ULP checks between differently signed values were wrong - float +ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) +# #2152 - ULP checks between differently signed values were wrong - float +ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +# #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 Catch2 +not ok {test-number} - f() == 0 for: 1 == 0 +# #835 -- errno should not be touched by Catch2 +ok {test-number} - errno_after == 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' +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "", "" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "", "a" )) for: !false +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "a", "a" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "a", "A" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "A", "a" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - eq( "A", "A" ) for: true +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "a", "b" )) for: !false +# CaseInsensitiveEqualsTo is case insensitive +ok {test-number} - !(eq( "a", "B" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "", "a" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - !(lt( "a", "a" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - !(lt( "", "" )) for: !false +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "a", "b" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "a", "B" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "A", "b" ) for: true +# CaseInsensitiveLess is case insensitive +ok {test-number} - lt( "A", "B" ) for: true +# 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" +# Clara::Opt supports accept-many lambdas +ok {test-number} - !(parse_result) for: !{?} +# Clara::Opt supports accept-many lambdas +ok {test-number} - parse_result for: {?} +# Clara::Opt supports accept-many lambdas +ok {test-number} - res == std::vector<std::string>{ "aaa", "bbb" } for: { "aaa", "bbb" } == { "aaa", "bbb" } +# ColourGuard behaviour +ok {test-number} - streamWrapper.str().empty() for: true +# ColourGuard behaviour +ok {test-number} - streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" for: "1 Using code: 2 2 Using code: 0 3 " == "1 Using code: 2 2 Using code: 0 3 " +# ColourGuard behaviour +ok {test-number} - streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" for: "Using code: 2 A B Using code: 0 C " == "Using code: 2 A B Using code: 0 C " +# 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" +# 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 (string) "1" +# 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 (string) "1" +# 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 (string) "1" +# 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 (string) "1" 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 (string) "1" 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 (string) "1" 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(), ContainsSubstring( "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(), ContainsSubstring( "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 +# Cout stream properly declares it writes to stdout +ok {test-number} - Catch::makeStream( "-" )->isConsole() for: true +# 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 **}" +# Empty stream name opens cout stream +ok {test-number} - Catch::makeStream( "" )->isConsole() for: true +# Empty tag is not allowed +ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) +# 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(), ContainsSubstring( "except" ) for: "expected exception" contains: "except" +# Exception messages can be tested for +ok {test-number} - thisThrows(), ContainsSubstring( "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} - -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} - 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} - filter([](int) { return false; }, values({ 1, 2, 3 })), 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 ) +# Hashers with different seed produce different hash with same test case +ok {test-number} - h1( dummy ) != h2( dummy ) for: 3422778688 (0x<hex digits>) != 130711275 (0x<hex digits>) +# Hashers with same seed produce same hash +ok {test-number} - h1( dummy ) == h2( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x<hex digits>) != 2668622104 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) != 3916075712 (0x<hex digits>) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) != 3429949824 (0x<hex digits>) +# Hashing test case produces same hash across multiple calls +ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>) +# 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(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "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(), !ContainsSubstring( "substring" ) for: "this string contains 'abc' as a substring" not contains: "substring" +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# Mayfail test case with nested sections +not ok {test-number} - explicitly +# 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" +# Multireporter calls reporters and listeners in correct order +ok {test-number} - records == expected for: { "Hello", "world", "Goodbye", "world" } == { "Hello", "world", "Goodbye", "world" } +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == false for: false == false +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldRedirectStdOut == true for: true == true +# Multireporter updates ReporterPreferences properly +ok {test-number} - multiReporter.getPreferences().shouldReportAllAssertions == true for: true == true +# 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)' +# 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 +# Parsed tags are matched case insensitive +ok {test-number} - spec.hasFilters() for: true +# Parsed tags are matched case insensitive +ok {test-number} - spec.getInvalidSpecs().empty() for: true +# Parsed tags are matched case insensitive +ok {test-number} - spec.matches( testCase ) for: true +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-count=8" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardCount == 8 for: 8 == 8 +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-index=2" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardIndex == 2 for: 2 == 2 +# Parsing sharding-related cli flags +ok {test-number} - !(result) for: !{?} +# Parsing sharding-related cli flags +ok {test-number} - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +# Parsing sharding-related cli flags +ok {test-number} - cli.parse({ "test", "--shard-index=0" }) for: {?} +# Parsing sharding-related cli flags +ok {test-number} - config.shardIndex == 0 for: 0 == 0 +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.matches( testCase ) for: true with 1 message: 'tagString := "[tag with spaces]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.hasFilters() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.getInvalidSpecs().empty() for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing tags with non-alphabetical characters is pass-through +ok {test-number} - spec.matches( testCase ) for: true with 1 message: 'tagString := "[I said "good day" sir!]"' +# Parsing warnings +ok {test-number} - cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == WarnAbout::NoAssertions for: 1 == 1 +# Parsing warnings +ok {test-number} - !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +# Parsing warnings +ok {test-number} - cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 +# 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.reporterSpecifications.empty() for: true +# Process can be configured on command line +ok {test-number} - !(cfg.hasTestFilters()) for: !false +# Process can be configured on command line +ok {test-number} - cfg.getReporterSpecs().size() == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } for: {?} == {?} +# Process can be configured on command line +ok {test-number} - cfg.getProcessedReporterSpecs().size() == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } for: {?} == {?} +# 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} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# 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(), ContainsSubstring("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - result for: {?} with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } for: { {?} } == { {?} } with 1 message: 'result.errorMessage() := ""' +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } for: { {?}, {?} } == { {?}, {?} } +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } 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(), ContainsSubstring("Only one reporter may have unspecified output file.") for: "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." +# 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(), ContainsSubstring("convert") && ContainsSubstring("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(), ContainsSubstring("never") && ContainsSubstring("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.defaultOutputFilename == "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.defaultOutputFilename == "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.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +# Process can be configured on command line +ok {test-number} - cli.parse( { "test", "--colour-mode", "default" } ) for: {?} +# Process can be configured on command line +ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--colour-mode", "ansi"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.defaultColourMode == ColourMode::ANSI for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--colour-mode", "none"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.defaultColourMode == ColourMode::None 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(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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 +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation accepts known methods +ok {test-number} - Catch::generateRandomSeed(method) +# Random seed generation reports unknown methods +ok {test-number} - Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) +# 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 +# Registering reporter with '::' in name fails +ok {test-number} - registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" +# 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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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' +# Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla +ok {test-number} - +# 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 +# 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 +# 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(), ContainsSubstring( "string" ) for: "this string contains 'abc' as a substring" contains: "string" +# String matchers +ok {test-number} - testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +# String matchers +ok {test-number} - testStringForMatching(), ContainsSubstring( "abc" ) for: "this string contains 'abc' as a substring" contains: "abc" +# String matchers +ok {test-number} - testStringForMatching(), ContainsSubstring( "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} - std::strcmp( empty.data(), "" ) == 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} - std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 +# StringRef +ok {test-number} - s.data() == rawChars for: "hello" == "hello" +# StringRef +ok {test-number} - original == "original" +# StringRef +ok {test-number} - original.data() +# StringRef +ok {test-number} - original.begin() == copy.begin() for: "original string" == "original string" +# StringRef +ok {test-number} - original.begin() == copy.begin() for: "original string" == "original string" +# 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.data(), "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.data(), "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.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: '!(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: 'sr2.empty()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr2.size() == 0' +# Stringifying char arrays with statically known sizes - char +ok {test-number} - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# Stringifying char arrays with statically known sizes - char +ok {test-number} - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# Stringifying char arrays with statically known sizes - signed char +ok {test-number} - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# Stringifying char arrays with statically known sizes - signed char +ok {test-number} - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# Stringifying char arrays with statically known sizes - unsigned char +ok {test-number} - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# Stringifying char arrays with statically known sizes - unsigned char +ok {test-number} - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc"" +# 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, ContainsSubstring( "[@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, ContainsSubstring( "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, ContainsSubstring( "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, ContainsSubstring( "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 ) ) +# Tags with spaces and non-alphanumerical characters are accepted +ok {test-number} - testCase.tags.size() == 2 for: 2 == 2 +# Tags with spaces and non-alphanumerical characters are accepted +ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +# 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 identical tags keeps just one +ok {test-number} - testCase.tags.size() == 1 for: 1 == 1 +# Test case with identical tags keeps just one +ok {test-number} - testCase.tags[0] == Tag( "tag1" ) for: {?} == {?} +# 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} - +# Testing checked-if +ok {test-number} - true +# Testing checked-if +ok {test-number} - +# Testing checked-if +ok {test-number} - false # TODO +# Testing checked-if +ok {test-number} - true +# Testing checked-if +ok {test-number} - false # TODO +# Testing checked-if +ok {test-number} - +# Testing checked-if 2 +ok {test-number} - true +# Testing checked-if 2 +not ok {test-number} - explicitly +# Testing checked-if 3 +ok {test-number} - false # TODO +# Testing checked-if 3 +not ok {test-number} - explicitly +# 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, ContainsSubstring("[fakeTag]"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "[fakeTag]" +# The default listing implementation write to provided stream +ok {test-number} - listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) for: "Available reporters: fake reporter: fake description " ( contains: "fake reporter" and contains: "fake description" ) +# The default listing implementation write to provided stream +ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) +# The default listing implementation write to provided stream +ok {test-number} - listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) for: "Registered listeners: fakeListener: fake description " ( contains: "fakeListener" and contains: "fake description" ) +# 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.m_derefed[0] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_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.m_derefed[0] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllMatch range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AllMatch range matcher +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { false, false, false, false, false } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - data, !AllTrue() for: { false, false, false, false, false } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked, AllTrue() for: { true, true, true, true, true } contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked, !AllTrue() for: { true, true, false, true, true } not contains only true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AllTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AllTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AllTrue range matcher +ok {test-number} - !(mocked.m_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.m_derefed[0] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.m_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.m_derefed[0] for: true +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.m_derefed[1]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.m_derefed[2]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { true, true, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { false, false, true, false, false } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { true, true, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, AnyTrue() for: { false, false, true, false, false } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - data, !AnyTrue() for: { false, false, false, false, false } not contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked, AnyTrue() for: { false, false, false, false, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked, AnyTrue() for: { false, false, true, true, true } contains at least one true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of AnyTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of AnyTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of AnyTrue range matcher +ok {test-number} - !(mocked.m_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.m_derefed[0] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.m_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.m_derefed[0] for: true +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.m_derefed[1]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.m_derefed[2]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { true, true, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { false, false, true, false, false } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { true, true, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, !NoneTrue() for: { false, false, true, false, false } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - data, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked, NoneTrue() for: { false, false, false, false, false } contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[3] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[4] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked, !NoneTrue() for: { false, false, true, true, true } not contains no true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[0] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[1] for: true +# Usage of NoneTrue range matcher +ok {test-number} - mocked.m_derefed[2] for: true +# Usage of NoneTrue range matcher +ok {test-number} - !(mocked.m_derefed[3]) for: !false +# Usage of NoneTrue range matcher +ok {test-number} - !(mocked.m_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' +# 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]" +# XmlWriter writes boolean attributes as true/false +ok {test-number} - stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +# 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 }" +# 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 +ok {test-number} - flag for: false # TODO +# 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 +ok {test-number} - flag for: false # TODO +# 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 +# convertToBits +ok {test-number} - convertToBits( 0.f ) == 0 for: 0 == 0 +# convertToBits +ok {test-number} - convertToBits( -0.f ) == ( 1ULL << 31 ) for: 2147483648 (0x<hex digits>) == 2147483648 (0x<hex digits>) +# convertToBits +ok {test-number} - convertToBits( 0. ) == 0 for: 0 == 0 +# convertToBits +ok {test-number} - convertToBits( -0. ) == ( 1ULL << 63 ) for: 9223372036854775808 (0x<hex digits>) == 9223372036854775808 (0x<hex digits>) +# convertToBits +ok {test-number} - convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 +# convertToBits +ok {test-number} - convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +# empty tags are not allowed +ok {test-number} - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) +# 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} - +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value' +# is_unary_function +ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<int>::value)' +# is_unary_function +ok {test-number} - with 1 message: '!(Catch::Clara::Detail::is_unary_function<std::string const&>::value)' +# 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' +# makeStream recognizes %debug stream name +ok {test-number} - Catch::makeStream( "%debug" ) +# 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" +# request an unknown %-starting stream fails +ok {test-number} - Catch::makeStream( "%somestream" ) +# 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} - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} 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' +# startsWith +ok {test-number} - !(startsWith("", 'c')) for: !false +# startsWith +ok {test-number} - startsWith(std::string("abc"), 'a') for: true +# startsWith +ok {test-number} - startsWith("def"_catch_sr, 'd') for: true +# 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 } }" +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stderr" )->isConsole() for: true +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stdout" )->isConsole() for: true +# 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 +# tags with dots in later positions are not parsed as hidden +ok {test-number} - testcase.tags.size() == 1 for: 1 == 1 +# tags with dots in later positions are not parsed as hidden +ok {test-number} - testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +# 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<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..2299 + diff --git a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 5291c85d220785e193c9451d31af23074960e59d..526f00a90f1b93d419920afb5d450bf9e675e8fc 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -1,8 +1,6 @@ ##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'] @@ -62,9 +60,9 @@ Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answe ##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'] +##teamcity[testStarted name='#835 -- errno should not be touched by Catch2'] 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[testFinished name='#835 -- errno should not be touched by Catch2' duration="{duration}"] ##teamcity[testStarted name='#872'] ##teamcity[testFinished name='#872' duration="{duration}"] ##teamcity[testStarted name='#961 -- Dynamically created sections should all be reported'] @@ -233,10 +231,18 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##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='CaseInsensitiveEqualsTo is case insensitive'] +##teamcity[testFinished name='CaseInsensitiveEqualsTo is case insensitive' duration="{duration}"] +##teamcity[testStarted name='CaseInsensitiveLess is case insensitive'] +##teamcity[testFinished name='CaseInsensitiveLess is case insensitive' 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='Clara::Opt supports accept-many lambdas'] +##teamcity[testFinished name='Clara::Opt supports accept-many lambdas' duration="{duration}"] +##teamcity[testStarted name='ColourGuard behaviour'] +##teamcity[testFinished name='ColourGuard behaviour' 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'] @@ -270,11 +276,13 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##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'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "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(), ContainsSubstring( "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='Cout stream properly declares it writes to stdout'] +##teamcity[testFinished name='Cout stream properly declares it writes to stdout' 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}"] @@ -288,6 +296,10 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom ##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='Empty stream name opens cout stream'] +##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"] +##teamcity[testStarted name='Empty tag is not allowed'] +##teamcity[testFinished name='Empty tag is not allowed' 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'] @@ -365,6 +377,14 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a fa ##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='Hashers with different seed produce different hash with same test case'] +##teamcity[testFinished name='Hashers with different seed produce different hash with same test case' duration="{duration}"] +##teamcity[testStarted name='Hashers with same seed produce same hash'] +##teamcity[testFinished name='Hashers with same seed produce same hash' duration="{duration}"] +##teamcity[testStarted name='Hashing different test cases produces different result'] +##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"] +##teamcity[testStarted name='Hashing test case produces same hash across multiple calls'] +##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' 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'] @@ -399,16 +419,26 @@ Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.si ##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'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "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'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !ContainsSubstring( "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='Mayfail test case with nested sections'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Mayfail test case with nested sections' 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='Multireporter calls reporters and listeners in correct order'] +##teamcity[testFinished name='Multireporter calls reporters and listeners in correct order' duration="{duration}"] +##teamcity[testStarted name='Multireporter updates ReporterPreferences properly'] +##teamcity[testFinished name='Multireporter updates ReporterPreferences properly' 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'] @@ -453,6 +483,14 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from ##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='Parsed tags are matched case insensitive'] +##teamcity[testFinished name='Parsed tags are matched case insensitive' duration="{duration}"] +##teamcity[testStarted name='Parsing sharding-related cli flags'] +##teamcity[testFinished name='Parsing sharding-related cli flags' duration="{duration}"] +##teamcity[testStarted name='Parsing tags with non-alphabetical characters is pass-through'] +##teamcity[testFinished name='Parsing tags with non-alphabetical characters is pass-through' duration="{duration}"] +##teamcity[testStarted name='Parsing warnings'] +##teamcity[testFinished name='Parsing warnings' 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'] @@ -467,6 +505,10 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from ##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='Random seed generation accepts known methods'] +##teamcity[testFinished name='Random seed generation accepts known methods' duration="{duration}"] +##teamcity[testStarted name='Random seed generation reports unknown methods'] +##teamcity[testFinished name='Random seed generation reports unknown methods' 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'] @@ -477,10 +519,14 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor 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='Registering reporter with |'::|' in name fails'] +##teamcity[testFinished name='Registering reporter with |'::|' in name fails' 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='Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla'] +##teamcity[testFinished name='Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla' 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'] @@ -531,6 +577,8 @@ Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##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='Tags with spaces and non-alphanumerical characters are accepted'] +##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' 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'] @@ -567,6 +615,8 @@ Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##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 identical tags keeps just one'] +##teamcity[testFinished name='Test case with identical tags keeps just one' 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'] @@ -601,10 +651,16 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"' ##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 AllTrue range matcher'] +##teamcity[testFinished name='Usage of AllTrue 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 AnyTrue range matcher'] +##teamcity[testFinished name='Usage of AnyTrue 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 NoneTrue range matcher'] +##teamcity[testFinished name='Usage of NoneTrue 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'] @@ -652,10 +708,6 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##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'] @@ -672,8 +724,6 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##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'] @@ -709,6 +759,8 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testStarted name='has printf'] loose text artifact ##teamcity[testFinished name='has printf' duration="{duration}"] +##teamcity[testStarted name='is_unary_function'] +##teamcity[testFinished name='is_unary_function' 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}"] @@ -733,6 +785,8 @@ Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib 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='makeStream recognizes %debug stream name'] +##teamcity[testFinished name='makeStream recognizes %debug stream name' duration="{duration}"] ##teamcity[testStarted name='make_unique reimplementation'] ##teamcity[testFinished name='make_unique reimplementation' duration="{duration}"] ##teamcity[testStarted name='mean'] @@ -781,6 +835,8 @@ Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD ##teamcity[testFinished name='random SECTION tests' duration="{duration}"] ##teamcity[testStarted name='replaceInPlace'] ##teamcity[testFinished name='replaceInPlace' duration="{duration}"] +##teamcity[testStarted name='request an unknown %-starting stream fails'] +##teamcity[testFinished name='request an unknown %-starting stream fails' duration="{duration}"] ##teamcity[testStarted name='resolution'] ##teamcity[testFinished name='resolution' duration="{duration}"] ##teamcity[testStarted name='run_for_at_least, chronometer'] @@ -803,6 +859,8 @@ Message.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i 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='startsWith'] +##teamcity[testFinished name='startsWith' 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'] @@ -813,9 +871,8 @@ Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to ##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='stdout and stderr streams have %-starting name'] +##teamcity[testFinished name='stdout and stderr streams have %-starting name' duration="{duration}"] ##teamcity[testStarted name='stringify ranges'] ##teamcity[testFinished name='stringify ranges' duration="{duration}"] ##teamcity[testStarted name='stringify( has_maker )'] @@ -865,8 +922,6 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "Why wo ##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>'] diff --git a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b7914464be15e51fa64e35f56d695364bd3e772 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -0,0 +1,950 @@ +##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='#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='#2152 - ULP checks between differently signed values were wrong - double'] +##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - double' duration="{duration}"] +##teamcity[testStarted name='#2152 - ULP checks between differently signed values were wrong - float'] +##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - float' 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 Catch2'] +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 Catch2' 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='CaseInsensitiveEqualsTo is case insensitive'] +##teamcity[testFinished name='CaseInsensitiveEqualsTo is case insensitive' duration="{duration}"] +##teamcity[testStarted name='CaseInsensitiveLess is case insensitive'] +##teamcity[testFinished name='CaseInsensitiveLess is case insensitive' 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='Clara::Opt supports accept-many lambdas'] +##teamcity[testFinished name='Clara::Opt supports accept-many lambdas' duration="{duration}"] +##teamcity[testStarted name='ColourGuard behaviour'] +##teamcity[testFinished name='ColourGuard behaviour' 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(), ContainsSubstring( "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(), ContainsSubstring( "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='Cout stream properly declares it writes to stdout'] +##teamcity[testFinished name='Cout stream properly declares it writes to stdout' 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='Empty stream name opens cout stream'] +##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"] +##teamcity[testStarted name='Empty tag is not allowed'] +##teamcity[testFinished name='Empty tag is not allowed' 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='Hashers with different seed produce different hash with same test case'] +##teamcity[testFinished name='Hashers with different seed produce different hash with same test case' duration="{duration}"] +##teamcity[testStarted name='Hashers with same seed produce same hash'] +##teamcity[testFinished name='Hashers with same seed produce same hash' duration="{duration}"] +##teamcity[testStarted name='Hashing different test cases produces different result'] +##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"] +##teamcity[testStarted name='Hashing test case produces same hash across multiple calls'] +##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' 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(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "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='Mayfail test case with nested sections'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Mayfail test case with nested sections' 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='Multireporter calls reporters and listeners in correct order'] +##teamcity[testFinished name='Multireporter calls reporters and listeners in correct order' duration="{duration}"] +##teamcity[testStarted name='Multireporter updates ReporterPreferences properly'] +##teamcity[testFinished name='Multireporter updates ReporterPreferences properly' 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='Parsed tags are matched case insensitive'] +##teamcity[testFinished name='Parsed tags are matched case insensitive' duration="{duration}"] +##teamcity[testStarted name='Parsing sharding-related cli flags'] +##teamcity[testFinished name='Parsing sharding-related cli flags' duration="{duration}"] +##teamcity[testStarted name='Parsing tags with non-alphabetical characters is pass-through'] +##teamcity[testFinished name='Parsing tags with non-alphabetical characters is pass-through' duration="{duration}"] +##teamcity[testStarted name='Parsing warnings'] +##teamcity[testFinished name='Parsing warnings' 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='Random seed generation accepts known methods'] +##teamcity[testFinished name='Random seed generation accepts known methods' duration="{duration}"] +##teamcity[testStarted name='Random seed generation reports unknown methods'] +##teamcity[testFinished name='Random seed generation reports unknown methods' 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='Registering reporter with |'::|' in name fails'] +##teamcity[testFinished name='Registering reporter with |'::|' in name fails' 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='Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla'] +##teamcity[testFinished name='Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla' 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 char arrays with statically known sizes - char'] +##teamcity[testFinished name='Stringifying char arrays with statically known sizes - char' duration="{duration}"] +##teamcity[testStarted name='Stringifying char arrays with statically known sizes - signed char'] +##teamcity[testFinished name='Stringifying char arrays with statically known sizes - signed char' duration="{duration}"] +##teamcity[testStarted name='Stringifying char arrays with statically known sizes - unsigned char'] +##teamcity[testFinished name='Stringifying char arrays with statically known sizes - unsigned char' 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='Tags with spaces and non-alphanumerical characters are accepted'] +##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' 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 identical tags keeps just one'] +##teamcity[testFinished name='Test case with identical tags keeps just one' 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='Testing checked-if'] +##teamcity[testFinished name='Testing checked-if' duration="{duration}"] +##teamcity[testStarted name='Testing checked-if 2'] +Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Testing checked-if 2' duration="{duration}"] +##teamcity[testStarted name='Testing checked-if 3'] +Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Testing checked-if 3' 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 AllTrue range matcher'] +##teamcity[testFinished name='Usage of AllTrue 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 AnyTrue range matcher'] +##teamcity[testFinished name='Usage of AnyTrue 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 NoneTrue range matcher'] +##teamcity[testFinished name='Usage of NoneTrue 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='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='XmlWriter writes boolean attributes as true/false'] +##teamcity[testFinished name='XmlWriter writes boolean attributes as true/false' 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='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 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 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='convertToBits'] +##teamcity[testFinished name='convertToBits' duration="{duration}"] +##teamcity[testStarted name='empty tags are not allowed'] +##teamcity[testFinished name='empty tags are not allowed' 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'] +##teamcity[testFinished name='has printf' duration="{duration}"] +##teamcity[testStarted name='is_unary_function'] +##teamcity[testFinished name='is_unary_function' 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='makeStream recognizes %debug stream name'] +##teamcity[testFinished name='makeStream recognizes %debug stream name' 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='request an unknown %-starting stream fails'] +##teamcity[testFinished name='request an unknown %-starting stream fails' 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='startsWith'] +##teamcity[testFinished name='startsWith' 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='stdout and stderr streams have %-starting name'] +##teamcity[testFinished name='stdout and stderr streams have %-starting name' 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='tags with dots in later positions are not parsed as hidden'] +##teamcity[testFinished name='tags with dots in later positions are not parsed as hidden' 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<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 index bd12e70a30d509245ac9648840c46028867f74ee..0167e59cf285122303ba0e3cd67122ba72d78594 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -1,28 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<Catch2TestRun name="<exe-name>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> - <Randomness seed="1"/> +<Catch2TestRun name="<exe-name>" rng-seed="1" catch2-version="<version>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> <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> @@ -800,7 +780,7 @@ Nor would this </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" > + <TestCase name="#835 -- errno should not be touched by Catch2" 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 @@ -811,7 +791,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - errno == 1 + errno_after == 1 </Original> <Expanded> 1 == 1 @@ -3014,6 +2994,144 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "", "" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "", "a" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "a", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "a", "A" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "A", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "A", "A" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "a", "b" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "a", "B" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="CaseInsensitiveLess is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(lt( "a", "a" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(lt( "", "" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "a", "b" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "a", "B" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "A", "b" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "A", "B" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" 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" > @@ -3157,13 +3275,106 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="Clara::Opt supports accept-many lambdas" tags="[clara][opt]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Section name="Parsing fails on multiple options without accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + !(parse_result) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Parsing succeeds on multiple options with accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + parse_result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + res == std::vector<std::string>{ "aaa", "bbb" } + </Original> + <Expanded> + { "aaa", "bbb" } == { "aaa", "bbb" } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="ColourGuard behaviour" tags="[console-colours]" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Section name="ColourGuard is disengaged by default" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="ColourGuard is engaged by op<<" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" + </Original> + <Expanded> + "1 +Using code: 2 +2 +Using code: 0 +3 +" +== +"1 +Using code: 2 +2 +Using code: 0 +3 +" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="ColourGuard can be engaged explicitly" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" + </Original> + <Expanded> + "Using code: 2 +A +B +Using code: 0 +C +" +== +"Using code: 2 +A +B +Using code: 0 +C +" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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 ) + 1 ( equals: (int) 1 or (string) "1" 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" > @@ -3171,7 +3382,7 @@ Nor would this 1, MatcherA() && ( MatcherB() && MatcherC() ) </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" 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" > @@ -3179,7 +3390,7 @@ Nor would this 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 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) </Expanded> </Expression> <OverallResult success="true"/> @@ -3190,7 +3401,7 @@ Nor would this 1, ( MatcherA() || MatcherB() ) || MatcherC() </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" 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" > @@ -3198,7 +3409,7 @@ Nor would this 1, MatcherA() || ( MatcherB() || MatcherC() ) </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + 1 ( equals: (int) 1 or (string) "1" 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" > @@ -3206,7 +3417,7 @@ Nor would this 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 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) </Expanded> </Expression> <OverallResult success="true"/> @@ -3217,7 +3428,7 @@ Nor would this 0, !MatcherA() </Original> <Expanded> - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" </Expanded> </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3225,7 +3436,7 @@ Nor would this 1, !!MatcherA() </Original> <Expanded> - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" </Expanded> </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3233,7 +3444,7 @@ Nor would this 0, !!!MatcherA() </Original> <Expanded> - 0 not equals: (int) 1 or (float) 1.0f + 0 not equals: (int) 1 or (string) "1" </Expanded> </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3241,7 +3452,7 @@ Nor would this 1, !!!!MatcherA() </Original> <Expanded> - 1 equals: (int) 1 or (float) 1.0f + 1 equals: (int) 1 or (string) "1" </Expanded> </Expression> <OverallResult success="true"/> @@ -3255,7 +3466,7 @@ Nor would this 1, MatcherA() || MatcherB() </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 ) </Expanded> </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3263,7 +3474,7 @@ Nor would this 1, MatcherA() && MatcherB() </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 ) </Expanded> </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3271,7 +3482,7 @@ Nor would this 1, MatcherA() || !MatcherB() </Original> <Expanded> - 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) </Expanded> </Expression> <OverallResult success="true"/> @@ -3884,7 +4095,7 @@ Nor would this <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 ) + testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "not there" (case insensitive) @@ -3892,7 +4103,7 @@ Nor would this </Expression> <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - testStringForMatching(), Contains( "STRING" ) + testStringForMatching(), ContainsSubstring( "STRING" ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "STRING" @@ -4054,6 +4265,17 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="Cout stream properly declares it writes to stdout" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "-" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <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> @@ -4136,6 +4358,28 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="Empty stream name opens cout stream" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) + </Original> + <Expanded> + Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) + </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> @@ -4592,7 +4836,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> - thisThrows(), Contains( "except" ) + thisThrows(), ContainsSubstring( "except" ) </Original> <Expanded> "expected exception" contains: "except" @@ -4600,7 +4844,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> - thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) + thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) </Original> <Expanded> "expected exception" contains: "except" (case insensitive) @@ -6151,50 +6395,7 @@ Nor would this <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" > + <Section name="Simple filtering" 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 @@ -6213,10 +6414,10 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - gen.get() == 2 + gen.get() == 3 </Original> <Expanded> - 2 == 2 + 3 == 3 </Expanded> </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6231,8 +6432,8 @@ Nor would this </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" > + <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Filter out multiple elements at the start and 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() == 1 @@ -6241,23 +6442,121 @@ Nor would this 1 == 1 </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - !(gen.next()) + gen.next() </Original> <Expanded> - !false + true </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> + <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="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Throws on construction if it can't get initial element" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <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> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + </Original> + <Expanded> + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" 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> @@ -7922,6 +8221,87 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="Hashers with different seed produce different hash with same test case" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h1( dummy ) != h2( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +!= +130711275 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashers with same seed produce same hash" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h1( dummy ) == h2( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashing different test cases produces different result" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Section name="Different test name" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2903002874 (0x<hex digits>) +!= +2668622104 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different classname" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2673152918 (0x<hex digits>) +!= +3916075712 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different tags" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2074929312 (0x<hex digits>) +!= +3429949824 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashing test case produces same hash across multiple calls" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy ) == h( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) + </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 @@ -8356,7 +8736,7 @@ Nor would this <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" ) + testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) </Original> <Expanded> "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) @@ -8367,7 +8747,7 @@ Nor would this <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" ) + testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) </Original> <Expanded> "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) @@ -8375,7 +8755,7 @@ Nor would this </Expression> <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) + testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) </Original> <Expanded> "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) @@ -8386,7 +8766,7 @@ Nor would this <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" ) + testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "substring" ) </Original> <Expanded> "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) @@ -8397,7 +8777,7 @@ Nor would this <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" ) + testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) </Original> <Expanded> "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) @@ -8408,7 +8788,7 @@ Nor would this <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" ) + testStringForMatching(), !ContainsSubstring( "different" ) </Original> <Expanded> "this string contains 'abc' as a substring" not contains: "different" @@ -8419,7 +8799,7 @@ Nor would this <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" ) + testStringForMatching(), !ContainsSubstring( "substring" ) </Original> <Expanded> "this string contains 'abc' as a substring" not contains: "substring" @@ -8427,6 +8807,43 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> + <TestCase name="Mayfail test case with nested sections" tags="[!mayfail]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </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> @@ -8446,76 +8863,226 @@ Nor would this </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" > + <TestCase name="Multireporter calls reporters and listeners in correct order" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - values > -6 + records == expected </Original> <Expanded> - 6 > -6 + { "Hello", "world", "Goodbye", "world" } +== +{ "Hello", "world", "Goodbye", "world" } </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Multireporter updates ReporterPreferences properly" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - values > -6 + multiReporter.getPreferences().shouldRedirectStdOut == false </Original> <Expanded> - -5 > -6 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - values > -6 + multiReporter.getPreferences().shouldReportAllAssertions == false </Original> <Expanded> - -4 > -6 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Adding listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - values > -6 + multiReporter.getPreferences().shouldRedirectStdOut == false </Original> <Expanded> - 90 > -6 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - values > -6 + multiReporter.getPreferences().shouldReportAllAssertions == false </Original> <Expanded> - 91 > -6 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > - <Original> - values > -6 - </Original> - <Expanded> + <Section name="Adding reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </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> @@ -10438,218 +11005,515 @@ Nor would this </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" > + <TestCase name="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.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 + spec.hasFilters() </Original> <Expanded> - {null string} == 0 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > <Original> - returnsConstNull() == 0 + spec.getInvalidSpecs().empty() </Original> <Expanded> - {null string} == 0 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > <Original> - 0 != p + spec.matches( testCase ) </Original> <Expanded> - 0 != 0x<hex digits> + true </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" > + <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="shard-count" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - str1.size() == 3 + 5 + cli.parse({ "test", "--shard-count=8" }) </Original> <Expanded> - 8 == 8 + {?} </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - str2.size() == 3 + 10 + config.shardCount == 8 </Original> <Expanded> - 13 == 13 + 8 == 8 </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" > + <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - str1.size() == 2 + 5 + !(result) </Original> <Expanded> - 7 == 7 + !{?} </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - str2.size() == 2 + 15 + result.errorMessage(), ContainsSubstring("Shard count must be a positive number") </Original> <Expanded> - 17 == 17 + "Shard count must be a positive number" contains: "Shard count must be a positive number" </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" > + <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - result + !(result) </Original> <Expanded> - {?} + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.processName == "" + result.errorMessage(), ContainsSubstring("Shard count must be a positive number") </Original> <Expanded> - "" == "" + "Shard count must be a positive number" contains: "Shard count must be a positive number" </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> - <Section name="default - no arguments" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="shard-index" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - result + cli.parse({ "test", "--shard-index=2" }) </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.shouldDebugBreak == false + config.shardIndex == 2 </Original> <Expanded> - false == false + 2 == 2 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.abortAfter == -1 + !(result) </Original> <Expanded> - -1 == -1 + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.noThrow == false + result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") </Original> <Expanded> - false == false + "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" </Expanded> </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shard index 0 is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.reporterName == "console" + cli.parse({ "test", "--shard-index=0" }) </Original> <Expanded> - "console" == "console" + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - !(cfg.hasTestFilters()) + config.shardIndex == 0 </Original> <Expanded> - !false + 0 == 0 </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="2" 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> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "-w", "NoAssertions" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == WarnAbout::NoAssertions + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="NoTests is no longer supported" 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", "-w", "NoTests" } )) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Combining multiple warnings" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" 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.reporterSpecifications.empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(cfg.hasTestFilters()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getReporterSpecs().size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getProcessedReporterSpecs().size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <OverallResults successes="11" 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> @@ -10752,20 +11616,26 @@ Nor would this </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/console" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - cli.parse({"test", "-r", "console"}) + result </Original> <Expanded> {?} </Expanded> </Expression> + <Info> + result.errorMessage() := "" + </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.reporterName == "console" + config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } </Original> <Expanded> - "console" == "console" + { {?} } == { {?} } </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -10774,20 +11644,26 @@ Nor would this </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/xml" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - cli.parse({"test", "-r", "xml"}) + result </Original> <Expanded> {?} </Expanded> </Expression> + <Info> + result.errorMessage() := "" + </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.reporterName == "xml" + config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } </Original> <Expanded> - "xml" == "xml" + { {?} } == { {?} } </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -10796,20 +11672,76 @@ Nor would this </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--reporter/junit" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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="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> - cli.parse({"test", "--reporter", "junit"}) + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), ContainsSubstring("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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="With output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result </Original> <Expanded> {?} </Expanded> </Expression> + <Info> + result.errorMessage() := "" + </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.reporterName == "junit" + config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } </Original> <Expanded> - "junit" == "junit" + { {?} } == { {?} } </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -10817,37 +11749,104 @@ Nor would this <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> + <Section name="With Windows-like absolute path as output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="All with output files" 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::out=output.xml", "-r", "junit::out=output-junit.xml" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } + </Original> + <Expanded> + { {?}, {?} } == { {?}, {?} } + </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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Mixed output files and default output" 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::out=output.xml", "-r", "console" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } + </Original> + <Expanded> + { {?}, {?} } == { {?}, {?} } + </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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="cannot have multiple reporters with default output" 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(), ContainsSubstring("Only one reporter may have unspecified output file.") + </Original> + <Expanded> + "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." + </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"/> @@ -10952,7 +11951,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - result.errorMessage(), Contains("convert") && Contains("oops") + result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") </Original> <Expanded> "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) @@ -11075,7 +12074,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - result.errorMessage(), Contains("never") && Contains("both") + result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") </Original> <Expanded> "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) @@ -11143,7 +12142,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.outputFilename == "filename.ext" + config.defaultOutputFilename == "filename.ext" </Original> <Expanded> "filename.ext" == "filename.ext" @@ -11165,7 +12164,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.outputFilename == "filename.ext" + config.defaultOutputFilename == "filename.ext" </Original> <Expanded> "filename.ext" == "filename.ext" @@ -11225,7 +12224,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.useColour == UseColour::Auto + config.defaultColourMode == ColourMode::PlatformDefault </Original> <Expanded> 0 == 0 @@ -11239,7 +12238,7 @@ Nor would this <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"}) + cli.parse( { "test", "--colour-mode", "default" } ) </Original> <Expanded> {?} @@ -11247,7 +12246,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.useColour == UseColour::Auto + config.defaultColourMode == ColourMode::PlatformDefault </Original> <Expanded> 0 == 0 @@ -11261,7 +12260,7 @@ Nor would this <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"}) + cli.parse({"test", "--colour-mode", "ansi"}) </Original> <Expanded> {?} @@ -11269,7 +12268,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.useColour == UseColour::Yes + config.defaultColourMode == ColourMode::ANSI </Original> <Expanded> 1 == 1 @@ -11283,7 +12282,7 @@ Nor would this <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"}) + cli.parse({"test", "--colour-mode", "none"}) </Original> <Expanded> {?} @@ -11291,10 +12290,10 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - config.useColour == UseColour::No + config.defaultColourMode == ColourMode::None </Original> <Expanded> - 2 == 2 + 3 == 3 </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -11313,10 +12312,10 @@ Nor would this </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" ) + result.errorMessage(), ContainsSubstring( "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" + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of" </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -11468,6 +12467,44 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="Random seed generation accepts known methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Random seed generation reports unknown methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + </Original> + <Expanded> + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + </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> @@ -11517,6 +12554,17 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> + <TestCase name="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" + </Original> + <Expanded> + "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" + </Expanded> + </Expression> + <OverallResult success="true"/> + </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> @@ -11537,13 +12585,13 @@ Nor would this !false </Expanded> </Expression> - <Section name="automake reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="Automake reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: automake + Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "All available tags: @@ -11563,13 +12611,13 @@ Nor would this !false </Expanded> </Expression> - <Section name="automake reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="Automake reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: automake + Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "Available reporters: @@ -11588,13 +12636,13 @@ Nor would this !false </Expanded> </Expression> - <Section name="automake reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="Automake reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: automake + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "All available test cases: @@ -11621,7 +12669,7 @@ Nor would this </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "All available tags: @@ -11647,7 +12695,7 @@ Nor would this </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "Available reporters: @@ -11672,7 +12720,7 @@ Nor would this </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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "All available test cases: @@ -11699,7 +12747,7 @@ Nor would this </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "All available tags: @@ -11725,7 +12773,7 @@ Nor would this </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "Available reporters: @@ -11750,7 +12798,7 @@ Nor would this </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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "All available test cases: @@ -11771,13 +12819,13 @@ Nor would this !false </Expanded> </Expression> - <Section name="junit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="JUnit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: junit + Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11798,13 +12846,13 @@ All available tags: !false </Expanded> </Expression> - <Section name="junit reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="JUnit reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: junit + Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11824,13 +12872,13 @@ Available reporters: !false </Expanded> </Expression> - <Section name="junit reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="JUnit reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: junit + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11852,13 +12900,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="sonarqube reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="SonarQube reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: sonarqube + Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11879,13 +12927,13 @@ All available tags: !false </Expanded> </Expression> - <Section name="sonarqube reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="SonarQube reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: sonarqube + Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11905,13 +12953,13 @@ Available reporters: !false </Expanded> </Expression> - <Section name="sonarqube reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="SonarQube reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: sonarqube + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -11933,13 +12981,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="tap reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TAP reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: tap + Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "All available tags: @@ -11959,13 +13007,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="tap reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TAP reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: tap + Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "Available reporters: @@ -11984,13 +13032,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="tap reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TAP reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: tap + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "All available test cases: @@ -12011,13 +13059,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="teamcity reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TeamCity reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: teamcity + Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "All available tags: @@ -12037,13 +13085,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="teamcity reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TeamCity reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: teamcity + Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "Available reporters: @@ -12062,13 +13110,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="teamcity reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="TeamCity reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: teamcity + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "All available test cases: @@ -12089,13 +13137,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="xml reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="XML reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: xml + Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fakeTag"s) + listingString, ContainsSubstring("fakeTag"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -12119,13 +13167,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="xml reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="XML reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: xml + Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + listingString, ContainsSubstring("fake reporter"s) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -12147,13 +13195,13 @@ All available test cases: !false </Expanded> </Expression> - <Section name="xml reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="XML reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Info> - Tested reporter: xml + 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 ) + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -12174,6 +13222,9 @@ All available test cases: </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" tags="[console-reporter]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <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> @@ -12497,7 +13548,7 @@ Message from section two <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" ) + testStringForMatching(), ContainsSubstring( "string" ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "string" @@ -12505,7 +13556,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) + testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "string" (case insensitive) @@ -12513,7 +13564,7 @@ Message from section two </Expression> <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - testStringForMatching(), Contains( "abc" ) + testStringForMatching(), ContainsSubstring( "abc" ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "abc" @@ -12521,7 +13572,7 @@ Message from section two </Expression> <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) + testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) </Original> <Expanded> "this string contains 'abc' as a substring" contains: "abc" (case insensitive) @@ -12627,658 +13678,1161 @@ Message from section two <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 == "original" + </Original> + <Expanded> + original == "original" + </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="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Copy construction is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.begin() == copy.begin() + </Original> + <Expanded> + "original string" == "original string" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Copy assignment is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.begin() == copy.begin() + </Original> + <Expanded> + "original string" == "original string" + </Expanded> + </Expression> + <OverallResults successes="1" 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.data(), "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.data(), "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> - original == "original" + Hello == Hello </Expanded> </Expression> - <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - original.data() + left != left.substr(0, 3) </Original> <Expanded> - original.data() + Hello != Hel </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="3" 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" > + <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> - ss.empty() == false + sr == "a standard string" </Original> <Expanded> - false == false + a standard string == "a standard string" </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - ss.size() == 5 + sr.size() == stdStr.size() </Original> <Expanded> - 5 == 5 + 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> - std::strncmp( ss.data(), "hello", 5 ) == 0 + sr == "a standard string" </Original> <Expanded> - 0 == 0 + a standard string == "a standard string" </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - ss == "hello" + sr.size() == stdStr.size() </Original> <Expanded> - hello == "hello" + 17 == 17 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" 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" > + <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> - ss.size() == 6 + sr == "a standard string" </Original> <Expanded> - 6 == 6 + a standard string == "a standard string" </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Original> - std::strcmp( ss.data(), "world!" ) == 0 + sr.size() == stdStr.size() </Original> <Expanded> - 0 == 0 + 17 == 17 </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" > + <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> - s.data() == s2.data() + stdStr == "a stringref" </Original> <Expanded> - "hello world!" == "hello world!" + "a stringref" == "a stringref" </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() + stdStr.size() == sr.size() </Original> <Expanded> - "hello world!" == "hello world!" + 11 == 11 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" 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" > + <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> - s.substr(s.size() + 1, 123).empty() + stdStr == "a stringref" </Original> <Expanded> - true + "a stringref" == "a stringref" </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.data(), "world!") == 0 + stdStr.size() == sr.size() </Original> <Expanded> - 0 == 0 + 11 == 11 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <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="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> + <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> - <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" > + <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="12" failures="0" expectedFailures="0"/> + </Section> + <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <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> - reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) + what, ContainsSubstring( "[@zzz]" ) </Original> <Expanded> - "Hello" != "Hello" + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "[@zzz]" </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Original> - left == right + what, ContainsSubstring( "file" ) </Original> <Expanded> - Hello == Hello + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "file" </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Original> - left != left.substr(0, 3) + what, ContainsSubstring( "2" ) </Original> <Expanded> - Hello != Hel + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "2" </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" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Original> - lhs == "some string += the stringref contents" + what, ContainsSubstring( "10" ) </Original> <Expanded> - "some string += the stringref contents" -== -"some string += the stringref contents" + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "10" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="4" 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" > + <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> - together == "abrakadabra" + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) </Original> <Expanded> - "abrakadabra" == "abrakadabra" + registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <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="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="12" failures="0" expectedFailures="0"/> - </Section> - <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> + <TestCase name="Tags with spaces and non-alphanumerical characters are accepted" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) + </Original> + <Expanded> + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + </Expanded> + </Expression> + <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="Stringifying char arrays with statically known sizes - char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 4 > 0 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 1 > 0 </Expanded> </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 4 > 0 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 4 > 0 </Expanded> </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 1 > 0 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <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> - ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + sizeof(TestType) > 0 </Original> <Expanded> - ""abc"" == ""abc"" + 4 > 0 </Expanded> </Expression> <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" > + <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> - minute == seconds + v.size() == 5 </Original> <Expanded> - 1 m == 60 s + 5 == 5 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - hour != seconds + v.capacity() >= 5 </Original> <Expanded> - 1 h != 60 s + 5 >= 5 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <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> - micro != milli + v.size() == 5 </Original> <Expanded> - 1 us != 1 ms + 5 == 5 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - nano != micro + v.capacity() >= 5 </Original> <Expanded> - 1 ns != 1 us + 5 >= 5 </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" > + <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> - half_minute != femto_second + v.size() == 5 </Original> <Expanded> - 1 [30/1]s != 1 fs + 5 == 5 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - pico_second != atto_second + v.capacity() >= 5 </Original> <Expanded> - 1 ps != 1 as + 5 >= 5 </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" > + <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> - now != later + v.size() == 5 </Original> <Expanded> - {iso8601-timestamp} -!= -{iso8601-timestamp} + 5 == 5 </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - s1 == s2 + v.capacity() >= 5 </Original> <Expanded> - "if ($b == 10) { - $a = 20; -}" -== -"if ($b == 10) { - $a = 20; -} -" + 5 >= 5 </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" > + <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> - what, Contains( "[@zzz]" ) + v.size() == 5 </Original> <Expanded> - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "[@zzz]" + 5 == 5 </Expanded> </Expression> - <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - what, Contains( "file" ) + v.capacity() >= 5 </Original> <Expanded> - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "file" + 5 >= 5 </Expanded> </Expression> - <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <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> - what, Contains( "2" ) + v.size() == 10 </Original> <Expanded> - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "2" + 10 == 10 </Expanded> </Expression> - <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - what, Contains( "10" ) + v.capacity() >= 10 </Original> <Expanded> - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "10" + 10 >= 10 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" 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" > + <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> - registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + v.size() == 0 </Original> <Expanded> - registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) + 0 == 0 </Expanded> </Expression> - <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + v.capacity() >= 5 </Original> <Expanded> - registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) + 5 >= 5 </Expanded> </Expression> - <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <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> - registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + v.size() == 5 </Original> <Expanded> - registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) + 5 == 5 </Expanded> </Expression> - <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + v.capacity() >= 10 </Original> <Expanded> - registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) + 10 >= 10 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" 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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - Template_Fixture<TestType>::m_a == 1 + v.size() == 5 </Original> <Expanded> - 1 == 1 + 5 == 5 </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - Template_Fixture<TestType>::m_a == 1 + v.capacity() >= 5 </Original> <Expanded> - 1 == 1 + 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="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" > + <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> - Template_Fixture<TestType>::m_a == 1 + v.size() == 5 </Original> <Expanded> - 1.0 == 1 + 5 == 5 </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 + v.capacity() >= 5 </Original> <Expanded> - 1 > 0 + 5 >= 5 </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" > + <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> - sizeof(TestType) > 0 + v.size() == 5 </Original> <Expanded> - 4 > 0 + 5 == 5 </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 + v.capacity() >= 5 </Original> <Expanded> - 1 > 0 + 5 >= 5 </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" > + <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> - sizeof(TestType) > 0 + v.size() == 5 </Original> <Expanded> - 4 > 0 + 5 == 5 </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 + v.capacity() >= 5 </Original> <Expanded> - 4 > 0 + 5 >= 5 </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" > + <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> - sizeof(TestType) > 0 + v.size() == 5 </Original> <Expanded> - 1 > 0 + 5 == 5 </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 + v.capacity() >= 5 </Original> <Expanded> - 4 > 0 + 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 - float" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <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 @@ -13432,56 +14986,56 @@ Message from section two </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" > + <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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 10 + v.size() == 2 * V </Original> <Expanded> - 10 == 10 + 12 == 12 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> - 10 >= 10 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 6 >= 6 </Expanded> </Expression> <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13495,10 +15049,10 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 6 >= 6 </Expanded> </Expression> <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13516,126 +15070,126 @@ Message from section two </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> - 10 >= 10 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 6 == 6 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 6 >= 6 </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" > + <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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 10 + v.size() == 2 * V </Original> <Expanded> - 10 == 10 + 8 == 8 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> - 10 >= 10 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 4 >= 4 </Expanded> </Expression> <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13649,10 +15203,10 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 4 >= 4 </Expanded> </Expression> <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13670,80 +15224,80 @@ Message from section two </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> - 10 >= 10 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 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() == 5 + v.size() == V </Original> <Expanded> - 5 == 5 + 4 == 4 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> - 5 >= 5 + 4 >= 4 </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" > + <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() == 5 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13751,7 +15305,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13760,7 +15314,7 @@ Message from section two <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 + v.size() == 2 * V </Original> <Expanded> 10 == 10 @@ -13768,7 +15322,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> 10 >= 10 @@ -13778,7 +15332,7 @@ Message from section two </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == 5 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13786,7 +15340,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13803,7 +15357,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13824,7 +15378,7 @@ Message from section two </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == 5 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13832,7 +15386,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13841,7 +15395,7 @@ Message from section two <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 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13849,7 +15403,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 10 + v.capacity() >= 2 * V </Original> <Expanded> 10 >= 10 @@ -13859,7 +15413,7 @@ Message from section two </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == 5 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13867,7 +15421,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13876,7 +15430,7 @@ Message from section two <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 + v.size() == V </Original> <Expanded> 5 == 5 @@ -13884,7 +15438,7 @@ Message from section two </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= 5 + v.capacity() >= V </Original> <Expanded> 5 >= 5 @@ -13894,13 +15448,13 @@ Message from section two </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" > + <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> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13908,7 +15462,7 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </Expanded> </Expression> <Section name="resizing bigger changes size and capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13917,7 +15471,7 @@ Message from section two v.size() == 2 * V </Original> <Expanded> - 12 == 12 + 30 == 30 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13925,7 +15479,7 @@ Message from section two v.capacity() >= 2 * V </Original> <Expanded> - 12 >= 12 + 30 >= 30 </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -13935,7 +15489,7 @@ Message from section two v.size() == V </Original> <Expanded> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13943,7 +15497,7 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </Expanded> </Expression> <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13960,7 +15514,7 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </Expanded> </Expression> <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13981,7 +15535,7 @@ Message from section two v.size() == V </Original> <Expanded> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13989,7 +15543,7 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </Expanded> </Expression> <Section name="reserving bigger changes capacity but not size" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -13998,7 +15552,7 @@ Message from section two v.size() == V </Original> <Expanded> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14006,7 +15560,7 @@ Message from section two v.capacity() >= 2 * V </Original> <Expanded> - 12 >= 12 + 30 >= 30 </Expanded> </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> @@ -14016,7 +15570,7 @@ Message from section two v.size() == V </Original> <Expanded> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14024,7 +15578,7 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </Expanded> </Expression> <Section name="reserving smaller does not change size or capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14033,7 +15587,7 @@ Message from section two v.size() == V </Original> <Expanded> - 6 == 6 + 15 == 15 </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14041,640 +15595,740 @@ Message from section two v.capacity() >= V </Original> <Expanded> - 6 >= 6 + 15 >= 15 </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" > + <TestCase name="Test case with identical tags keeps just one" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags[0] == Tag( "tag1" ) + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <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="Testing checked-if" tags="[checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Testing checked-if 2" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.size() == V + true </Original> <Expanded> - 4 == 4 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Testing checked-if 3" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> - v.capacity() >= V + false </Original> <Expanded> - 4 >= 4 + false </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" > + <Failure filename="tests/<exe-name>/UsageTests/Misc.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> - v.size() == 2 * V + listingString, ContainsSubstring("[fakeTag]"s) </Original> <Expanded> - 8 == 8 + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "[fakeTag]" </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <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> - v.capacity() >= 2 * V + listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) </Original> <Expanded> - 8 >= 8 + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="1" 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" > + <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> - v.size() == 0 + listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) </Original> <Expanded> - 0 == 0 + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Listing listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> - v.capacity() >= V + listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) </Original> <Expanded> - 4 >= 4 + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) </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"/> + <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <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> - v.size() == V + testCase.isOpen() </Original> <Expanded> - 4 == 4 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + s1.isOpen() </Original> <Expanded> - 4 >= 4 + true </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" > + <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> - v.size() == V + s1.isSuccessfullyCompleted() </Original> <Expanded> - 4 == 4 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= 2 * V + testCase.isComplete() == false </Original> <Expanded> - 8 >= 8 + false == false </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + ctx.completedCycle() </Original> <Expanded> - 4 == 4 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + testCase.isSuccessfullyCompleted() </Original> <Expanded> - 4 >= 4 + true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="4" 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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + testCase.isOpen() </Original> <Expanded> - 5 == 5 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + s1.isOpen() </Original> <Expanded> - 5 >= 5 + true </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" > + <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> - v.size() == 2 * V + s1.isComplete() </Original> <Expanded> - 10 == 10 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= 2 * V + s1.isSuccessfullyCompleted() == false </Original> <Expanded> - 10 >= 10 + false == false </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == 0 + testCase.isComplete() == false </Original> <Expanded> - 0 == 0 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + ctx.completedCycle() </Original> <Expanded> - 5 >= 5 + true </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" > + <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> - v.capacity() == 0 + s1b.isOpen() == false </Original> <Expanded> - 0 == 0 + false == false </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <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="3" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0"/> </Section> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + testCase.isOpen() </Original> <Expanded> - 5 == 5 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + s1.isOpen() </Original> <Expanded> - 5 >= 5 + true </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" > + <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> - v.size() == V + s1.isComplete() </Original> <Expanded> - 5 == 5 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= 2 * V + s1.isSuccessfullyCompleted() == false </Original> <Expanded> - 10 >= 10 + false == false </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + testCase.isComplete() == false </Original> <Expanded> - 5 == 5 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + ctx.completedCycle() </Original> <Expanded> - 5 >= 5 + true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <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> - <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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + testCase.isOpen() </Original> <Expanded> - 15 == 15 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + s1.isOpen() </Original> <Expanded> - 15 >= 15 + true </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" > + <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> - v.size() == 2 * V + s2.isOpen() == false </Original> <Expanded> - 30 == 30 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= 2 * V + testCase.isComplete() == false </Original> <Expanded> - 30 >= 30 + false == false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <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>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.size() == V + testCase.isOpen() </Original> <Expanded> - 15 == 15 + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + s1.isOpen() </Original> <Expanded> - 15 >= 15 + true </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" > + <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> - v.size() == 0 + s2.isOpen() == false </Original> <Expanded> - 0 == 0 + false == false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - v.capacity() >= V + testCase.isComplete() == false </Original> <Expanded> - 15 >= 15 + false == false </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" > + <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> - v.capacity() == 0 + testCase2.isOpen() </Original> <Expanded> - 0 == 0 + true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <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="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"/> + <OverallResults successes="14" 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="Testing checked-if" tags="[checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Original> - true - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Original> - false - </Original> - <Expanded> - false - </Expanded> - </Expression> - <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Original> - true - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Original> - false - </Original> - <Expanded> - false - </Expanded> - </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Testing checked-if 2" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - true + testCase.isOpen() </Original> <Expanded> true </Expanded> </Expression> - <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Testing checked-if 3" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Original> - false - </Original> - <Expanded> - false - </Expanded> - </Expression> - <Failure filename="tests/<exe-name>/UsageTests/Misc.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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - 1 == 2 + s1.isOpen() </Original> <Expanded> - 1 == 2 + true </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" > + <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> - listingString, Contains("[fakeTag]"s) + s2.isOpen() </Original> <Expanded> - "All available tags: - 1 [fakeTag] -1 tag - -" contains: "[fakeTag]" + true </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - listingString, Contains("fake reporter"s) + s2.isComplete() </Original> <Expanded> - "Available reporters: - fake reporter: fake description - -" contains: "fake reporter" + true </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" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + s1.isComplete() == false </Original> <Expanded> - "All available test cases: - fake test name - [fakeTestTag] -1 test case - -" ( contains: "fake test name" and contains: "fakeTestTag" ) + false == false </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() + s1.isComplete() </Original> <Expanded> true @@ -14690,703 +16344,733 @@ Message from section two </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() + testCase.isComplete() </Original> <Expanded> true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0"/> </Section> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <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> - testCase.isOpen() + trim(std::string(no_whitespace)) == no_whitespace </Original> <Expanded> - true + "There is no extra whitespace here" +== +"There is no extra whitespace here" </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Original> - s1.isOpen() + trim(std::string(leading_whitespace)) == no_whitespace </Original> <Expanded> - true + "There is no extra whitespace here" +== +"There is no extra whitespace here" </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" > + <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> - s1.isComplete() + bptr->i == 3 </Original> <Expanded> - true + 3 == 3 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <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> - s1.isSuccessfullyCompleted() == false + bptr->i == 3 </Original> <Expanded> - false == false + 3 == 3 </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <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> - testCase.isComplete() == false + data, AllMatch(SizeIs(5)) </Original> <Expanded> - false == false + { { 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" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - ctx.completedCycle() + data, !AllMatch(Contains(0) && Contains(1)) </Original> <Expanded> - true + { { 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> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <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> - testCase.isSuccessfullyCompleted() == false + needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) </Original> <Expanded> - false == false + { 1, 2, 3, 4, 5 } all match matches undescribed predicate </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" > + <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> - testCase2.isOpen() + 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.m_derefed[0] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s1b.isOpen() == false + mocked.m_derefed[1] </Original> <Expanded> - false == false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - ctx.completedCycle() + mocked.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase.isComplete() + mocked.m_derefed[3] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase.isSuccessfullyCompleted() + mocked.m_derefed[4] </Original> <Expanded> true </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="6" 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" > + <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> - testCase2.isOpen() + mocked, !allMatch </Original> <Expanded> - true + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s1b.isOpen() == false + mocked.m_derefed[0] </Original> <Expanded> - false == false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s2.isOpen() + mocked.m_derefed[1] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - ctx.completedCycle() + mocked.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase.isComplete() + !(mocked.m_derefed[3]) </Original> <Expanded> - true + !false </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase.isSuccessfullyCompleted() + !(mocked.m_derefed[4]) </Original> <Expanded> - true + !false </Expanded> </Expression> <OverallResults successes="6" failures="0" expectedFailures="0"/> </Section> - <OverallResults successes="11" failures="0" expectedFailures="0"/> + <OverallResults successes="6" 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" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Usage of AllTrue 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" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase2.isOpen() + data, AllTrue() </Original> <Expanded> - true + { true, true, true, true, true } contains only true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s1b.isOpen() == false + data, AllTrue() </Original> <Expanded> - false == false + { } contains only true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s2b.isOpen() + data, !AllTrue() </Original> <Expanded> - true + { true, true, false, true, true } not contains only true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - ctx.completedCycle() == false + data, !AllTrue() </Original> <Expanded> - false == false + { false, false, false, false, false } not contains only true </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"/> + <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="1" 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" > + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AllTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - testCase2.isOpen() + data, !AllTrue() </Original> <Expanded> - true + { true, true, false, true, true } not contains only true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - s1b.isOpen() == false + data, !AllTrue() </Original> <Expanded> - false == false + { false, false, false, false, false } not contains only true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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> - s2b.isOpen() + mocked, AllTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains only true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - ctx.completedCycle() == false + mocked.m_derefed[1] </Original> <Expanded> - false == false + true </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> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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, !AllTrue() + </Original> + <Expanded> + { true, true, false, true, true } not contains only true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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="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" > + <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> - bptr->i == 3 + data, AnyMatch(SizeIs(5)) </Original> <Expanded> - 3 == 3 + { { 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> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <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="move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <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> - bptr->i == 3 + needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) </Original> <Expanded> - 3 == 3 + { 1, 2, 3, 4, 5 } any match matches undescribed predicate </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 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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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 AnyTrue 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" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { false, false, true, false, false } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { false, false, true, false, false } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" 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> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> <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 + mocked, AnyTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { false, false, false, false, true } contains at least one true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[0] + mocked.m_derefed[0] </Original> <Expanded> true @@ -15394,7 +17078,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[1] + mocked.m_derefed[1] </Original> <Expanded> true @@ -15402,7 +17086,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[2] + mocked.m_derefed[2] </Original> <Expanded> true @@ -15410,7 +17094,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[3] + mocked.m_derefed[3] </Original> <Expanded> true @@ -15418,7 +17102,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[4] + mocked.m_derefed[4] </Original> <Expanded> true @@ -15432,15 +17116,15 @@ There is no extra whitespace here <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 + mocked, AnyTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + { false, false, true, true, true } contains at least one true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[0] + mocked.m_derefed[0] </Original> <Expanded> true @@ -15448,7 +17132,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[1] + mocked.m_derefed[1] </Original> <Expanded> true @@ -15456,7 +17140,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[2] + mocked.m_derefed[2] </Original> <Expanded> true @@ -15464,7 +17148,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[3]) + !(mocked.m_derefed[3]) </Original> <Expanded> !false @@ -15472,7 +17156,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[4]) + !(mocked.m_derefed[4]) </Original> <Expanded> !false @@ -15484,22 +17168,22 @@ There is no extra whitespace here </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Usage of AnyMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <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, AnyMatch(SizeIs(5)) + 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 } } any match has size == 5 + { { 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, !AnyMatch(Contains(0) && Contains(10)) + 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 any match ( contains element 0 and contains element 10 ) + { { 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"/> @@ -15507,10 +17191,10 @@ There is no extra whitespace here <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; } ) ) + needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) </Original> <Expanded> - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate </Expanded> </Expression> <OverallResults successes="1" failures="0" expectedFailures="0"/> @@ -15519,15 +17203,15 @@ There is no extra whitespace here <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 + mocked, noneMatch </Original> <Expanded> - { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + { 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] + mocked.m_derefed[0] </Original> <Expanded> true @@ -15535,7 +17219,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[1] + mocked.m_derefed[1] </Original> <Expanded> true @@ -15543,7 +17227,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[2] + mocked.m_derefed[2] </Original> <Expanded> true @@ -15551,7 +17235,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[3] + mocked.m_derefed[3] </Original> <Expanded> true @@ -15559,7 +17243,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[4] + mocked.m_derefed[4] </Original> <Expanded> true @@ -15573,15 +17257,15 @@ There is no extra whitespace here <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 + mocked, !noneMatch </Original> <Expanded> - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 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] + mocked.m_derefed[0] </Original> <Expanded> true @@ -15589,7 +17273,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[1]) + !(mocked.m_derefed[1]) </Original> <Expanded> !false @@ -15597,7 +17281,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[2]) + !(mocked.m_derefed[2]) </Original> <Expanded> !false @@ -15605,7 +17289,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[3]) + !(mocked.m_derefed[3]) </Original> <Expanded> !false @@ -15613,7 +17297,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[4]) + !(mocked.m_derefed[4]) </Original> <Expanded> !false @@ -15625,50 +17309,118 @@ There is no extra whitespace here </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <TestCase name="Usage of NoneTrue 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 name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" 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> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> <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 + mocked, NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { false, false, false, false, false } contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[0] + mocked.m_derefed[0] </Original> <Expanded> true @@ -15676,7 +17428,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[1] + mocked.m_derefed[1] </Original> <Expanded> true @@ -15684,7 +17436,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[2] + mocked.m_derefed[2] </Original> <Expanded> true @@ -15692,7 +17444,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[3] + mocked.m_derefed[3] </Original> <Expanded> true @@ -15700,7 +17452,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[4] + mocked.m_derefed[4] </Original> <Expanded> true @@ -15714,39 +17466,39 @@ There is no extra whitespace here <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 + mocked, !NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { false, false, true, true, true } not contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.derefed[0] + mocked.m_derefed[0] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[1]) + mocked.m_derefed[1] </Original> <Expanded> - !false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[2]) + mocked.m_derefed[2] </Original> <Expanded> - !false + true </Expanded> </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[3]) + !(mocked.m_derefed[3]) </Original> <Expanded> !false @@ -15754,7 +17506,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.derefed[4]) + !(mocked.m_derefed[4]) </Original> <Expanded> !false @@ -16452,18 +18204,6 @@ There is no extra whitespace here <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> @@ -16592,7 +18332,7 @@ There is no extra whitespace here <TestCase name="XmlWriter writes boolean attributes as true/false" tags="[XML][XmlWriter]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Original> - stream.str(), Contains(R"(attr1="true")") && Contains(R"(attr2="false")") + stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") </Original> <Expanded> "<?xml version="1.0" encoding="UTF-8"?> @@ -16736,17 +18476,6 @@ There is no extra whitespace here </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" > @@ -17439,6 +19168,9 @@ There is no extra whitespace here loose text artifact <OverallResult success="false"/> </TestCase> + <TestCase name="is_unary_function" tags="[clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <OverallResult success="true"/> + </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 @@ -17674,6 +19406,17 @@ loose text artifact </Expression> <OverallResult success="false"/> </TestCase> + <TestCase name="makeStream recognizes %debug stream name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%debug" ) + </Original> + <Expanded> + Catch::makeStream( "%debug" ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </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" > @@ -18381,6 +20124,17 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%somestream" ) + </Original> + <Expanded> + Catch::makeStream( "%somestream" ) + </Expanded> + </Expression> + <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> @@ -18683,10 +20437,10 @@ loose text artifact <TestCase name="shortened hide tags are split apart" tags="[tags]" 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) + testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) </Original> <Expanded> - { ., magic-tag } ( Contains: magic-tag and Contains: . ) + { {?}, {?} } ( Contains: {?} and Contains: {?} ) </Expanded> </Expression> <OverallResult success="true"/> @@ -18761,6 +20515,33 @@ loose text artifact </Expression> <OverallResult success="false"/> </TestCase> + <TestCase name="startsWith" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + !(startsWith("", 'c')) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + startsWith(std::string("abc"), 'a') + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + startsWith("def"_catch_sr, 'd') + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </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" > @@ -18872,16 +20653,24 @@ loose text artifact </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" > + <TestCase name="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Original> - std::string( "first" ) == "second" + Catch::makeStream( "%stderr" )->isConsole() </Original> <Expanded> - "first" == "second" + true </Expanded> </Expression> - <OverallResult success="false"/> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%stdout" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> </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" > @@ -19298,19 +21087,6 @@ loose text artifact </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> @@ -19926,6 +21702,6 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1951" failures="146" expectedFailures="23"/> - <OverallResultsCases successes="276" failures="86" expectedFailures="6"/> + <OverallResults successes="2129" failures="143" expectedFailures="27"/> + <OverallResultsCases successes="304" failures="83" expectedFailures="7"/> </Catch2TestRun> diff --git a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a88f7de7f811b51093b4fdfa0ca12ece47a82fc --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -0,0 +1,21706 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Catch2TestRun name="<exe-name>" rng-seed="1" catch2-version="<version>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> + <TestCase name="# A test name that starts with a #" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <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="#2152 - ULP checks between differently signed values were wrong - double" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) + </Original> + <Expanded> + 0.0 is within 2 ULPs of -4.9406564584124654e-324 ([-1.4821969375237396e-323, 4.9406564584124654e-324]) + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) + </Original> + <Expanded> + 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#2152 - ULP checks between differently signed values were wrong - float" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) + </Original> + <Expanded> + 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) + </Original> + <Expanded> + 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) + </Expanded> + </Expression> + <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 Catch2" 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_after == 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="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "", "" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "", "a" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "a", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "a", "A" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "A", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + eq( "A", "A" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "a", "b" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(eq( "a", "B" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="CaseInsensitiveLess is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "", "a" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(lt( "a", "a" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + !(lt( "", "" )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "a", "b" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "a", "B" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "A", "b" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > + <Original> + lt( "A", "B" ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" 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="Clara::Opt supports accept-many lambdas" tags="[clara][opt]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Section name="Parsing fails on multiple options without accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + !(parse_result) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Parsing succeeds on multiple options with accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + parse_result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + res == std::vector<std::string>{ "aaa", "bbb" } + </Original> + <Expanded> + { "aaa", "bbb" } == { "aaa", "bbb" } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="ColourGuard behaviour" tags="[console-colours]" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Section name="ColourGuard is disengaged by default" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="ColourGuard is engaged by op<<" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" + </Original> + <Expanded> + "1 +Using code: 2 +2 +Using code: 0 +3 +" +== +"1 +Using code: 2 +2 +Using code: 0 +3 +" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="ColourGuard can be engaged explicitly" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > + <Original> + streamWrapper.str() == "Using code: 2\nA\nB\nUsing code: 0\nC\n" + </Original> + <Expanded> + "Using code: 2 +A +B +Using code: 0 +C +" +== +"Using code: 2 +A +B +Using code: 0 +C +" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" 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 (string) "1" + </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 (string) "1" + </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 (string) "1" + </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 (string) "1" + </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 (string) "1" 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 (string) "1" 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 (string) "1" 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(), ContainsSubstring( "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(), ContainsSubstring( "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="Cout stream properly declares it writes to stdout" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "-" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <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="Empty stream name opens cout stream" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) + </Original> + <Expanded> + Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) + </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(), ContainsSubstring( "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(), ContainsSubstring( "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> + -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="8" 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" > + <Section name="Simple filtering" 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> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Filter out multiple elements at the start and 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() == 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> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Throws on construction if it can't get initial element" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <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> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + </Original> + <Expanded> + filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" 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="Hashers with different seed produce different hash with same test case" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h1( dummy ) != h2( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +!= +130711275 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashers with same seed produce same hash" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h1( dummy ) == h2( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashing different test cases produces different result" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Section name="Different test name" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2903002874 (0x<hex digits>) +!= +2668622104 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different classname" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2673152918 (0x<hex digits>) +!= +3916075712 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different tags" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy1 ) != h( dummy2 ) + </Original> + <Expanded> + 2074929312 (0x<hex digits>) +!= +3429949824 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Hashing test case produces same hash across multiple calls" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > + <Original> + h( dummy ) == h( dummy ) + </Original> + <Expanded> + 3422778688 (0x<hex digits>) +== +3422778688 (0x<hex digits>) + </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(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "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(), !ContainsSubstring( "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(), !ContainsSubstring( "substring" ) + </Original> + <Expanded> + "this string contains 'abc' as a substring" not contains: "substring" + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Mayfail test case with nested sections" tags="[!mayfail]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </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="Multireporter calls reporters and listeners in correct order" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + records == expected + </Original> + <Expanded> + { "Hello", "world", "Goodbye", "world" } +== +{ "Hello", "world", "Goodbye", "world" } + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Multireporter updates ReporterPreferences properly" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Section name="Adding listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Section name="Adding reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldRedirectStdOut == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + multiReporter.getPreferences().shouldReportAllAssertions == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </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="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="shard-count" 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", "--shard-count=8" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.shardCount == 8 + </Original> + <Expanded> + 8 == 8 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(result) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), ContainsSubstring("Shard count must be a positive number") + </Original> + <Expanded> + "Shard count must be a positive number" contains: "Shard count must be a positive number" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(result) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), ContainsSubstring("Shard count must be a positive number") + </Original> + <Expanded> + "Shard count must be a positive number" contains: "Shard count must be a positive number" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="shard-index" 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", "--shard-index=2" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.shardIndex == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(result) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") + </Original> + <Expanded> + "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shard index 0 is accepted" 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", "--shard-index=0" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.shardIndex == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "-w", "NoAssertions" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == WarnAbout::NoAssertions + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="NoTests is no longer supported" 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", "-w", "NoTests" } )) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Combining multiple warnings" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" 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.reporterSpecifications.empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(cfg.hasTestFilters()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getReporterSpecs().size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getProcessedReporterSpecs().size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <OverallResults successes="11" 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" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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="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(), ContainsSubstring("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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="With output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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="With Windows-like absolute path as output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Info> + result.errorMessage() := "" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } + </Original> + <Expanded> + { {?} } == { {?} } + </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="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="All with output files" 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::out=output.xml", "-r", "junit::out=output-junit.xml" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } + </Original> + <Expanded> + { {?}, {?} } == { {?}, {?} } + </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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Mixed output files and default output" 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::out=output.xml", "-r", "console" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } + </Original> + <Expanded> + { {?}, {?} } == { {?}, {?} } + </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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="cannot have multiple reporters with default output" 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(), ContainsSubstring("Only one reporter may have unspecified output file.") + </Original> + <Expanded> + "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." + </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="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(), ContainsSubstring("convert") && ContainsSubstring("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(), ContainsSubstring("never") && ContainsSubstring("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.defaultOutputFilename == "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.defaultOutputFilename == "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.defaultColourMode == ColourMode::PlatformDefault + </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", "--colour-mode", "default" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.defaultColourMode == ColourMode::PlatformDefault + </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", "--colour-mode", "ansi"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.defaultColourMode == ColourMode::ANSI + </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", "--colour-mode", "none"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.defaultColourMode == ColourMode::None + </Original> + <Expanded> + 3 == 3 + </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(), ContainsSubstring( "colour mode must be one of" ) + </Original> + <Expanded> + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is 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="Random seed generation accepts known methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(method) + </Original> + <Expanded> + Catch::generateRandomSeed(method) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Random seed generation reports unknown methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + </Original> + <Expanded> + Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) + </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="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" + </Original> + <Expanded> + "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" + </Expanded> + </Expression> + <OverallResult success="true"/> + </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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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, ContainsSubstring("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, ContainsSubstring("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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" tags="[console-reporter]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <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(), ContainsSubstring( "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(), ContainsSubstring( "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(), ContainsSubstring( "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(), ContainsSubstring( "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> + std::strcmp( empty.data(), "" ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="3" 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> + std::strcmp( rawChars, "hello" ) == 0 + </Original> + <Expanded> + 0 == 0 + </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="4" 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_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.data() + </Original> + <Expanded> + original.data() + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Copy construction is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.begin() == copy.begin() + </Original> + <Expanded> + "original string" == "original string" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Copy assignment is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.begin() == copy.begin() + </Original> + <Expanded> + "original string" == "original string" + </Expanded> + </Expression> + <OverallResults successes="1" 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.data(), "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.data(), "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="12" failures="0" expectedFailures="0"/> + </Section> + <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" 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( with_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s + </Original> + <Expanded> + ""abc"" == ""abc"" + </Expanded> + </Expression> + <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, ContainsSubstring( "[@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, ContainsSubstring( "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, ContainsSubstring( "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, ContainsSubstring( "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="Tags with spaces and non-alphanumerical characters are accepted" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) + </Original> + <Expanded> + { {?}, {?} } ( Contains: {?} and Contains: {?} ) + </Expanded> + </Expression> + <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 identical tags keeps just one" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testCase.tags[0] == Tag( "tag1" ) + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <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="Testing checked-if" tags="[checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Testing checked-if 2" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Testing checked-if 3" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Failure filename="tests/<exe-name>/UsageTests/Misc.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, ContainsSubstring("[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, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) + </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, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "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> + <Section name="Listing listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) + </Original> + <Expanded> + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) + </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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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 AllTrue 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" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AllTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AllTrue() + </Original> + <Expanded> + { } contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AllTrue() + </Original> + <Expanded> + { true, true, false, true, true } not contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AllTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AllTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AllTrue() + </Original> + <Expanded> + { true, true, false, true, true } not contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AllTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains only true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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, AllTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains only true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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, !AllTrue() + </Original> + <Expanded> + { true, true, false, true, true } not contains only true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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 AnyTrue 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" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { false, false, true, false, false } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { true, true, true, true, true } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyTrue() + </Original> + <Expanded> + { false, false, true, false, false } contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyTrue() + </Original> + <Expanded> + { false, false, false, false, false } not contains at least one true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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, AnyTrue() + </Original> + <Expanded> + { false, false, false, false, true } contains at least one true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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, AnyTrue() + </Original> + <Expanded> + { false, false, true, true, true } contains at least one true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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 NoneTrue 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" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <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, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_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, !NoneTrue() + </Original> + <Expanded> + { false, false, true, true, true } not contains no true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_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="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="XmlWriter writes boolean attributes as true/false" tags="[XML][XmlWriter]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Original> + stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +<Element1 attr1="true" attr2="false"/> +" ( contains: "attr1="true"" and contains: "attr2="false"" ) + </Expanded> + </Expression> + <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="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="convertToBits" tags="[conversion][floating-point]" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( 0.f ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( -0.f ) == ( 1ULL << 31 ) + </Original> + <Expanded> + 2147483648 (0x<hex digits>) +== +2147483648 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( 0. ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( -0. ) == ( 1ULL << 63 ) + </Original> + <Expanded> + 9223372036854775808 (0x<hex digits>) +== +9223372036854775808 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > + <Original> + convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="empty tags are not allowed" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) + </Original> + <Expanded> + Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) + </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" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="is_unary_function" tags="[clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <OverallResult success="true"/> + </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="makeStream recognizes %debug stream name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%debug" ) + </Original> + <Expanded> + Catch::makeStream( "%debug" ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </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="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%somestream" ) + </Original> + <Expanded> + Catch::makeStream( "%somestream" ) + </Expanded> + </Expression> + <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" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) + </Original> + <Expanded> + { {?}, {?} } ( Contains: {?} 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="startsWith" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + !(startsWith("", 'c')) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + startsWith(std::string("abc"), 'a') + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + startsWith("def"_catch_sr, 'd') + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </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="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%stderr" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > + <Original> + Catch::makeStream( "%stdout" )->isConsole() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </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="tags with dots in later positions are not parsed as hidden" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags[0].original == "magic.tag"_catch_sr + </Original> + <Expanded> + magic.tag == magic.tag + </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<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="2129" failures="143" expectedFailures="27"/> + <OverallResultsCases successes="304" failures="83" expectedFailures="7"/> +</Catch2TestRun> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp index 1259e7ffe5dadc614fffe103911f5a730e7861a1..2cbf05b8ea300c1d2e153286a04e45eac9b1bba9 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp @@ -1,22 +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_test_macros.hpp> #include <catch2/internal/catch_clara.hpp> #include <string> +TEST_CASE("is_unary_function", "[clara][compilation]") { + auto unary1 = [](int) {}; + auto unary2 = [](std::string const&) {}; + auto const unary3 = [](std::string const&) {}; + auto unary4 = [](int) { return 42; }; + void unary5(char); + double unary6(long); + + double binary1(long, int); + auto binary2 = [](int, char) {}; + auto nullary1 = []() {}; + auto nullary2 = []() {return 42;}; + + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value); + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value); + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value); + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary4)>::value); + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary5)>::value); + STATIC_REQUIRE(Catch::Clara::Detail::is_unary_function<decltype(unary6)>::value); + + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<decltype(binary1)>::value); + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<decltype(binary2)>::value); + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<decltype(nullary1)>::value); + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<decltype(nullary2)>::value); + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<int>::value); + STATIC_REQUIRE_FALSE(Catch::Clara::Detail::is_unary_function<std::string const&>::value); +} + + 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"); } + +TEST_CASE("Clara::Opt supports accept-many lambdas", "[clara][opt]") { + using namespace Catch::Clara; + std::vector<std::string> res; + const auto push_to_res = [&](std::string const& s) { + res.push_back(s); + return ParserResult::ok( ParseResultType::Matched ); + }; + + SECTION("Parsing fails on multiple options without accept_many") { + auto p = Parser() | Opt(push_to_res, "value")["-o"]; + auto parse_result = p.parse( Args{ "UnitTest", "-o", "aaa", "-o", "bbb" } ); + CHECK_FALSE(parse_result); + } + SECTION("Parsing succeeds on multiple options with accept_many") { + auto p = Parser() | Opt(accept_many, push_to_res, "value")["-o"]; + auto parse_result = p.parse( Args{ "UnitTest", "-o", "aaa", "-o", "bbb" } ); + CHECK(parse_result); + CHECK(res == std::vector<std::string>{ "aaa", "bbb" }); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index e8bf6e5f67a0f227ed00c40947c370e45d476d3e..e7b0c9c1634f94a2734882cac7f44ea8d5ae23d0 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -1,20 +1,22 @@ -/* - * 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) - */ +// 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/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_user_config.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> +#include <catch2/internal/catch_compiler_capabilities.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); } @@ -345,10 +347,29 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" CHECK(config.shouldDebugBreak == false); CHECK(config.abortAfter == -1); CHECK(config.noThrow == false); - CHECK(config.reporterName == "console"); + CHECK( config.reporterSpecifications.empty() ); Catch::Config cfg(config); CHECK_FALSE(cfg.hasTestFilters()); + + // The Config is responsible for mixing in the default reporter + auto expectedReporter = +#if defined( CATCH_CONFIG_DEFAULT_REPORTER ) + CATCH_CONFIG_DEFAULT_REPORTER +#else + "console" +#endif + ; + + CHECK( cfg.getReporterSpecs().size() == 1 ); + CHECK( cfg.getReporterSpecs()[0] == + Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ); + CHECK( cfg.getProcessedReporterSpecs().size() == 1 ); + CHECK( cfg.getProcessedReporterSpecs()[0] == + Catch::ProcessedReporterSpec{ expectedReporter, + std::string{}, + Catch::ColourMode::PlatformDefault, + {} } ); } SECTION("test lists") { @@ -384,29 +405,70 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" } SECTION("reporter") { + using vec_Specs = std::vector<Catch::ReporterSpec>; + using namespace std::string_literals; SECTION("-r/console") { - CHECK(cli.parse({"test", "-r", "console"})); + auto result = cli.parse({"test", "-r", "console"}); + CAPTURE(result.errorMessage()); + CHECK(result); - REQUIRE(config.reporterName == "console"); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "console", {}, {}, {} } } ); } SECTION("-r/xml") { - CHECK(cli.parse({"test", "-r", "xml"})); + auto result = cli.parse({"test", "-r", "xml"}); + CAPTURE(result.errorMessage()); + CHECK(result); - REQUIRE(config.reporterName == "xml"); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "xml", {}, {}, {} } } ); } SECTION("--reporter/junit") { - CHECK(cli.parse({"test", "--reporter", "junit"})); + auto result = cli.parse({"test", "--reporter", "junit"}); + CAPTURE(result.errorMessage()); + CHECK(result); - REQUIRE(config.reporterName == "junit"); - } - SECTION("Only one reporter is accepted") { - REQUIRE_FALSE(cli.parse({ "test", "-r", "xml", "-r", "junit" })); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "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")); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Unrecognized reporter")); + } + SECTION("With output file") { + auto result = cli.parse({ "test", "-r", "console::out=out.txt" }); + CAPTURE(result.errorMessage()); + CHECK(result); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "console", "out.txt"s, {}, {} } } ); + } + SECTION("With Windows-like absolute path as output file") { + auto result = cli.parse({ "test", "-r", "console::out=C:\\Temp\\out.txt" }); + CAPTURE(result.errorMessage()); + CHECK(result); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ); + } + SECTION("Multiple reporters") { + SECTION("All with output files") { + CHECK(cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" })); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "xml", "output.xml"s, {}, {} }, + { "junit", "output-junit.xml"s, {}, {} } } ); + } + SECTION("Mixed output files and default output") { + CHECK(cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" })); + REQUIRE( config.reporterSpecifications == + vec_Specs{ { "xml", "output.xml"s, {}, {} }, + { "console", {}, {}, {} } } ); + } + SECTION("cannot have multiple reporters with default output") { + auto result = cli.parse({ "test", "-r", "console", "-r", "xml::out=output.xml", "-r", "junit" }); + CHECK(!result); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.")); + } } } @@ -438,7 +500,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" SECTION("-x must be numeric") { auto result = cli.parse({"test", "-x", "oops"}); CHECK(!result); - REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops")); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops")); } SECTION("wait-for-keypress") { @@ -460,7 +522,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" CHECK(!result); #ifndef CATCH_CONFIG_DISABLE_MATCHERS - REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both")); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both")); #endif } } @@ -483,12 +545,12 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" SECTION("-o filename") { CHECK(cli.parse({"test", "-o", "filename.ext"})); - REQUIRE(config.outputFilename == "filename.ext"); + REQUIRE(config.defaultOutputFilename == "filename.ext"); } SECTION("--out") { CHECK(cli.parse({"test", "--out", "filename.ext"})); - REQUIRE(config.outputFilename == "filename.ext"); + REQUIRE(config.defaultOutputFilename == "filename.ext"); } } @@ -505,36 +567,36 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" SECTION( "use-colour") { - using Catch::UseColour; + using Catch::ColourMode; SECTION( "without option" ) { CHECK(cli.parse({"test"})); - REQUIRE( config.useColour == UseColour::Auto ); + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ); } SECTION( "auto" ) { - CHECK(cli.parse({"test", "--use-colour", "auto"})); + CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ); - REQUIRE( config.useColour == UseColour::Auto ); + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ); } SECTION( "yes" ) { - CHECK(cli.parse({"test", "--use-colour", "yes"})); + CHECK(cli.parse({"test", "--colour-mode", "ansi"})); - REQUIRE( config.useColour == UseColour::Yes ); + REQUIRE( config.defaultColourMode == ColourMode::ANSI ); } SECTION( "no" ) { - CHECK(cli.parse({"test", "--use-colour", "no"})); + CHECK(cli.parse({"test", "--colour-mode", "none"})); - REQUIRE( config.useColour == UseColour::No ); + REQUIRE( config.defaultColourMode == ColourMode::None ); } SECTION( "error" ) { - auto result = cli.parse({"test", "--use-colour", "wrong"}); + auto result = cli.parse({"test", "--colour-mode", "wrong"}); CHECK( !result ); - CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) ); + CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) ); } } @@ -571,7 +633,107 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" } } +TEST_CASE("Parsing sharding-related cli flags", "[sharding]") { + using namespace Catch::Matchers; + + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser(config); + + SECTION("shard-count") { + CHECK(cli.parse({ "test", "--shard-count=8" })); + + REQUIRE(config.shardCount == 8); + } + + SECTION("Negative shard count reports error") { + auto result = cli.parse({ "test", "--shard-count=-1" }); + + CHECK_FALSE(result); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number")); + } + + SECTION("Zero shard count reports error") { + auto result = cli.parse({ "test", "--shard-count=0" }); + + CHECK_FALSE(result); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number")); + } + + SECTION("shard-index") { + CHECK(cli.parse({ "test", "--shard-index=2" })); + + REQUIRE(config.shardIndex == 2); + } + + SECTION("Negative shard index reports error") { + auto result = cli.parse({ "test", "--shard-index=-12" }); + + CHECK_FALSE(result); + REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number")); + } + + SECTION("Shard index 0 is accepted") { + CHECK(cli.parse({ "test", "--shard-index=0" })); + + REQUIRE(config.shardIndex == 0); + } + +} + +TEST_CASE( "Parsing warnings", "[cli][warnings]" ) { + using Catch::WarnAbout; + + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser( config ); + + SECTION( "NoAssertions" ) { + REQUIRE(cli.parse( { "test", "-w", "NoAssertions" } )); + REQUIRE( config.warnings == WarnAbout::NoAssertions ); + } + SECTION( "NoTests is no longer supported" ) { + REQUIRE_FALSE(cli.parse( { "test", "-w", "NoTests" } )); + } + SECTION( "Combining multiple warnings" ) { + REQUIRE( cli.parse( { "test", + "--warn", "NoAssertions", + "--warn", "UnmatchedTestSpec" } ) ); + + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ); + } +} + TEST_CASE("Test with special, characters \"in name", "[cli][regression]") { // This test case succeeds if we can invoke it from the CLI SUCCEED(); } + +TEST_CASE("Various suspicious reporter specs are rejected", + "[cli][reporter-spec][approvals]") { + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser( config ); + + auto spec = GENERATE( as<std::string>{}, + "", + "::console", + "console::", + "console::some-file::", + "::console::some-file::" ); + CAPTURE( spec ); + + auto result = cli.parse( { "test", "--reporter", spec } ); + REQUIRE_FALSE( result ); +} + +TEST_CASE("Win32 colour implementation is compile-time optional", + "[approvals][cli][colours]") { + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser( config ); + + auto result = cli.parse( { "test", "--colour-mode", "win32" } ); + +#if defined( CATCH_CONFIG_COLOUR_WIN32 ) + REQUIRE( result ); +#else + REQUIRE_FALSE( result ); +#endif +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b8a543903748b580796c59222855fc1f96f6c0ec --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.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/catch_test_macros.hpp> +#include <catch2/internal/catch_reporter_spec_parser.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> + +TEST_CASE("Reporter spec splitting", "[reporter-spec][cli][approvals]") { + using Catch::Detail::splitReporterSpec; + using Catch::Matchers::Equals; + using namespace std::string_literals; + + SECTION("Various edge cases") { + REQUIRE_THAT( splitReporterSpec( "" ), + Equals( std::vector<std::string>{ ""s } ) ); + REQUIRE_THAT( splitReporterSpec( "::" ), + Equals( std::vector<std::string>{ "", "" } ) ); + REQUIRE_THAT( splitReporterSpec( "::rep" ), + Equals( std::vector<std::string>{ "", "rep" } ) ); + REQUIRE_THAT( splitReporterSpec( "rep::" ), + Equals( std::vector<std::string>{ "rep", "" } ) ); + + } + + SECTION("Validish specs") { + REQUIRE_THAT( splitReporterSpec( "newReporter" ), + Equals( std::vector<std::string>{ "newReporter"s } ) ); + REQUIRE_THAT( + splitReporterSpec( "foo-reporter::key1=value1::key2=value with " + "space::key with space=some-value" ), + Equals( + std::vector<std::string>{ "foo-reporter"s, + "key1=value1"s, + "key2=value with space"s, + "key with space=some-value"s } ) ); + REQUIRE_THAT( + splitReporterSpec( "spaced reporter name::key:key=value:value" ), + Equals( std::vector<std::string>{ "spaced reporter name"s, + "key:key=value:value"s } ) ); + } +} + +TEST_CASE( "Parsing colour mode", "[cli][colour][approvals]" ) { + using Catch::Detail::stringToColourMode; + using Catch::ColourMode; + SECTION("Valid strings") { + REQUIRE( stringToColourMode( "none" ) == ColourMode::None ); + REQUIRE( stringToColourMode( "ansi" ) == ColourMode::ANSI ); + REQUIRE( stringToColourMode( "win32" ) == ColourMode::Win32 ); + REQUIRE( stringToColourMode( "default" ) == + ColourMode::PlatformDefault ); + } + SECTION("Wrong strings") { + REQUIRE_FALSE( stringToColourMode( "NONE" ) ); + REQUIRE_FALSE( stringToColourMode( "-" ) ); + REQUIRE_FALSE( stringToColourMode( "asdbjsdb kasbd" ) ); + } +} + + +TEST_CASE("Parsing reporter specs", "[cli][reporter-spec][approvals]") { + using Catch::parseReporterSpec; + using Catch::ReporterSpec; + using namespace std::string_literals; + + SECTION( "Correct specs" ) { + REQUIRE( parseReporterSpec( "someReporter" ) == + ReporterSpec( "someReporter"s, {}, {}, {} ) ); + REQUIRE( parseReporterSpec( "otherReporter::Xk=v::out=c:\\blah" ) == + ReporterSpec( + "otherReporter"s, "c:\\blah"s, {}, { { "Xk"s, "v"s } } ) ); + REQUIRE( parseReporterSpec( "diffReporter::Xk1=v1::Xk2==v2" ) == + ReporterSpec( "diffReporter", + {}, + {}, + { { "Xk1"s, "v1"s }, { "Xk2"s, "=v2"s } } ) ); + REQUIRE( parseReporterSpec( + "Foo:bar:reporter::colour-mode=ansi::Xk 1=v 1::Xk2=v:3" ) == + ReporterSpec( "Foo:bar:reporter", + {}, + Catch::ColourMode::ANSI, + { { "Xk 1"s, "v 1"s }, { "Xk2"s, "v:3"s } } ) ); + } + + SECTION( "Bad specs" ) { + REQUIRE_FALSE( parseReporterSpec( "::" ) ); + // Unknown Catch2 arg (should be "out") + REQUIRE_FALSE( parseReporterSpec( "reporter::output=filename" ) ); + // Wrong colour spec + REQUIRE_FALSE( parseReporterSpec( "reporter::colour-mode=custom" ) ); + // Duplicated colour spec + REQUIRE_FALSE( parseReporterSpec( "reporter::colour-mode=ansi::colour-mode=ansi" ) ); + // Duplicated out arg + REQUIRE_FALSE( parseReporterSpec( "reporter::out=f.txt::out=z.txt" ) ); + // Duplicated custom arg + REQUIRE_FALSE( parseReporterSpec( "reporter::Xa=foo::Xa=bar" ) ); + // Empty key + REQUIRE_FALSE( parseReporterSpec( "reporter::X=foo" ) ); + REQUIRE_FALSE( parseReporterSpec( "reporter::=foo" ) ); + // Empty value + REQUIRE_FALSE( parseReporterSpec( "reporter::Xa=" ) ); + // non-key value later field + REQUIRE_FALSE( parseReporterSpec( "reporter::Xab" ) ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83501cae51f155a0a5e7630ee84ebe1395eefdc4 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp @@ -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 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_istream.hpp> + +#include <sstream> + +namespace { + class TestColourImpl : public Catch::ColourImpl { + using Catch::ColourImpl::ColourImpl; + // Inherited via ColourImpl + void use( Catch::Colour::Code colourCode ) const override { + m_stream->stream() << "Using code: " << colourCode << '\n'; + } + }; + + class TestStringStream : public Catch::IStream { + std::stringstream m_stream; + public: + std::ostream& stream() override { + return m_stream; + } + + std::string str() const { return m_stream.str(); } + }; +} + +TEST_CASE("ColourGuard behaviour", "[console-colours]") { + TestStringStream streamWrapper; + TestColourImpl colourImpl( &streamWrapper ); + auto& stream = streamWrapper.stream(); + + SECTION("ColourGuard is disengaged by default") { + { auto guard = colourImpl.guardColour( Catch::Colour::Red ); } + + REQUIRE( streamWrapper.str().empty() ); + } + + SECTION("ColourGuard is engaged by op<<") { + stream << "1\n" << colourImpl.guardColour( Catch::Colour::Red ) << "2\n"; + stream << "3\n"; + + REQUIRE( streamWrapper.str() == "1\nUsing code: 2\n2\nUsing code: 0\n3\n" ); + } + + SECTION("ColourGuard can be engaged explicitly") { + { + auto guard = + colourImpl.guardColour( Catch::Colour::Red ).engage( stream ); + stream << "A\n" + << "B\n"; + } + stream << "C\n"; + REQUIRE( streamWrapper.str() == + "Using code: 2\nA\nB\nUsing code: 0\nC\n" ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp index bddb0d5b5f9d9cd89a70ee4ccd4b78f0df9df995..987910a948abe74947e07279b4b4bdf940988c11 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp @@ -1,10 +1,15 @@ -/* - * 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) - */ + +// 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_enforce.hpp> +#include <catch2/internal/catch_case_insensitive_comparisons.hpp> +#include <catch2/internal/catch_optional.hpp> #if defined(_MSC_VER) #pragma warning(push) @@ -22,3 +27,62 @@ TEST_CASE("Check that our error handling macros throw the right exceptions", "[! #if defined(_MSC_VER) #pragma warning(pop) // unreachable code in the macro expansions #endif + +TEST_CASE("CaseInsensitiveLess is case insensitive", "[comparisons][string-case]") { + Catch::Detail::CaseInsensitiveLess lt; + SECTION( "Degenerate cases" ) { + REQUIRE( lt( "", "a" ) ); + REQUIRE_FALSE( lt( "a", "a" ) ); + REQUIRE_FALSE( lt( "", "" ) ); + } + SECTION("Plain comparisons") { + REQUIRE( lt( "a", "b" ) ); + REQUIRE( lt( "a", "B" ) ); + REQUIRE( lt( "A", "b" ) ); + REQUIRE( lt( "A", "B" ) ); + } +} + +TEST_CASE( "CaseInsensitiveEqualsTo is case insensitive", + "[comparisons][string-case]" ) { + Catch::Detail::CaseInsensitiveEqualTo eq; + SECTION( "Degenerate cases" ) { + REQUIRE( eq( "", "" ) ); + REQUIRE_FALSE( eq( "", "a" ) ); + } + SECTION( "Plain comparisons" ) { + REQUIRE( eq( "a", "a" ) ); + REQUIRE( eq( "a", "A" ) ); + REQUIRE( eq( "A", "a" ) ); + REQUIRE( eq( "A", "A" ) ); + REQUIRE_FALSE( eq( "a", "b" ) ); + REQUIRE_FALSE( eq( "a", "B" ) ); + } +} + +TEST_CASE("Optional comparison ops", "[optional][approvals]") { + using Catch::Optional; + + Optional<int> a, b; + + SECTION( "Empty optionals are equal" ) { + REQUIRE( a == b ); + REQUIRE_FALSE( a != b ); + } + SECTION( "Empty and non-empty optionals are never equal" ) { + a = 1; + REQUIRE_FALSE( a == b ); + REQUIRE( a != b ); + } + SECTION( + "non-empty optionals are equal if the contained elements are equal") { + a = 1; + b = 2; + REQUIRE( a != b ); + REQUIRE_FALSE( a == b ); + + a = 2; + REQUIRE( a == b ); + REQUIRE_FALSE( a != b ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp index 7a1ca110a265270c35125c96a8281bad23f8577d..242a89670d2126d82fcead01c05f006212e3c51a 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp @@ -1,3 +1,11 @@ + +// 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_template_test_macros.hpp> #include <catch2/internal/catch_floating_point_helpers.hpp> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index 848bb1d9e0803981d2f4c78e91578f6f8264a332..3ad20453c59ca1b15f4a6d0fd80732dfb430b656 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -1,3 +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 + +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + #include <catch2/catch_approx.hpp> #include <catch2/catch_test_macros.hpp> #include <catch2/generators/catch_generator_exception.hpp> @@ -50,14 +62,27 @@ TEST_CASE("Generators internals", "[generators][internals]") { } 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()); + SECTION("Simple filtering") { + 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()); + } + SECTION("Filter out multiple elements at the start and end") { + auto gen = filter([](int i) { return i != 2; }, values({ 2, 2, 1, 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("Throws on construction if it can't get initial element") { + REQUIRE_THROWS_AS(filter([](int) { return false; }, value(1)), Catch::GeneratorException); + REQUIRE_THROWS_AS( + filter([](int) { return false; }, values({ 1, 2, 3 })), + Catch::GeneratorException); + } } SECTION("Take generator") { SECTION("Take less") { @@ -388,3 +413,124 @@ TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") { auto str = GENERATE("abc", "def", "gh"); STATIC_REQUIRE(std::is_same<decltype(str), const char*>::value); } + +TEST_CASE("Generators count returned elements", "[generators][approvals]") { + auto generator = Catch::Generators::FixedValuesGenerator<int>( { 1, 2, 3 } ); + REQUIRE( generator.currentElementIndex() == 0 ); + REQUIRE( generator.countedNext() ); + REQUIRE( generator.currentElementIndex() == 1 ); + REQUIRE( generator.countedNext() ); + REQUIRE( generator.currentElementIndex() == 2 ); + REQUIRE_FALSE( generator.countedNext() ); + REQUIRE( generator.currentElementIndex() == 2 ); +} + +TEST_CASE( "Generators can stringify their elements", + "[generators][approvals]" ) { + auto generator = + Catch::Generators::FixedValuesGenerator<int>( { 1, 2, 3 } ); + + REQUIRE( generator.currentElementAsString() == "1"_catch_sr ); + REQUIRE( generator.countedNext() ); + REQUIRE( generator.currentElementAsString() == "2"_catch_sr ); + REQUIRE( generator.countedNext() ); + REQUIRE( generator.currentElementAsString() == "3"_catch_sr ); +} + +namespace { + class CustomStringifyGenerator + : public Catch::Generators::IGenerator<bool> { + bool m_first = true; + + std::string stringifyImpl() const override { + return m_first ? "first" : "second"; + } + + bool next() override { + if ( m_first ) { + m_first = false; + return true; + } + return false; + } + + public: + bool const& get() const override; + }; + + // Avoids -Wweak-vtables + bool const& CustomStringifyGenerator::get() const { return m_first; } +} // namespace + +TEST_CASE( "Generators can override element stringification", + "[generators][approvals]" ) { + CustomStringifyGenerator generator; + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + REQUIRE( generator.countedNext() ); + REQUIRE( generator.currentElementAsString() == "second"_catch_sr ); +} + +namespace { + class StringifyCountingGenerator + : public Catch::Generators::IGenerator<bool> { + bool m_first = true; + mutable size_t m_stringificationCalls = 0; + + std::string stringifyImpl() const override { + ++m_stringificationCalls; + return m_first ? "first" : "second"; + } + + bool next() override { + if ( m_first ) { + m_first = false; + return true; + } + return false; + } + + public: + + bool const& get() const override; + size_t stringificationCalls() const { return m_stringificationCalls; } + }; + + // Avoids -Wweak-vtables + bool const& StringifyCountingGenerator::get() const { return m_first; } + +} // namespace + +TEST_CASE( "Generator element stringification is cached", + "[generators][approvals]" ) { + StringifyCountingGenerator generator; + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + REQUIRE( generator.currentElementAsString() == "first"_catch_sr ); + + REQUIRE( generator.stringificationCalls() == 1 ); +} + +TEST_CASE( "Random generators can be seeded", "[generators][approvals]" ) { + SECTION( "Integer generator" ) { + using Catch::Generators::RandomIntegerGenerator; + RandomIntegerGenerator<int> rng1( 0, 100, 0x1234 ), + rng2( 0, 100, 0x1234 ); + + for ( size_t i = 0; i < 10; ++i ) { + REQUIRE( rng1.get() == rng2.get() ); + rng1.next(); rng2.next(); + } + } + SECTION("Float generator") { + using Catch::Generators::RandomFloatingGenerator; + RandomFloatingGenerator<double> rng1( 0., 100., 0x1234 ), + rng2( 0., 100., 0x1234 ); + for ( size_t i = 0; i < 10; ++i ) { + REQUIRE( rng1.get() == rng2.get() ); + rng1.next(); + rng2.next(); + } + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp index 19fa8f9531999931a51e34b5d7bd6139d1d17410..f51f7bd9d4dd5d4d24747ba6b9443a6faeb45f82 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp @@ -1,10 +1,17 @@ -/* - * 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) - */ + +// 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. + + +#if defined( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + #include <catch2/catch_test_macros.hpp> #include <catch2/catch_approx.hpp> @@ -282,8 +289,8 @@ TEST_CASE("analyse", "[approvals][benchmark]") { } 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.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); diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp index c56adc5e92f5b3aa0e0a3c246fe1d80792f52a92..025a286043a5b98e04d2c169bfd81b5205ac87f5 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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/generators/catch_generators.hpp> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp index 3d388c66d8ebe51bce2dbca8047c506dded07e71..b79b372e977150cb266df29e462f2293c558a337 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp @@ -1,10 +1,15 @@ -/* - * 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) - */ + +// 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_random_number_generator.hpp> +#include <catch2/internal/catch_random_seed_generation.hpp> +#include <catch2/generators/catch_generators.hpp> TEST_CASE("Our PCG implementation provides expected results for known seeds", "[rng]") { Catch::SimplePcg32 rng; @@ -40,3 +45,18 @@ TEST_CASE("Comparison ops", "[rng]") { REQUIRE_FALSE(SimplePcg32{ 1 } == SimplePcg32{ 2 }); REQUIRE_FALSE(SimplePcg32{ 1 } != SimplePcg32{ 1 }); } + +TEST_CASE("Random seed generation reports unknown methods", "[rng][seed]") { + REQUIRE_THROWS(Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77))); +} + +TEST_CASE("Random seed generation accepts known methods", "[rng][seed]") { + using Catch::GenerateFrom; + const auto method = GENERATE( + GenerateFrom::Time, + GenerateFrom::RandomDevice, + GenerateFrom::Default + ); + + REQUIRE_NOTHROW(Catch::generateRandomSeed(method)); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp index c5c97998b84d969a9e9a3eab6f397293c090cbc9..97d1ad25307f6762eb0326cd39939f4fed82345d 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp @@ -13,33 +13,62 @@ #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_console_colour.hpp> +#include <catch2/internal/catch_enforce.hpp> #include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> +#include <catch2/internal/catch_istream.hpp> #include <catch2/matchers/catch_matchers_string.hpp> #include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_multi.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> #include <sstream> +namespace { + class StringIStream : public Catch::IStream { + public: + std::ostream& stream() override { return sstr; } + std::string str() const { return sstr.str(); } + private: + std::stringstream sstr; + }; + + //! config must outlive the function + Catch::ReporterConfig makeDummyRepConfig( Catch::Config const& config ) { + return Catch::ReporterConfig{ + &config, + Catch::Detail::make_unique<StringIStream>(), + Catch::ColourMode::None, + {} }; + } +} + TEST_CASE( "The default listing implementation write to provided stream", "[reporters][reporter-helpers]" ) { - using Catch::Matchers::Contains; + using Catch::Matchers::ContainsSubstring; using namespace std::string_literals; - std::stringstream sstream; + StringIStream sstream; SECTION( "Listing tags" ) { std::vector<Catch::TagInfo> tags(1); tags[0].add("fakeTag"_catch_sr); - Catch::defaultListTags(sstream, tags, false); + Catch::defaultListTags(sstream.stream(), tags, false); auto listingString = sstream.str(); - REQUIRE_THAT(listingString, Contains("[fakeTag]"s)); + REQUIRE_THAT(listingString, ContainsSubstring("[fakeTag]"s)); } SECTION( "Listing reporters" ) { std::vector<Catch::ReporterDescription> reporters( { { "fake reporter", "fake description" } } ); - Catch::defaultListReporters(sstream, reporters, Catch::Verbosity::Normal); + Catch::defaultListReporters(sstream.stream(), reporters, Catch::Verbosity::Normal); auto listingString = sstream.str(); - REQUIRE_THAT(listingString, Contains("fake reporter"s)); + REQUIRE_THAT( listingString, + ContainsSubstring( "fake reporter"s ) && + ContainsSubstring( "fake description"s ) ); } SECTION( "Listing tests" ) { Catch::TestCaseInfo fakeInfo{ @@ -47,17 +76,28 @@ TEST_CASE( "The default listing implementation write to provided stream", { "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 colour = Catch::makeColourImpl( Catch::ColourMode::None, &sstream); + Catch::defaultListTests(sstream.stream(), colour.get(), tests, false, Catch::Verbosity::Normal); + + auto listingString = sstream.str(); + REQUIRE_THAT( listingString, + ContainsSubstring( "fake test name"s ) && + ContainsSubstring( "fakeTestTag"s ) ); + } + SECTION( "Listing listeners" ) { + std::vector<Catch::ListenerDescription> listeners( + { { "fakeListener"_catch_sr, "fake description" } } ); + Catch::defaultListListeners( sstream.stream(), listeners ); auto listingString = sstream.str(); REQUIRE_THAT( listingString, - Contains( "fake test name"s ) && - Contains( "fakeTestTag"s ) ); + ContainsSubstring( "fakeListener"s ) && + ContainsSubstring( "fake description"s ) ); } } TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) { - using Catch::Matchers::Contains; + using Catch::Matchers::ContainsSubstring; using namespace std::string_literals; auto const& factories = Catch::getRegistryHub().getReporterRegistry().getFactories(); @@ -67,20 +107,20 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) { for (auto const& factory : factories) { INFO("Tested reporter: " << factory.first); - std::stringstream sstream; + auto sstream = Catch::Detail::make_unique<StringIStream>(); + auto& sstreamRef = *sstream.get(); - Catch::ConfigData config_data; - Catch::Config config( config_data ); - Catch::ReporterConfig rep_config( &config, sstream ); - auto reporter = factory.second->create( rep_config ); + Catch::Config config( Catch::ConfigData{} ); + auto reporter = factory.second->create( Catch::ReporterConfig{ + &config, CATCH_MOVE( sstream ), Catch::ColourMode::None, {} } ); 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)); + auto listingString = sstreamRef.str(); + REQUIRE_THAT(listingString, ContainsSubstring("fakeTag"s)); } DYNAMIC_SECTION( factory.first << " reporter lists reporters" ) { @@ -88,8 +128,8 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) { { { "fake reporter", "fake description" } } ); reporter->listReporters(reporters); - auto listingString = sstream.str(); - REQUIRE_THAT(listingString, Contains("fake reporter"s)); + auto listingString = sstreamRef.str(); + REQUIRE_THAT(listingString, ContainsSubstring("fake reporter"s)); } DYNAMIC_SECTION( factory.first << " reporter lists tests" ) { @@ -100,10 +140,190 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) { std::vector<Catch::TestCaseHandle> tests({ {&fakeInfo, nullptr} }); reporter->listTests(tests); - auto listingString = sstream.str(); + auto listingString = sstreamRef.str(); REQUIRE_THAT( listingString, - Contains( "fake test name"s ) && - Contains( "fakeTestTag"s ) ); + ContainsSubstring( "fake test name"s ) && + ContainsSubstring( "fakeTestTag"s ) ); + } + } +} + + +TEST_CASE("Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla", "[console-reporter]") { + SUCCEED(); +} + +namespace { + // A listener that writes provided string into destination, + // to record order of testRunStarting invocation. + class MockListener : public Catch::EventListenerBase { + std::string m_witness; + std::vector<std::string>& m_recorder; + public: + MockListener( std::string witness, + std::vector<std::string>& recorder, + Catch::IConfig const* config ): + EventListenerBase( config ), + m_witness( witness ), + m_recorder( recorder ) + {} + + void testRunStarting( Catch::TestRunInfo const& ) override { + m_recorder.push_back( m_witness ); + } + }; + // A reporter that writes provided string into destination, + // to record order of testRunStarting invocation. + class MockReporter : public Catch::StreamingReporterBase { + std::string m_witness; + std::vector<std::string>& m_recorder; + public: + MockReporter( std::string witness, + std::vector<std::string>& recorder, + Catch::ReporterConfig&& config ): + StreamingReporterBase( CATCH_MOVE(config) ), + m_witness( witness ), + m_recorder( recorder ) + {} + + void testRunStarting( Catch::TestRunInfo const& ) override { + m_recorder.push_back( m_witness ); + } + }; +} // namespace + +TEST_CASE("Multireporter calls reporters and listeners in correct order", + "[reporters][multi-reporter]") { + Catch::Config config( Catch::ConfigData{} ); + + // We add reporters before listeners, to check that internally they + // get sorted properly, and listeners are called first anyway. + Catch::MultiReporter multiReporter( &config ); + std::vector<std::string> records; + multiReporter.addReporter( Catch::Detail::make_unique<MockReporter>( + "Goodbye", records, makeDummyRepConfig(config) ) ); + multiReporter.addListener( + Catch::Detail::make_unique<MockListener>( "Hello", records, &config ) ); + multiReporter.addListener( + Catch::Detail::make_unique<MockListener>( "world", records, &config ) ); + multiReporter.addReporter( Catch::Detail::make_unique<MockReporter>( + "world", records, makeDummyRepConfig(config) ) ); + multiReporter.testRunStarting( { "" } ); + + std::vector<std::string> expected( { "Hello", "world", "Goodbye", "world" } ); + REQUIRE( records == expected ); +} + +namespace { + // A listener that sets it preferences to test that multireporter, + // properly sets up its own preferences + class PreferenceListener : public Catch::EventListenerBase { + public: + PreferenceListener( bool redirectStdout, + bool reportAllAssertions, + Catch::IConfig const* config ): + EventListenerBase( config ) { + m_preferences.shouldRedirectStdOut = redirectStdout; + m_preferences.shouldReportAllAssertions = reportAllAssertions; + } + }; + // A reporter that sets it preferences to test that multireporter, + // properly sets up its own preferences + class PreferenceReporter : public Catch::StreamingReporterBase { + public: + PreferenceReporter( bool redirectStdout, + bool reportAllAssertions, + Catch::ReporterConfig&& config ): + StreamingReporterBase( CATCH_MOVE(config) ) { + m_preferences.shouldRedirectStdOut = redirectStdout; + m_preferences.shouldReportAllAssertions = reportAllAssertions; } + }; +} // namespace + +TEST_CASE("Multireporter updates ReporterPreferences properly", + "[reporters][multi-reporter]") { + + Catch::Config config( Catch::ConfigData{} ); + Catch::MultiReporter multiReporter( &config ); + + // Post init defaults + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ); + + SECTION( "Adding listeners" ) { + multiReporter.addListener( + Catch::Detail::make_unique<PreferenceListener>( + true, false, &config ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ); + + multiReporter.addListener( + Catch::Detail::make_unique<PreferenceListener>( + false, true, &config ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true); + + multiReporter.addListener( + Catch::Detail::make_unique<PreferenceListener>( + false, false, &config ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ); + } + SECTION( "Adding reporters" ) { + multiReporter.addReporter( + Catch::Detail::make_unique<PreferenceReporter>( + true, false, makeDummyRepConfig(config) ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false ); + + multiReporter.addReporter( + Catch::Detail::make_unique<PreferenceReporter>( + false, true, makeDummyRepConfig( config ) ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ); + + multiReporter.addReporter( + Catch::Detail::make_unique<PreferenceReporter>( + false, false, makeDummyRepConfig( config ) ) ); + REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true ); + REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true ); } } + +namespace { + class TestReporterFactory : public Catch::IReporterFactory { + Catch::IEventListenerPtr create( Catch::ReporterConfig&& ) const override { + CATCH_INTERNAL_ERROR( + "This factory should never create a reporter" ); + } + std::string getDescription() const override { + return "Fake test factory"; + } + }; +} + +TEST_CASE("Registering reporter with '::' in name fails", + "[reporters][registration]") { + Catch::ReporterRegistry registry; + + REQUIRE_THROWS_WITH( registry.registerReporter( + "with::doublecolons", + Catch::Detail::make_unique<TestReporterFactory>() ), + "'::' is not allowed in reporter name: 'with::doublecolons'" ); +} + +TEST_CASE("Registering multiple reporters with the same name fails", + "[reporters][registration][approvals]") { + Catch::ReporterRegistry registry; + + registry.registerReporter( + "some-reporter-name", + Catch::Detail::make_unique<TestReporterFactory>() ); + + REQUIRE_THROWS_WITH( + registry.registerReporter( + "some-reporter-name", + Catch::Detail::make_unique<TestReporterFactory>() ), + "reporter using 'some-reporter-name' as name was already registered" ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..78e4858a0297b8609c7667bc9ecfb94f742c970b --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp @@ -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 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators_all.hpp> + +#include <catch2/internal/catch_sharding.hpp> + +#include <unordered_map> +#include <vector> + +TEST_CASE("Sharding Function", "[approvals]") { + std::vector<int> testContainer = { 0, 1, 2, 3, 4, 5, 6 }; + std::unordered_map<int, std::vector<std::size_t>> expectedShardSizes = { + {1, {7}}, + {2, {4, 3}}, + {3, {3, 2, 2}}, + {4, {2, 2, 2, 1}}, + {5, {2, 2, 1, 1, 1}}, + {6, {2, 1, 1, 1, 1, 1}}, + {7, {1, 1, 1, 1, 1, 1, 1}}, + }; + + auto shardCount = GENERATE(range(1, 7)); + auto shardIndex = GENERATE_COPY(filter([=](int i) { return i < shardCount; }, range(0, 6))); + + std::vector<int> result = Catch::createShard(testContainer, shardCount, shardIndex); + + auto& sizes = expectedShardSizes[shardCount]; + REQUIRE(result.size() == sizes[shardIndex]); + + std::size_t startIndex = 0; + for(int i = 0; i < shardIndex; i++) { + startIndex += sizes[i]; + } + + for(std::size_t i = 0; i < sizes[shardIndex]; i++) { + CHECK(result[i] == testContainer[i + startIndex]); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b1d377c854776c6b314610b650d8f6342686e48 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp @@ -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 + +#include <catch2/catch_test_macros.hpp> + +#include <catch2/internal/catch_istream.hpp> + +TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) { + REQUIRE( Catch::makeStream( "-" )->isConsole() ); +} + +TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) { + REQUIRE( Catch::makeStream( "" )->isConsole() ); +} + +TEST_CASE( "stdout and stderr streams have %-starting name", "[streams]" ) { + REQUIRE( Catch::makeStream( "%stderr" )->isConsole() ); + REQUIRE( Catch::makeStream( "%stdout" )->isConsole() ); +} + +TEST_CASE( "request an unknown %-starting stream fails", "[streams]" ) { + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ); +} + +TEST_CASE( "makeStream recognizes %debug stream name", "[streams]" ) { + REQUIRE_NOTHROW( Catch::makeStream( "%debug" ) ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp index 4b9cc0e3668690a52ee1c6228328de93e0e2612e..08f7dc2c6ace98eb78edf56b270bf0cbeda30a9e 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp @@ -1,3 +1,11 @@ + +// 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_stringref.hpp> @@ -29,7 +37,17 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) { REQUIRE_NOTHROW(original.data()); } - + SECTION( "Copy construction is shallow" ) { + StringRef original = StringRef( "original string" ); + StringRef copy = original; + REQUIRE(original.begin() == copy.begin()); + } + SECTION( "Copy assignment is shallow" ) { + StringRef original = StringRef( "original string" ); + StringRef copy; + copy = original; + REQUIRE(original.begin() == copy.begin()); + } SECTION( "Substrings" ) { StringRef s = "hello world!"; @@ -165,3 +183,30 @@ TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") { STATIC_REQUIRE(sr2.size() == 0); } } + +TEST_CASE("StringRef::compare", "[Strings][StringRef][approvals]") { + using Catch::StringRef; + + SECTION("Same length on both sides") { + StringRef sr1("abcdc"); + StringRef sr2("abcdd"); + StringRef sr3("abcdc"); + + REQUIRE(sr1.compare(sr2) < 0); + REQUIRE(sr2.compare(sr1) > 0); + REQUIRE(sr1.compare(sr3) == 0); + REQUIRE(sr3.compare(sr1) == 0); + } + SECTION("Different lengths") { + StringRef sr1("def"); + StringRef sr2("deff"); + StringRef sr3("ab"); + + REQUIRE(sr1.compare(sr2) < 0); + REQUIRE(sr2.compare(sr1) > 0); + REQUIRE(sr1.compare(sr3) > 0); + REQUIRE(sr2.compare(sr3) > 0); + REQUIRE(sr3.compare(sr1) < 0); + REQUIRE(sr3.compare(sr2) < 0); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp index d78567ca60556a511467c7f5ef9fd2eef0ad6fbd..8cd995cce9c80391f1b3598ea3c653f945079289 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp @@ -1,3 +1,11 @@ + +// 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/matchers/catch_matchers_vector.hpp> #include <catch2/internal/catch_string_manip.hpp> @@ -65,3 +73,11 @@ TEST_CASE("splitString", "[string-manip]") { CHECK_THAT(splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"})); CHECK_THAT(splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"})); } + +TEST_CASE("startsWith", "[string-manip]") { + using Catch::startsWith; + + CHECK_FALSE(startsWith("", 'c')); + CHECK(startsWith(std::string("abc"), 'a')); + CHECK(startsWith("def"_catch_sr, 'd')); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp index a74b31599e0e99f1ddeb030da14fc6a712d4c008..d87f966bde4960354b04bdf703543a6d3b4ce99b 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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/matchers/catch_matchers_vector.hpp> @@ -24,10 +27,10 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) { 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" ) ); + CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) ); + CHECK_THAT( what, ContainsSubstring( "file" ) ); + CHECK_THAT( what, ContainsSubstring( "2" ) ); + CHECK_THAT( what, ContainsSubstring( "10" ) ); } } @@ -40,19 +43,16 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) { } // Dummy line info for creating dummy test cases below -constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO; +static constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO; TEST_CASE("shortened hide tags are split apart", "[tags]") { using Catch::StringRef; + using Catch::Tag; using Catch::Matchers::VectorContains; - Catch::TestCaseInfo testcase("", {"fake test name", "[.magic-tag]"}, dummySourceLineInfo); - // Extract parsed tags into strings - std::vector<StringRef> tags; - for (auto const& tag : testcase.tags) { - tags.push_back(tag.lowerCased); - } - REQUIRE_THAT(tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr)); + Catch::TestCaseInfo testcase("", {"fake test name", "[.magic-tag]"}, dummySourceLineInfo); + REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) + && VectorContains( Tag( "."_catch_sr ) ) ); } TEST_CASE("tags with dots in later positions are not parsed as hidden", "[tags]") { @@ -69,3 +69,36 @@ TEST_CASE( "empty tags are not allowed", "[tags]" ) { Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) ); } + +TEST_CASE( "Tags with spaces and non-alphanumerical characters are accepted", + "[tags]" ) { + using Catch::Tag; + using Catch::Matchers::VectorContains; + + Catch::TestCaseInfo testCase( + "", + { "fake test name", "[tag with spaces][I said \"good day\" sir!]" }, + dummySourceLineInfo ); + + REQUIRE( testCase.tags.size() == 2 ); + REQUIRE_THAT( testCase.tags, + VectorContains( Tag( "tag with spaces" ) ) && + VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ); +} + +TEST_CASE( "Test case with identical tags keeps just one", "[tags]" ) { + using Catch::Tag; + + Catch::TestCaseInfo testCase( + "", + { "fake test name", "[TaG1][tAg1][TAG1][tag1]" }, + dummySourceLineInfo ); + + REQUIRE( testCase.tags.size() == 1 ); + REQUIRE( testCase.tags[0] == Tag( "tag1" ) ); +} + +TEST_CASE( "Empty tag is not allowed" ) { + REQUIRE_THROWS( Catch::TestCaseInfo( + "", { "fake test name", "[]" }, dummySourceLineInfo ) ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..93cb70b14a51f065e0731c90c92475769b1bfe43 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp @@ -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 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_test_case_info_hasher.hpp> + +static constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO; + +using Catch::TestCaseInfo; +using Catch::TestCaseInfoHasher; + +TEST_CASE("Hashers with same seed produce same hash", "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); + + TestCaseInfoHasher h1( 0x12345678 ); + TestCaseInfoHasher h2( 0x12345678 ); + + REQUIRE( h1( dummy ) == h2( dummy ) ); +} + +TEST_CASE( + "Hashers with different seed produce different hash with same test case", + "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); + + TestCaseInfoHasher h1( 0x12345678 ); + TestCaseInfoHasher h2( 0x87654321 ); + + REQUIRE( h1( dummy ) != h2( dummy ) ); +} + +TEST_CASE("Hashing test case produces same hash across multiple calls", + "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); + + TestCaseInfoHasher h( 0x12345678 ); + + REQUIRE( h( dummy ) == h( dummy ) ); +} + +TEST_CASE("Hashing different test cases produces different result", "[test-case-hash]") { + TestCaseInfoHasher h( 0x12345678 ); + SECTION("Different test name") { + TestCaseInfo dummy1( "class", { "name-1", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class", { "name-2", "[a-tag]" }, dummySourceLineInfo ); + + REQUIRE( h( dummy1 ) != h( dummy2 ) ); + } + SECTION("Different classname") { + TestCaseInfo dummy1( + "class-1", { "name", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class-2", { "name", "[a-tag]" }, dummySourceLineInfo ); + + REQUIRE( h( dummy1 ) != h( dummy2 ) ); + } + SECTION("Different tags") { + TestCaseInfo dummy1( + "class", { "name", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class", { "name", "[b-tag]" }, dummySourceLineInfo ); + + REQUIRE( h( dummy1 ) != h( dummy2 ) ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8ac77b293aaa0ec230fcef7b701ec8d71be7c46 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.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/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_tag_alias_registry.hpp> +#include <catch2/internal/catch_test_spec_parser.hpp> + +namespace { + static constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO; + + static Catch::TestSpec parseAndCreateSpec(std::string const& str) { + Catch::TagAliasRegistry registry; + Catch::TestSpecParser parser( registry ); + + parser.parse( str ); + auto spec = parser.testSpec(); + REQUIRE( spec.hasFilters() ); + REQUIRE( spec.getInvalidSpecs().empty()); + + return spec; + } + +} + +TEST_CASE( "Parsing tags with non-alphabetical characters is pass-through", + "[test-spec][test-spec-parser]" ) { + auto const& tagString = GENERATE( as<std::string>{}, + "[tag with spaces]", + "[I said \"good day\" sir!]" ); + CAPTURE(tagString); + + auto spec = parseAndCreateSpec( tagString ); + + Catch::TestCaseInfo testCase( + "", { "fake test name", tagString }, dummySourceLineInfo ); + + REQUIRE( spec.matches( testCase ) ); +} + +TEST_CASE("Parsed tags are matched case insensitive", + "[test-spec][test-spec-parser]") { + auto spec = parseAndCreateSpec( "[CASED tag]" ); + + Catch::TestCaseInfo testCase( + "", { "fake test name", "[cased TAG]" }, dummySourceLineInfo ); + + REQUIRE( spec.matches( testCase ) ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..379dc624dace6ce1f188220107c809f6598f2af7 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp @@ -0,0 +1,200 @@ + +// 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_textflow.hpp> + +#include <sstream> + +using Catch::TextFlow::Column; + +namespace { + static std::string as_written(Column const& c) { + std::stringstream sstr; + sstr << c; + return sstr.str(); + } +} + +TEST_CASE( "TextFlow::Column one simple line", + "[TextFlow][column][approvals]" ) { + Column col( "simple short line" ); + + REQUIRE(as_written(col) == "simple short line"); +} + +TEST_CASE( "TextFlow::Column respects already present newlines", + "[TextFlow][column][approvals]" ) { + Column col( "abc\ndef" ); + REQUIRE( as_written( col ) == "abc\ndef" ); +} + +TEST_CASE( "TextFlow::Column respects width setting", + "[TextFlow][column][approvals]" ) { + Column col( "The quick brown fox jumped over the lazy dog" ); + + SECTION( "width=20" ) { + col.width( 20 ); + REQUIRE( as_written( col ) == "The quick brown fox\n" + "jumped over the lazy\n" + "dog" ); + } + SECTION("width=10") { + col.width( 10 ); + REQUIRE( as_written( col ) == "The quick\n" + "brown fox\n" + "jumped\n" + "over the\n" + "lazy dog" ); + } + SECTION("width=5") { + // This is so small some words will have to be split with hyphen + col.width(5); + REQUIRE( as_written( col ) == "The\n" + "quick\n" + "brown\n" + "fox\n" + "jump-\n" + "ed\n" + "over\n" + "the\n" + "lazy\n" + "dog" ); + } +} + +TEST_CASE( "TextFlow::Column respects indentation setting", + "[TextFlow][column][approvals]" ) { + Column col( "First line\nSecond line\nThird line" ); + + SECTION("Default: no indentation at all") { + REQUIRE(as_written(col) == "First line\nSecond line\nThird line"); + } + SECTION("Indentation on first line only") { + col.initialIndent(3); + REQUIRE(as_written(col) == " First line\nSecond line\nThird line"); + } + SECTION("Indentation on all lines") { + col.indent(3); + REQUIRE(as_written(col) == " First line\n Second line\n Third line"); + } + SECTION("Indentation on later lines only") { + col.indent(5).initialIndent(0); + REQUIRE(as_written(col) == "First line\n Second line\n Third line"); + } + SECTION("Different indentation on first and later lines") { + col.initialIndent(1).indent(2); + REQUIRE(as_written(col) == " First line\n Second line\n Third line"); + } +} + +TEST_CASE("TextFlow::Column indentation respects whitespace", "[TextFlow][column][approvals]") { + Column col(" text with whitespace\n after newlines"); + + SECTION("No extra indentation") { + col.initialIndent(0).indent(0); + REQUIRE(as_written(col) == " text with whitespace\n after newlines"); + } + SECTION("Different indentation on first and later lines") { + col.initialIndent(1).indent(2); + REQUIRE(as_written(col) == " text with whitespace\n after newlines"); + } +} + +TEST_CASE( "TextFlow::Column linebreaking prefers boundary characters", + "[TextFlow][column][approvals]" ) { + SECTION("parentheses") { + Column col("(Hello)aaa(World)"); + SECTION("width=20") { + col.width(20); + REQUIRE(as_written(col) == "(Hello)aaa(World)"); + } + SECTION("width=15") { + col.width(15); + REQUIRE(as_written(col) == "(Hello)aaa\n(World)"); + } + SECTION("width=8") { + col.width(8); + REQUIRE(as_written(col) == "(Hello)\naaa\n(World)"); + } + } + SECTION("commas") { + Column col("Hello, world"); + col.width(8); + + REQUIRE(as_written(col) == "Hello,\nworld"); + } +} + + +TEST_CASE( "TextFlow::Column respects indentation for empty lines", + "[TextFlow][column][approvals][!shouldfail]" ) { + // This is currently bugged and does not do what it should + Column col("\n\nthird line"); + col.indent(2); + + //auto b = col.begin(); + //auto e = col.end(); + + //auto b1 = *b; + //++b; + //auto b2 = *b; + //++b; + //auto b3 = *b; + //++b; + + //REQUIRE(b == e); + + std::string written = as_written(col); + + REQUIRE(as_written(col) == " \n \n third line"); +} + +TEST_CASE( "TextFlow::Column leading/trailing whitespace", + "[TextFlow][column][approvals]" ) { + SECTION("Trailing whitespace") { + Column col("some trailing whitespace: \t"); + REQUIRE(as_written(col) == "some trailing whitespace: \t"); + } + SECTION("Some leading whitespace") { + Column col("\t \t whitespace wooo"); + REQUIRE(as_written(col) == "\t \t whitespace wooo"); + } + SECTION("both") { + Column col(" abc "); + REQUIRE(as_written(col) == " abc "); + } + SECTION("whitespace only") { + Column col("\t \t"); + REQUIRE(as_written(col) == "\t \t"); + } +} + +TEST_CASE( "TextFlow::Column can handle empty string", + "[TextFlow][column][approvals]" ) { + Column col(""); + REQUIRE(as_written(col) == ""); +} + +TEST_CASE( "#1400 - TextFlow::Column wrapping would sometimes duplicate words", + "[TextFlow][column][regression][approvals]" ) { + const auto long_string = std::string( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nisl \n" + "massa, luctus ut ligula vitae, suscipit tempus velit. Vivamus sodales, quam in \n" + "convallis posuere, libero nisi ultricies orci, nec lobortis.\n"); + + auto col = Column(long_string) + .width(79) + .indent(2); + + REQUIRE(as_written(col) == + " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nisl \n" + " massa, luctus ut ligula vitae, suscipit tempus velit. Vivamus sodales, quam\n" + " in \n" + " convallis posuere, libero nisi ultricies orci, nec lobortis."); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp index c0415dc329a13fff0c1d92670d1e0b89ca4fda32..63f072dd9940c5489938b6ddb8fdddcd40dd688a 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp @@ -1,3 +1,11 @@ + +// 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/matchers/catch_matchers_vector.hpp> #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp index d461232de0a695d440d6e311aaf50818bcd2085c..40c9886c32cadd680265923ed518d68164295a9d 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp @@ -1,3 +1,11 @@ + +// 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_unique_ptr.hpp> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp index c98d66ef2a87ce52f439d7aa9fe86202c2863d25..9fe9416a121485918ba5835313482972df68cbf3 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp @@ -1,7 +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 + #include <catch2/catch_test_macros.hpp> #include <catch2/internal/catch_xmlwriter.hpp> -#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/matchers/catch_matchers_string.hpp> #include <sstream> @@ -44,10 +52,9 @@ TEST_CASE( "XmlEncode", "[XML]" ) { // 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("Here be 👾") == "Here be 👾"); + CHECK(encode("šš") == "šš"); CHECK(encode("\xDF\xBF") == "\xDF\xBF"); // 0x7FF CHECK(encode("\xE0\xA0\x80") == "\xE0\xA0\x80"); // 0x800 @@ -59,10 +66,10 @@ TEST_CASE("XmlEncode: UTF-8", "[XML][UTF-8][approvals]") { } 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("Here \xFF be \xF0\x9F\x91\xBE") == "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 + CHECK(encode("\xC5\xC5\xA0") == "\\xC5Š"); + CHECK(encode("\xF4\x90\x80\x80") == "\\xF4\\x90\\x80\\x80"); // 0x110000 -- out of unicode range } SECTION("Overlong encodings") { @@ -113,11 +120,10 @@ TEST_CASE("XmlEncode: UTF-8", "[XML][UTF-8][approvals]") { CHECK(encode("\xF4\x80\x80") == "\\xF4\\x80\\x80"); } } -#undef ESC } TEST_CASE("XmlWriter writes boolean attributes as true/false", "[XML][XmlWriter]") { - using Catch::Matchers::Contains; + using Catch::Matchers::ContainsSubstring; std::stringstream stream; { Catch::XmlWriter xml(stream); @@ -128,6 +134,50 @@ TEST_CASE("XmlWriter writes boolean attributes as true/false", "[XML][XmlWriter] } REQUIRE_THAT( stream.str(), - Contains(R"(attr1="true")") && - Contains(R"(attr2="false")") ); + ContainsSubstring(R"(attr1="true")") && + ContainsSubstring(R"(attr2="false")") ); +} + +TEST_CASE("XmlWriter does not escape comments", "[XML][XmlWriter][approvals]") { + using Catch::Matchers::ContainsSubstring; + std::stringstream stream; + { + Catch::XmlWriter xml(stream); + + xml.writeComment(R"(unescaped special chars: < > ' " &)"); + } + REQUIRE_THAT( stream.str(), + ContainsSubstring(R"(<!-- unescaped special chars: < > ' " & -->)")); +} + +TEST_CASE("XmlWriter errors out when writing text without enclosing element", "[XmlWriter][approvals]") { + std::stringstream stream; + Catch::XmlWriter xml(stream); + REQUIRE_THROWS(xml.writeText("some text")); +} + +TEST_CASE("XmlWriter escapes text properly", "[XML][XmlWriter][approvals]") { + using Catch::Matchers::ContainsSubstring; + std::stringstream stream; + { + Catch::XmlWriter xml(stream); + xml.scopedElement("root") + .writeText(R"(Special chars need escaping: < > ' " &)"); + } + + REQUIRE_THAT( stream.str(), + ContainsSubstring(R"(Special chars need escaping: < > ' " &)")); +} + +TEST_CASE("XmlWriter escapes attributes properly", "[XML][XmlWriter][approvals]") { + using Catch::Matchers::ContainsSubstring; + std::stringstream stream; + { + Catch::XmlWriter xml(stream); + xml.scopedElement("root") + .writeAttribute("some-attribute", R"(Special chars need escaping: < > ' " &)"); + } + + REQUIRE_THAT(stream.str(), + ContainsSubstring(R"(some-attribute="Special chars need escaping: < > ' " &")")); } diff --git a/packages/Catch2/tests/SelfTest/TestRegistrations.cpp b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp index 45a01c027289f52d0c1da305ef45c9600057e983..f24c913f5d0ca575796b7b3b966b45f2d78c3ffa 100644 --- a/packages/Catch2/tests/SelfTest/TestRegistrations.cpp +++ b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp @@ -10,7 +10,7 @@ #include <catch2/reporters/catch_reporter_event_listener.hpp> #include <catch2/internal/catch_enforce.hpp> #include <catch2/catch_test_case_info.hpp> -#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> // Some example tag aliases @@ -48,7 +48,11 @@ class ValidatingTestListener : public Catch::EventListenerBase { }; public: - ValidatingTestListener(Catch::ReporterConfig const& config) : + static std::string getDescription() { + return "Validates ordering of Catch2's listener events"; + } + + ValidatingTestListener(Catch::IConfig const* config) : EventListenerBase(config) { m_preferences.shouldReportAllAssertions = true; } @@ -67,7 +71,7 @@ public: ++m_testCaseCounter.starting; // Reset the part tracking for partial test case events - m_lastSeenPartNumber = -1; + m_lastSeenPartNumber = uint64_t(-1); } void testCasePartialStarting(Catch::TestCaseInfo const&, diff --git a/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp index 1c82e0e912b1249c613b80118d7d19bff2da05c2..bfb222d037c078225c171f747256065c2813a876 100644 --- a/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp +++ b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp @@ -1,9 +1,10 @@ -/* - * 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) - */ + +// 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> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp index 1ae5fe04e6a903a01c337f954d04f655d12383df..853227a2783db138362fca899e3a340323971fe0 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp @@ -1,10 +1,10 @@ -/* - * 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) - */ + +// 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_approx.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp index eba58d382c16c00f99fededa8665631e42db5599..b128196c3e4da62ed3d7a7970de1b332e014920a 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp index b2d41cf231ddd23e799f7a4a9ff4e18bcc27bf8f..ffedc9a2f65cfe11ef4384119bb455725d2406d6 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp @@ -1,3 +1,12 @@ + +// 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/catch_test_macros.hpp> #include <catch2/benchmark/catch_benchmark.hpp> #include <catch2/benchmark/catch_constructor.hpp> @@ -143,3 +152,20 @@ TEST_CASE("Benchmark containers", "[!benchmark]") { }; } } + +TEST_CASE("Skip benchmark macros", "[!benchmark]") { + std::vector<int> v; + BENCHMARK("fill vector") { + v.emplace_back(1); + v.emplace_back(2); + v.emplace_back(3); + }; + REQUIRE(v.size() == 0); + + std::size_t counter{0}; + BENCHMARK_ADVANCED("construct vector")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs()); + meter.measure([&](int i) { storage[i].construct("thing"); counter++; }); + }; + REQUIRE(counter == 0); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp index 94e83051b75897c48d56fbbe4e4f5daab92454d1..6b2ba4cfe6559ff6f9f794130d912cc8725a6ee2 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp @@ -1,7 +1,14 @@ -/* - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ + +// 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( __GNUC__ ) || defined( __clang__ ) +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif #include <catch2/catch_test_macros.hpp> #include <catch2/catch_template_test_macros.hpp> @@ -107,4 +114,20 @@ namespace Inner { REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2); } +} // namespace + + +// We want a class in nested namespace so we can test JUnit's classname normalization. +namespace { + namespace A { + namespace B { + class TestClass {}; + } + } +} // namespace + +TEST_CASE_METHOD( A::B::TestClass, + "A TEST_CASE_METHOD testing junit classname normalization", + "[class][approvals]" ) { + SUCCEED(); } diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp index c40c09f81ad700a277838569459e0dbdde544ca3..5d9ab3f05975113d7b132c4ab6b9ca4e3bba9804 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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 <type_traits> @@ -23,7 +26,7 @@ namespace bar { #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wmissing-declarations" #endif -std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) { +static std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) { return out << "[1403 helper]"; } /////////////////////////////// @@ -46,7 +49,7 @@ struct logic_t { }; -void throws_int(bool b) { +static void throws_int(bool b) { if (b) { throw 1; } @@ -66,7 +69,7 @@ bool templated_tests(T t) { struct A {}; -std::ostream &operator<<(std::ostream &o, const A &) { return o << 0; } +static std::ostream &operator<<(std::ostream &o, const A &) { return o << 0; } struct B : private A { bool operator==(int) const { return true; } @@ -172,6 +175,8 @@ TEST_CASE("#1403", "[compilation]") { TEST_CASE("Optionally static assertions", "[compilation]") { STATIC_REQUIRE( std::is_void<void>::value ); STATIC_REQUIRE_FALSE( std::is_void<int>::value ); + STATIC_CHECK( std::is_void<void>::value ); + STATIC_CHECK_FALSE( std::is_void<int>::value ); } TEST_CASE("#1548", "[compilation]") { diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp index 167752e18d9a710847f8e326ecef9809efca51d8..2e3b624e1d21db24eaa9ef38c0aa6fb3f8974b6d 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp @@ -1,7 +1,11 @@ -/* - * 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) - */ + +// 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 + #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" @@ -29,15 +33,6 @@ namespace { double double_pi = 3.1415926535; }; - struct TestDef { - TestDef& operator + (const std::string&) { - return *this; - } - TestDef& operator[](const std::string&) { - return *this; - } - }; - static const char* returnsConstNull() { return nullptr; } static char* returnsNull() { return nullptr; } @@ -49,9 +44,6 @@ namespace { // Equality tests TEST_CASE( "Equality checks that should succeed" ) { - TestDef td; - td + "hello" + "hello"; - TestData data; REQUIRE( data.int_seven == 7 ); @@ -86,6 +78,19 @@ TEST_CASE( "Equality checks that should fail", "[.][failing][!mayfail]" ) CHECK( x == Approx( 1.301 ) ); } +// Needed to test junit reporter's handling of mayfail test cases and sections +TEST_CASE("Mayfail test case with nested sections", "[!mayfail]") { + SECTION("A") { + SECTION("1") { FAIL(); } + SECTION("2") { FAIL(); } + } + SECTION("B") { + SECTION("1") { FAIL(); } + SECTION("2") { FAIL(); } + } +} + + TEST_CASE( "Inequality checks that should succeed" ) { TestData data; diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp index 15feefc266d0adb95c0307f8435598716e1ceef6..0a169831729d27e26982ef9b9fb79ad3a26df9c8 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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 <iostream> #include <cstdio> @@ -29,7 +32,7 @@ TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decompo CHECK(truthy(false)); } -TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition]") { +TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition][approvals]") { 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 index 2a6731cb1d57772e3b12b951767c4744003eaac1..7cf6213733259437232251918aaa5fc91ccec784 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp @@ -1,3 +1,11 @@ + +// 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_enum_values_registry.hpp> @@ -78,7 +86,7 @@ TEST_CASE( "Enums can quickly have stringification enabled using REGISTER_ENUM" REQUIRE( stringify( EnumClass3::Value3 ) == "Value3" ); REQUIRE( stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" ); - EnumClass3 ec3 = EnumClass3 ::Value2; + EnumClass3 ec3 = EnumClass3::Value2; REQUIRE( stringify( ec3 ) == "Value2" ); } diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp index 206bd9c8143810f28133bbc2b80afd1b35c3c48f..e93cf91930ea79131cdd0885215d48f95bf2ac4c 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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_translate_exception.hpp> @@ -36,7 +39,7 @@ namespace { explicit CustomException(const std::string& msg) : m_msg(msg) {} - std::string getMessage() const { + std::string const& getMessage() const { return m_msg; } @@ -48,9 +51,12 @@ namespace { public: explicit CustomStdException(const std::string& msg) : m_msg(msg) {} - ~CustomStdException() noexcept override {} + ~CustomStdException() noexcept override = default; + + CustomStdException( CustomStdException const& ) = default; + CustomStdException& operator=( CustomStdException const& ) = default; - std::string getMessage() const { + std::string const& getMessage() const { return m_msg; } @@ -134,7 +140,7 @@ TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" ) { } TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" ) { - throw CustomException( "custom std exception" ); + throw CustomStdException( "custom std exception" ); } TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" ) { @@ -167,8 +173,8 @@ TEST_CASE( "Exception messages can be tested for", "[!throws]" ) { 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 ) ); + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "except" ) ); + REQUIRE_THROWS_WITH( thisThrows(), ContainsSubstring( "exCept", Catch::CaseSensitive::No ) ); } } diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp index b2154a1a164b89b63ea6b527a0c2c35fa65e6b65..5b205c85c773125ef9179dc80795c8e389e4fd79 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -1,3 +1,11 @@ + +// 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/generators/catch_generator_exception.hpp> #include <catch2/generators/catch_generators_adapters.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp index 6f83279f33d3d2c71aa88fed7fce94fd51329f2a..5b4e9e033ff2214fd4b3f2fc356ab9316174e921 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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_template_test_macros.hpp> @@ -105,12 +108,12 @@ namespace { } // end unnamed namespace TEST_CASE( "String matchers", "[matchers]" ) { - REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ); REQUIRE_THAT( testStringForMatching(), - Contains( "string", Catch::CaseSensitive::No ) ); - CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); + ContainsSubstring( "string", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ); CHECK_THAT( testStringForMatching(), - Contains( "aBC", Catch::CaseSensitive::No ) ); + ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ); CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); CHECK_THAT( testStringForMatching(), @@ -122,8 +125,8 @@ TEST_CASE( "String matchers", "[matchers]" ) { TEST_CASE( "Contains string matcher", "[.][failing][matchers]" ) { CHECK_THAT( testStringForMatching(), - Contains( "not there", Catch::CaseSensitive::No ) ); - CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ); + ContainsSubstring( "not there", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ); } TEST_CASE( "StartsWith string matcher", "[.][failing][matchers]" ) { @@ -185,42 +188,42 @@ TEST_CASE( "Regex string matcher", "[matchers][.failing]" ) { TEST_CASE( "Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]" ) { CHECK_THAT( testStringForMatching(), - Contains( "string" ) && Contains( "abc" ) && - Contains( "substring" ) && Contains( "contains" ) ); + ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && + ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) ); } TEST_CASE( "Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]" ) { CHECK_THAT( testStringForMatching(), - Contains( "string" ) || Contains( "different" ) || - Contains( "random" ) ); + ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || + ContainsSubstring( "random" ) ); CHECK_THAT( testStringForMatching2(), - Contains( "string" ) || Contains( "different" ) || - Contains( "random" ) ); + ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || + ContainsSubstring( "random" ) ); } TEST_CASE( "Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]" ) { CHECK_THAT( testStringForMatching(), - ( Contains( "string" ) || Contains( "different" ) ) && - Contains( "substring" ) ); + ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && + ContainsSubstring( "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" ) ); + ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && + ContainsSubstring( "random" ) ); } TEST_CASE( "Matchers can be negated (Not) with the ! operator", "[matchers][operators][not]" ) { - CHECK_THAT( testStringForMatching(), !Contains( "different" ) ); + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "different" ) ); } TEST_CASE( "Matchers can be negated (Not) with the ! operator - failing", "[matchers][operators][not][.failing]" ) { - CHECK_THAT( testStringForMatching(), !Contains( "substring" ) ); + CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ); } template <typename T> struct CustomAllocator : private std::allocator<T> { @@ -842,10 +845,10 @@ TEST_CASE( "Combining concrete matchers does not use templated matchers", struct MatcherA : Catch::Matchers::MatcherGenericBase { std::string describe() const override { - return "equals: (int) 1 or (float) 1.0f"; + return "equals: (int) 1 or (string) \"1\""; } bool match( int i ) const { return i == 1; } - bool match( float f ) const { return f == 1.0f; } + bool match( std::string s ) const { return s == "1"; } }; struct MatcherB : Catch::Matchers::MatcherGenericBase { diff --git a/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp index 912b5cdb63aabec303edd6150b28e70b22551309..1201581cf1a5006e747d4041d891f8f094d2daf4 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp @@ -1,5 +1,10 @@ -// 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) + +// 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/matchers/catch_matchers_container_properties.hpp> @@ -9,22 +14,28 @@ #include <catch2/matchers/catch_matchers_predicate.hpp> #include <catch2/matchers/catch_matchers_string.hpp> -#include <array> #include <cmath> +#include <initializer_list> #include <list> #include <map> +#include <type_traits> #include <vector> +#include <memory> namespace { + namespace unrelated { + template <typename T> class needs_ADL_begin { - std::array<int, 5> elements{ {1, 2, 3, 4, 5} }; + std::vector<T> m_elements; public: - using iterator = std::array<int, 5>::iterator; - using const_iterator = std::array<int, 5>::const_iterator; + using iterator = typename std::vector<T>::iterator; + using const_iterator = typename std::vector<T>::const_iterator; + + needs_ADL_begin(std::initializer_list<T> init) : m_elements(init) {} - const_iterator Begin() const { return elements.begin(); } - const_iterator End() const { return elements.end(); } + const_iterator Begin() const { return m_elements.begin(); } + const_iterator End() const { return m_elements.end(); } friend const_iterator begin(needs_ADL_begin const& lhs) { return lhs.Begin(); @@ -40,51 +51,61 @@ namespace unrelated { # pragma clang diagnostic ignored "-Wunused-function" #endif +template <typename T> class has_different_begin_end_types { - std::array<int, 5> elements{ {1, 2, 3, 4, 5} }; + // Using std::vector<T> leads to annoying issues when T is bool + // so we just use list because the perf is not critical and ugh. + std::list<T> m_elements; // 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; + // Fake-ish forward iterator that only compares to a different type + class iterator { + using underlying_iter = typename std::list<T>::const_iterator; + underlying_iter m_start; + underlying_iter m_end; + + public: + iterator( underlying_iter start, underlying_iter end ): + m_start( start ), m_end( 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*; + using value_type = T; + using const_reference = T const&; + using pointer = T const*; friend bool operator==( iterator iter, iterator_end ) { - return iter.start == iter.end; + return iter.m_start == iter.m_end; } friend bool operator!=( iterator iter, iterator_end ) { - return iter.start != iter.end; + return iter.m_start != iter.m_end; } iterator& operator++() { - ++start; + ++m_start; return *this; } iterator operator++(int) { auto tmp(*this); - ++start; + ++m_start; return tmp; } - reference operator*() const { - return *start; + const_reference operator*() const { + return *m_start; } pointer operator->() const { - return start; + return m_start; } }; public: + explicit has_different_begin_end_types( std::initializer_list<T> init ): + m_elements( init ) {} + iterator begin() const { - return { elements.data(), elements.data() + elements.size() }; + return { m_elements.begin(), m_elements.end() }; } iterator_end end() const { @@ -96,80 +117,91 @@ public: # pragma clang diagnostic pop #endif +template <typename T> struct with_mocked_iterator_access { + std::vector<T> m_elements; -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{}; + // use plain arrays to have nicer printouts with CHECK(...) + mutable std::unique_ptr<bool[]> m_derefed; - // We want to check which elements were touched when iterating, so + // We want to check which elements were dereferenced when iterating, so // we can check whether iterator-using code traverses range correctly - struct iterator { - with_mocked_iterator_access* m_origin; + template <bool is_const> class basic_iterator { + template <typename U> + using constify_t = std::conditional_t<is_const, std::add_const_t<U>, U>; + + constify_t<with_mocked_iterator_access>* m_origin; size_t m_origin_idx; + public: 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; + using value_type = constify_t<T>; + using const_reference = typename std::vector<T>::const_reference; + using reference = typename std::vector<T>::reference; + using pointer = typename std::vector<T>::pointer; + + basic_iterator( constify_t<with_mocked_iterator_access>* origin, + std::size_t origin_idx ): + m_origin{ origin }, m_origin_idx{ origin_idx } {} + + friend bool operator==( basic_iterator lhs, basic_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); + friend bool operator!=( basic_iterator lhs, basic_iterator rhs ) { + return !( lhs == rhs ); } - iterator& operator++() { + basic_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); + basic_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]; + const_reference operator*() const { + assert( m_origin_idx < m_origin->m_elements.size() && "Attempted to deref invalid position" ); + m_origin->m_derefed[m_origin_idx] = true; + return m_origin->m_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]; + assert( m_origin_idx < m_origin->m_elements.size() && "Attempted to deref invalid position" ); + return &m_origin->m_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 }; - } + using iterator = basic_iterator<false>; + using const_iterator = basic_iterator<true>; + + with_mocked_iterator_access( std::initializer_list<T> init ): + m_elements( init ), + m_derefed( std::make_unique<bool[]>( m_elements.size() ) ) {} + const_iterator begin() const { return { this, 0 }; } + const_iterator end() const { return { this, m_elements.size() }; } + iterator begin() { return { this, 0 }; } + iterator end() { return { this, m_elements.size() }; } }; } // end anon namespace namespace Catch { - template <> - struct StringMaker<with_mocked_iterator_access> { - static std::string convert(with_mocked_iterator_access const& access) { + // make sure with_mocked_iterator_access is not considered a range by Catch, + // so that below StringMaker is used instead of the default one for ranges + template <typename T> + struct is_range<with_mocked_iterator_access<T>> : std::false_type {}; + + template <typename T> + struct StringMaker<with_mocked_iterator_access<T>> { + static std::string + convert( with_mocked_iterator_access<T> const& access ) { // We have to avoid the type's iterators, because we check // their use in tests - return ::Catch::Detail::stringify(access.elements); + return ::Catch::Detail::stringify( access.m_elements ); } }; -} +} // namespace Catch struct MoveOnlyTestElement { int num = 0; @@ -228,7 +260,7 @@ TEST_CASE("Basic use of the Contains range matcher", "[matchers][templated][cont } SECTION("Can handle type that requires ADL-found free function begin and end") { - unrelated::needs_ADL_begin in; + unrelated::needs_ADL_begin<int> in{1, 2, 3, 4, 5}; REQUIRE_THAT(in, Contains(1)); REQUIRE_THAT(in, !Contains(8)); @@ -378,35 +410,35 @@ TEST_CASE("Usage of AllMatch range matcher", "[matchers][templated][quantifiers] } SECTION("Type requires ADL found begin and end") { - unrelated::needs_ADL_begin needs_adl; + unrelated::needs_ADL_begin<int> needs_adl{ 1, 2, 3, 4, 5 }; REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ); } SECTION("Shortcircuiting") { - with_mocked_iterator_access mocked; + with_mocked_iterator_access<int> mocked{ 1, 2, 3, 4, 5 }; 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]); + REQUIRE(mocked.m_derefed[0]); + REQUIRE(mocked.m_derefed[1]); + REQUIRE(mocked.m_derefed[2]); + REQUIRE(mocked.m_derefed[3]); + REQUIRE(mocked.m_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]); + REQUIRE(mocked.m_derefed[0]); + REQUIRE(mocked.m_derefed[1]); + REQUIRE(mocked.m_derefed[2]); + REQUIRE_FALSE(mocked.m_derefed[3]); + REQUIRE_FALSE(mocked.m_derefed[4]); } } } @@ -431,34 +463,34 @@ TEST_CASE("Usage of AnyMatch range matcher", "[matchers][templated][quantifiers] REQUIRE_THAT(data, !AnyMatch(Contains(0) && Contains(10))); } - SECTION("Type requires ADL found begin and end") { - unrelated::needs_ADL_begin needs_adl; + SECTION( "Type requires ADL found begin and end" ) { + unrelated::needs_ADL_begin<int> needs_adl{ 1, 2, 3, 4, 5 }; REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ); } SECTION("Shortcircuiting") { - with_mocked_iterator_access mocked; + with_mocked_iterator_access<int> mocked{ 1, 2, 3, 4, 5 }; 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] ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE( mocked.m_derefed[3] ); + REQUIRE( mocked.m_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] ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE_FALSE( mocked.m_derefed[1] ); + REQUIRE_FALSE( mocked.m_derefed[2] ); + REQUIRE_FALSE( mocked.m_derefed[3] ); + REQUIRE_FALSE( mocked.m_derefed[4] ); } } } @@ -484,62 +516,319 @@ TEST_CASE("Usage of NoneMatch range matcher", "[matchers][templated][quantifiers } SECTION( "Type requires ADL found begin and end" ) { - unrelated::needs_ADL_begin needs_adl; + unrelated::needs_ADL_begin<int> needs_adl{ 1, 2, 3, 4, 5 }; REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ); } SECTION("Shortcircuiting") { - with_mocked_iterator_access mocked; + with_mocked_iterator_access<int> mocked{ 1, 2, 3, 4, 5 }; 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]); + REQUIRE(mocked.m_derefed[0]); + REQUIRE(mocked.m_derefed[1]); + REQUIRE(mocked.m_derefed[2]); + REQUIRE(mocked.m_derefed[3]); + REQUIRE(mocked.m_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]); + REQUIRE(mocked.m_derefed[0]); + REQUIRE_FALSE(mocked.m_derefed[1]); + REQUIRE_FALSE(mocked.m_derefed[2]); + REQUIRE_FALSE(mocked.m_derefed[3]); + REQUIRE_FALSE(mocked.m_derefed[4]); + } + } +} + +namespace { + struct ConvertibleToBool + { + bool v; + + explicit operator bool() const + { + return v; + } + }; +} + +namespace Catch { + template <> + struct StringMaker<ConvertibleToBool> { + static std::string + convert( ConvertibleToBool const& convertible_to_bool ) { + return ::Catch::Detail::stringify( convertible_to_bool.v ); + } + }; +} // namespace Catch + +TEST_CASE("Usage of AllTrue range matcher", "[matchers][templated][quantifiers]") { + using Catch::Matchers::AllTrue; + + SECTION( "Basic usage" ) { + SECTION( "All true evaluates to true" ) { + std::array<bool, 5> const data{ { true, true, true, true, true } }; + REQUIRE_THAT( data, AllTrue() ); + } + SECTION( "Empty evaluates to true" ) { + std::array<bool, 0> const data{}; + REQUIRE_THAT( data, AllTrue() ); + } + SECTION( "One false evalutes to false" ) { + std::array<bool, 5> const data{ { true, true, false, true, true } }; + REQUIRE_THAT( data, !AllTrue() ); + } + SECTION( "All false evaluates to false" ) { + std::array<bool, 5> const data{ + { false, false, false, false, false } }; + REQUIRE_THAT( data, !AllTrue() ); + } + } + + SECTION( "Contained type is convertible to bool" ) { + SECTION( "All true evaluates to true" ) { + std::array<ConvertibleToBool, 5> const data{ + { { true }, { true }, { true }, { true }, { true } } }; + REQUIRE_THAT( data, AllTrue() ); + } + SECTION( "One false evalutes to false" ) { + std::array<ConvertibleToBool, 5> const data{ + { { true }, { true }, { false }, { true }, { true } } }; + REQUIRE_THAT( data, !AllTrue() ); + } + SECTION( "All false evaluates to false" ) { + std::array<ConvertibleToBool, 5> const data{ + { { false }, { false }, { false }, { false }, { false } } }; + REQUIRE_THAT( data, !AllTrue() ); + } + } + + SECTION( "Shortcircuiting" ) { + SECTION( "All are read" ) { + with_mocked_iterator_access<bool> const mocked{ + true, true, true, true, true }; + REQUIRE_THAT( mocked, AllTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE( mocked.m_derefed[3] ); + REQUIRE( mocked.m_derefed[4] ); + } + SECTION( "Short-circuited" ) { + with_mocked_iterator_access<bool> const mocked{ + true, true, false, true, true }; + REQUIRE_THAT( mocked, !AllTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE_FALSE( mocked.m_derefed[3] ); + REQUIRE_FALSE( mocked.m_derefed[4] ); + } + } +} + +TEST_CASE( "Usage of NoneTrue range matcher", "[matchers][templated][quantifiers]" ) { + using Catch::Matchers::NoneTrue; + + SECTION( "Basic usage" ) { + SECTION( "All true evaluates to false" ) { + std::array<bool, 5> const data{ { true, true, true, true, true } }; + REQUIRE_THAT( data, !NoneTrue() ); + } + SECTION( "Empty evaluates to true" ) { + std::array<bool, 0> const data{}; + REQUIRE_THAT( data, NoneTrue() ); + } + SECTION( "One true evalutes to false" ) { + std::array<bool, 5> const data{ + { false, false, true, false, false } }; + REQUIRE_THAT( data, !NoneTrue() ); + } + SECTION( "All false evaluates to true" ) { + std::array<bool, 5> const data{ + { false, false, false, false, false } }; + REQUIRE_THAT( data, NoneTrue() ); + } + } + + SECTION( "Contained type is convertible to bool" ) { + SECTION( "All true evaluates to false" ) { + std::array<ConvertibleToBool, 5> const data{ + { { true }, { true }, { true }, { true }, { true } } }; + REQUIRE_THAT( data, !NoneTrue() ); + } + SECTION( "One true evalutes to false" ) { + std::array<ConvertibleToBool, 5> const data{ + { { false }, { false }, { true }, { false }, { false } } }; + REQUIRE_THAT( data, !NoneTrue() ); + } + SECTION( "All false evaluates to true" ) { + std::array<ConvertibleToBool, 5> const data{ + { { false }, { false }, { false }, { false }, { false } } }; + REQUIRE_THAT( data, NoneTrue() ); + } + } + + SECTION( "Shortcircuiting" ) { + SECTION( "All are read" ) { + with_mocked_iterator_access<bool> const mocked{ + false, false, false, false, false }; + REQUIRE_THAT( mocked, NoneTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE( mocked.m_derefed[3] ); + REQUIRE( mocked.m_derefed[4] ); + } + SECTION( "Short-circuited" ) { + with_mocked_iterator_access<bool> const mocked{ + false, false, true, true, true }; + REQUIRE_THAT( mocked, !NoneTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE_FALSE( mocked.m_derefed[3] ); + REQUIRE_FALSE( mocked.m_derefed[4] ); + } + } +} + +TEST_CASE( "Usage of AnyTrue range matcher", "[matchers][templated][quantifiers]" ) { + using Catch::Matchers::AnyTrue; + + SECTION( "Basic usage" ) { + SECTION( "All true evaluates to true" ) { + std::array<bool, 5> const data{ { true, true, true, true, true } }; + REQUIRE_THAT( data, AnyTrue() ); + } + SECTION( "Empty evaluates to false" ) { + std::array<bool, 0> const data{}; + REQUIRE_THAT( data, !AnyTrue() ); + } + SECTION( "One true evalutes to true" ) { + std::array<bool, 5> const data{ + { false, false, true, false, false } }; + REQUIRE_THAT( data, AnyTrue() ); + } + SECTION( "All false evaluates to false" ) { + std::array<bool, 5> const data{ + { false, false, false, false, false } }; + REQUIRE_THAT( data, !AnyTrue() ); + } + } + + SECTION( "Contained type is convertible to bool" ) { + SECTION( "All true evaluates to true" ) { + std::array<ConvertibleToBool, 5> const data{ + { { true }, { true }, { true }, { true }, { true } } }; + REQUIRE_THAT( data, AnyTrue() ); + } + SECTION( "One true evalutes to true" ) { + std::array<ConvertibleToBool, 5> const data{ + { { false }, { false }, { true }, { false }, { false } } }; + REQUIRE_THAT( data, AnyTrue() ); + } + SECTION( "All false evaluates to false" ) { + std::array<ConvertibleToBool, 5> const data{ + { { false }, { false }, { false }, { false }, { false } } }; + REQUIRE_THAT( data, !AnyTrue() ); + } + } + + SECTION( "Shortcircuiting" ) { + SECTION( "All are read" ) { + with_mocked_iterator_access<bool> const mocked{ + false, false, false, false, true }; + REQUIRE_THAT( mocked, AnyTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE( mocked.m_derefed[3] ); + REQUIRE( mocked.m_derefed[4] ); + } + SECTION( "Short-circuited" ) { + with_mocked_iterator_access<bool> const mocked{ + false, false, true, true, true }; + REQUIRE_THAT( mocked, AnyTrue() ); + REQUIRE( mocked.m_derefed[0] ); + REQUIRE( mocked.m_derefed[1] ); + REQUIRE( mocked.m_derefed[2] ); + REQUIRE_FALSE( mocked.m_derefed[3] ); + REQUIRE_FALSE( mocked.m_derefed[4] ); } } } +TEST_CASE("All/Any/None True matchers support types with ADL begin", + "[approvals][matchers][quantifiers][templated]") { + using Catch::Matchers::AllTrue; + using Catch::Matchers::NoneTrue; + using Catch::Matchers::AnyTrue; + + + SECTION( "Type requires ADL found begin and end" ) { + unrelated::needs_ADL_begin<bool> const needs_adl{ + true, true, true, true, true }; + REQUIRE_THAT( needs_adl, AllTrue() ); + } + + SECTION( "Type requires ADL found begin and end" ) { + unrelated::needs_ADL_begin<bool> const needs_adl{ + false, false, false, false, false }; + REQUIRE_THAT( needs_adl, NoneTrue() ); + } + + SECTION( "Type requires ADL found begin and end" ) { + unrelated::needs_ADL_begin<bool> const needs_adl{ + false, false, true, false, false }; + REQUIRE_THAT( needs_adl, AnyTrue() ); + } +} -// This is a C++17 extension, and GCC refuses to compile such code -// unless it is set to C++17 or later +// Range loop iterating over range with different types for begin and end is a +// C++17 feature, and GCC refuses to compile such code unless the lang mode 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::AllTrue; using Catch::Matchers::AnyMatch; + using Catch::Matchers::AnyTrue; using Catch::Matchers::NoneMatch; + using Catch::Matchers::NoneTrue; using Catch::Matchers::Predicate; - has_different_begin_end_types diff_types; - REQUIRE_THAT( diff_types, !AllMatch( Predicate<int>( []( int elem ) { - return elem < 3; - } ) ) ); + SECTION( "AllAnyNoneMatch" ) { + has_different_begin_end_types<int> diff_types{ 1, 2, 3, 4, 5 }; + 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, AnyMatch( Predicate<int>( []( int elem ) { + return elem < 2; + } ) ) ); + + REQUIRE_THAT( diff_types, !NoneMatch( Predicate<int>( []( int elem ) { + return elem < 3; + } ) ) ); + } + SECTION( "AllAnyNoneTrue" ) { + has_different_begin_end_types<bool> diff_types{ false, false, true, false, false }; - REQUIRE_THAT( diff_types, !NoneMatch( Predicate<int>( []( int elem ) { - return elem < 3; - } ) ) ); + REQUIRE_THAT( diff_types, !AllTrue() ); + REQUIRE_THAT( diff_types, AnyTrue() ); + REQUIRE_THAT( diff_types, !NoneTrue() ); + } } #endif diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp index a30c2e9edfb94496ee536c017b18fc25ba913600..2ec71b4965e82684cc6298d59764e41ea8f53a02 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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 <iostream> @@ -238,6 +241,20 @@ std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) { return out; } +// Clang and gcc have different names for this warning, and clang also +// warns about an unused value. This warning must be disabled for C++20. +#if defined(__GNUG__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wcomma-subscript" +#elif defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wdeprecated-comma-subscript" +#pragma clang diagnostic ignored "-Wunused-value" +#endif + 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)], @@ -248,6 +265,10 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag SUCCEED(); } +#ifdef __GNUG__ +#pragma GCC diagnostic pop +#endif + 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 {[<"); diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp index e3b9bd3a23881ca2fe953a8ae6cd1dbd65e84c0f..93b5ff1ec5ca0606f8569f4acf954556b8fdb16a 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -1,11 +1,15 @@ -/* - * 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) - */ + +// 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_template_test_macros.hpp> #include <catch2/internal/catch_config_wchar.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> #ifdef __clang__ # pragma clang diagnostic ignored "-Wc++98-compat" @@ -227,16 +231,6 @@ TEST_CASE( "send a single char to INFO", "[failing][.]" ) { 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 ); @@ -253,16 +247,6 @@ TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][.]" ) { 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 ); @@ -442,10 +426,6 @@ TEST_CASE("not allowed", "[!throws]") { 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 @@ -482,7 +462,7 @@ TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) { #endif // CATCH_CONFIG_WCHAR TEST_CASE( "long long" ) { - long long l = std::numeric_limits<long long>::max(); + constexpr long long l = std::numeric_limits<long long>::max(); REQUIRE( l == std::numeric_limits<long long>::max() ); } @@ -495,10 +475,15 @@ TEST_CASE( "# A test name that starts with a #" ) { SUCCEED( "yay" ); } -TEST_CASE( "#835 -- errno should not be touched by Catch", "[.][failing][!shouldfail]" ) { +TEST_CASE( "#835 -- errno should not be touched by Catch2", "[.][failing][!shouldfail]" ) { errno = 1; + // Check that reporting failed test doesn't change errno. CHECK(f() == 0); - REQUIRE(errno == 1); // Check that f() doesn't touch errno. + // We want to avoid expanding `errno` macro in assertion, because + // we capture the expression after macro expansion, and would have + // to normalize the ways different platforms spell `errno`. + const auto errno_after = errno; + REQUIRE(errno_after == 1); } TEST_CASE( "#961 -- Dynamically created sections should all be reported", "[.]" ) { @@ -522,3 +507,47 @@ TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regres TEST_CASE("Same test name but with different tags is fine", "[.approvals][some-tag]") {} TEST_CASE("Same test name but with different tags is fine", "[.approvals][other-tag]") {} + +// MinGW doesn't support __try, and Clang has only very partial support +#if defined(_MSC_VER) +void throw_and_catch() +{ + __try { + RaiseException(0xC0000005, 0, 0, NULL); + } + __except (1) + { + + } +} + + +TEST_CASE("Validate SEH behavior - handled", "[approvals][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]") +{ + // Validate that Catch2 framework correctly handles tests raising and handling SEH exceptions. + throw_and_catch(); +} + +void throw_no_catch() +{ + RaiseException(0xC0000005, 0, 0, NULL); +} + +TEST_CASE("Validate SEH behavior - unhandled", "[.approvals][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]") +{ + // Validate that Catch2 framework correctly handles tests raising and not handling SEH exceptions. + throw_no_catch(); +} + +static LONG CALLBACK dummyExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) { + return EXCEPTION_CONTINUE_SEARCH; +} + +TEST_CASE("Validate SEH behavior - no crash for stack unwinding", "[approvals][!throws][!shouldfail][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]") +{ + // Trigger stack unwinding with SEH top-level filter changed and validate the test fails expectedly with no application crash + SetUnhandledExceptionFilter(dummyExceptionFilter); + throw 1; +} + +#endif // _MSC_VER diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp index ceb94e22f8fc556e3cb1ba1b473e9b3f6a3dd61d..e5e12468daf74c550f7853ebe33a5465832f170c 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp @@ -1,3 +1,11 @@ + +// 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> #if defined(CATCH_CONFIG_CPP17_BYTE) diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp index 27a3dc3d31e49503ee06c7d03aac6ea2b233d268..22c31c6870100dfc26a1f961c6d6f07c4e965628 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp @@ -1,3 +1,11 @@ + +// 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 <chrono> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp index c738b32c5413be14437c07badaa78d637fc15a37..b8f383b159dadb21fc7b7a4bf61e8022de938cb6 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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 #define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp index 2b7ac3eca1fe912db8b669adeec6e4cec087e9de..bc2d2561cc64a0dff71643379ad51665fa8da274 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp @@ -1,3 +1,11 @@ + +// 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 + #define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp index 3b8608aa4ce1247d7338ed3fa58d7129ae7ad9f2..4bf592a4ca286b598224f8c04aa9b72cf1c1431c 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp @@ -1,3 +1,11 @@ + +// 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 + #define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp index 1d1a7ab0d7d536f14f1bc3546af4572d75c663f6..415cbf8384f90cfbdcbb9b5e1164da4515d0c06c 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp @@ -1,3 +1,11 @@ + +// 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 + #define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER #include <catch2/catch_test_macros.hpp> @@ -38,8 +46,7 @@ TEST_CASE( "tuple<tuple<int>,tuple<>,float>", "[toString][tuple]" ) CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) ); } -TEST_CASE( "tuple<nullptr,int,const char *>", "[toString][tuple]" ) -{ +TEST_CASE( "tuple<nullptr,int,const char *>", "[approvals][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 index de9748cde0e63d3cfaa4c02f90c9c17c5fef62b2..e67a7a2cf063449d972b407eca50a2b4a484d9d7 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp @@ -1,3 +1,11 @@ + +// 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 + #define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER #include <catch2/catch_test_macros.hpp> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp index 96c676725dcd16238e82e5d251d5cfc1e3ef8077..a5ccbfa70af8e96518cdbf07d5eae83f3470775a 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -1,3 +1,11 @@ + +// 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 <vector> #include <array> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp index 7af8cc5b82fc8064735ef6252d551a8e4a3b3ac0..7069734f458cb081b3710bebc055c91efa413f6a 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp @@ -1,7 +1,10 @@ -/* - * Demonstrate which version of toString/StringMaker is being used - * for various types - */ + +// 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> diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp index eed763f2087b1c07f30d607adfca2ef1c827371b..bcfa7e699d8deda0f298486031e72592da905717 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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 #ifdef __clang__ #pragma clang diagnostic ignored "-Wpadded" @@ -20,34 +23,6 @@ #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; @@ -73,17 +48,6 @@ TEST_CASE CHECK( o1 == o2 ); } -/////////////////////////////////////////////////////////////////////////////// -TEST_CASE -( - "string literals of different sizes can be compared", - "[Tricky][failing][.]" -) -{ - REQUIRE( std::string( "first" ) == "second" ); - -} - /////////////////////////////////////////////////////////////////////////////// TEST_CASE ( @@ -240,18 +204,6 @@ TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" ) } } -// 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 ) {} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp index c8754deecb2a5da4f3a3b8eb487b170a5b1e1b77..7bc3920ecc3cee0c31bdfd42b10e630bb8724008 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp @@ -1,7 +1,10 @@ -/* - * 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) - */ + +// 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> diff --git a/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake b/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake deleted file mode 100644 index 4637e3f3c7f788368633a8a667fbd4f5a88161ff..0000000000000000000000000000000000000000 --- a/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# 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/ConfigureTestsCommon.py b/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py new file mode 100644 index 0000000000000000000000000000000000000000..ad5b358be0358d8b4b43a2accd252a4286e71b34 --- /dev/null +++ b/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 + +# 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 + +from typing import List, Tuple + +import os +import subprocess + +def configure_and_build(source_path: str, project_path: str, options: List[Tuple[str, str]]): + base_configure_cmd = ['cmake', + '-B{}'.format(project_path), + '-H{}'.format(source_path), + '-DCMAKE_BUILD_TYPE=Debug', + '-DCATCH_DEVELOPMENT_BUILD=ON'] + for option, value in options: + base_configure_cmd.append('-D{}={}'.format(option, value)) + try: + subprocess.run(base_configure_cmd, + stdout = subprocess.PIPE, + stderr = subprocess.STDOUT, + check = True) + except subprocess.SubprocessError as ex: + print("Could not configure build to '{}' from '{}'".format(project_path, source_path)) + print("Return code: {}".format(ex.returncode)) + print("output: {}".format(ex.output)) + raise + print('Configuring {} finished'.format(project_path)) + + build_cmd = ['cmake', + '--build', '{}'.format(project_path), + # For now we assume that we only need Debug config + '--config', 'Debug'] + try: + subprocess.run(build_cmd, + stdout = subprocess.PIPE, + stderr = subprocess.STDOUT, + check = True) + except subprocess.SubprocessError as ex: + print("Could not build project in '{}'".format(project_path)) + print("Return code: {}".format(ex.returncode)) + print("output: {}".format(ex.output)) + raise + print('Building {} finished'.format(project_path)) + +def run_and_return_output(base_path: str, binary_name: str, other_options: List[str]) -> Tuple[str, str]: + # For now we assume that Windows builds are done using MSBuild under + # Debug configuration. This means that we need to add "Debug" folder + # to the path when constructing it. On Linux, we don't add anything. + config_path = "Debug" if os.name == 'nt' else "" + full_path = os.path.join(base_path, config_path, binary_name) + + base_cmd = [full_path] + base_cmd.extend(other_options) + + try: + ret = subprocess.run(base_cmd, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + check = True, + universal_newlines = True) + except subprocess.SubprocessError as ex: + print('Could not run "{}"'.format(base_cmd)) + print('Args: "{}"'.format(other_options)) + print('Return code: {}'.format(ex.returncode)) + print('stdout: {}'.format(ex.stdout)) + print('stderr: {}'.format(ex.stdout)) + raise + + return (ret.stdout, ret.stderr) diff --git a/packages/Catch2/tests/TestScripts/testBazelReporter.py b/packages/Catch2/tests/TestScripts/testBazelReporter.py new file mode 100644 index 0000000000000000000000000000000000000000..71014ee26eef59e49d86f8906b776f599e3d4c5d --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testBazelReporter.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 + +# 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 + +import os +import re +import sys +import xml.etree.ElementTree as ET +import subprocess + +""" +Test that Catch2 recognizes `XML_OUTPUT_FILE` env variable and creates +a junit reporter that writes to the provided path. + +Requires 2 arguments, path to Catch2 binary configured with +`CATCH_CONFIG_BAZEL_SUPPORT`, and the output directory for the output file. +""" +if len(sys.argv) != 3: + print("Wrong number of arguments: {}".format(len(sys.argv))) + print("Usage: {} test-bin-path output-dir".format(sys.argv[0])) + exit(1) + + +bin_path = os.path.abspath(sys.argv[1]) +output_dir = os.path.abspath(sys.argv[2]) +xml_out_path = os.path.join(output_dir, '{}.xml'.format(os.path.basename(bin_path))) + +# Ensure no file exists from previous test runs +if os.path.isfile(xml_out_path): + os.remove(xml_out_path) + +print('bin path:', bin_path) +print('xml out path:', xml_out_path) + +env = os.environ.copy() +env["XML_OUTPUT_FILE"] = xml_out_path +test_passing = True + +try: + ret = subprocess.run( + bin_path, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + check=True, + universal_newlines=True, + env=env + ) + stdout = ret.stdout +except subprocess.SubprocessError as ex: + if ex.returncode == 1: + # The test cases are allowed to fail. + test_passing = False + stdout = ex.stdout + else: + print('Could not run "{}"'.format(args)) + print("Return code: {}".format(ex.returncode)) + print("stdout: {}".format(ex.stdout)) + print("stderr: {}".format(ex.stdout)) + raise + +# Check for valid XML output +try: + tree = ET.parse(xml_out_path) +except ET.ParseError as ex: + print("Invalid XML: '{}'".format(ex)) + raise +except FileNotFoundError as ex: + print("Could not find '{}'".format(xml_out_path)) + raise + +bin_name = os.path.basename(bin_path) +# Check for matching testsuite +if not tree.find('.//testsuite[@name="{}"]'.format(bin_name)): + print("Could not find '{}' testsuite".format(bin_name)) + exit(2) + +# Check that we haven't disabled the default reporter +summary_test_cases = re.findall(r'test cases: \d* \| \d* passed \| \d* failed', stdout) +if len(summary_test_cases) == 0: + print("Could not find test summary in {}".format(stdout)) + exit(2) + +total, passed, failed = [int(s) for s in summary_test_cases[0].split() if s.isdigit()] + +if failed == 0 and not test_passing: + print("Expected at least 1 test failure!") + exit(2) + +if len(tree.findall('.//testcase')) != total: + print("Unexpected number of test cases!") + exit(2) + +if len(tree.findall('.//failure')) != failed: + print("Unexpected number of test failures!") + exit(2) + +if (passed + failed) != total: + print("Something has gone very wrong, ({} + {}) != {}".format(passed, failed, total)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py b/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py new file mode 100644 index 0000000000000000000000000000000000000000..66c88da02eeecb745030d79052f8aff8924c2d9e --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# 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 + +from ConfigureTestsCommon import configure_and_build, run_and_return_output + +import os +import re +import sys + +""" +Tests the CMake configure option for CATCH_CONFIG_DEFAULT_REPORTER + +Requires 2 arguments, path folder where the Catch2's main CMakeLists.txt +exists, and path to where the output files should be stored. +""" + +if len(sys.argv) != 3: + print('Wrong number of arguments: {}'.format(len(sys.argv))) + print('Usage: {} catch2-top-level-dir base-build-output-dir'.format(sys.argv[0])) + exit(1) + +catch2_source_path = os.path.abspath(sys.argv[1]) +build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', 'DefaultReporter') + +configure_and_build(catch2_source_path, + build_dir_path, + [("CATCH_CONFIG_DEFAULT_REPORTER", "compact")]) + +stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), 'SelfTest', ['[approx][custom]']) + + +# This matches the summary line made by compact reporter, console reporter's +# summary line does not match the regex. +summary_regex = 'Passed \d+ test case with \d+ assertions.' +if not re.search(summary_regex, stdout): + print("Could not find '{}' in the stdout".format(summary_regex)) + print('stdout: "{}"'.format(stdout)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureDisable.py b/packages/Catch2/tests/TestScripts/testConfigureDisable.py new file mode 100644 index 0000000000000000000000000000000000000000..92946d8d839cf10a23473640c52b39d653738fdd --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testConfigureDisable.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +# 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 + +from ConfigureTestsCommon import configure_and_build, run_and_return_output + +import os +import re +import sys + +""" +Tests the CMake configure option for CATCH_CONFIG_DISABLE + +Requires 2 arguments, path folder where the Catch2's main CMakeLists.txt +exists, and path to where the output files should be stored. +""" + +if len(sys.argv) != 3: + print('Wrong number of arguments: {}'.format(len(sys.argv))) + print('Usage: {} catch2-top-level-dir base-build-output-dir'.format(sys.argv[0])) + exit(1) + +catch2_source_path = os.path.abspath(sys.argv[1]) +build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', 'Disable') + +configure_and_build(catch2_source_path, + build_dir_path, + [("CATCH_CONFIG_DISABLE", "ON"), + # We need to turn off WERROR, because the compilers + # can see that the various variables inside test cases + # are set but unused. + ("CATCH_ENABLE_WERROR", "OFF")]) + +stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), + 'SelfTest', + ['--allow-running-no-tests']) + + +summary_line = 'No tests ran' +if not summary_line in stdout: + print("Could not find '{}' in the stdout".format(summary_line)) + print('stdout: "{}"'.format(stdout)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py b/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py new file mode 100644 index 0000000000000000000000000000000000000000..a8a53e4f55cdafe50ca728e66256144caa64e96b --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# 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 + +from ConfigureTestsCommon import configure_and_build, run_and_return_output + +import os +import re +import sys + +""" +Tests the CMake configure option for CATCH_CONFIG_DISABLE_STRINGIFICATION + +Requires 2 arguments, path folder where the Catch2's main CMakeLists.txt +exists, and path to where the output files should be stored. +""" + +if len(sys.argv) != 3: + print('Wrong number of arguments: {}'.format(len(sys.argv))) + print('Usage: {} catch2-top-level-dir base-build-output-dir'.format(sys.argv[0])) + exit(1) + +catch2_source_path = os.path.abspath(sys.argv[1]) +build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', 'DisableStringification') + +configure_and_build(catch2_source_path, + build_dir_path, + [("CATCH_CONFIG_DISABLE_STRINGIFICATION", "ON")]) + +stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), + 'SelfTest', + ['-s', '[approx][custom]']) + + +required_output = 'Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION' +if not required_output in stdout: + print("Could not find '{}' in the stdout".format(required_output)) + print('stdout: "{}"'.format(stdout)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py b/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py new file mode 100644 index 0000000000000000000000000000000000000000..b5313fe92b8531840385ec85a700e6b0e7a6746e --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +# 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 + +from ConfigureTestsCommon import configure_and_build, run_and_return_output + +import os +import re +import sys + +""" +Tests the CMake configure option for CATCH_CONFIG_EXPERIMENTAL_REDIRECT + +Requires 2 arguments, path folder where the Catch2's main CMakeLists.txt +exists, and path to where the output files should be stored. +""" + +if len(sys.argv) != 3: + print('Wrong number of arguments: {}'.format(len(sys.argv))) + print('Usage: {} catch2-top-level-dir base-build-output-dir'.format(sys.argv[0])) + exit(1) + +catch2_source_path = os.path.abspath(sys.argv[1]) +build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', 'ExperimentalRedirect') + +configure_and_build(catch2_source_path, + build_dir_path, + [("CATCH_CONFIG_EXPERIMENTAL_REDIRECT", "ON")]) + +stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), + 'SelfTest', + ['-r', 'xml', '"has printf"']) + + +# The print from printf must be within the XML's reporter stdout tag. +required_output = '''\ + <StdOut> +loose text artifact + </StdOut> +''' +if not required_output in stdout: + print("Could not find '{}' in the stdout".format(required_output)) + print('stdout: "{}"'.format(stdout)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py b/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py index d119e6dab81361ca9fb7db882c82148b0ac0a742..8259d211c67b749a0d82f33f9bc7b5dd93f968c2 100755 --- a/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py +++ b/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py @@ -1,5 +1,12 @@ #!/usr/bin/env python3 +# 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 + """ This test script verifies that the testCasePartial{Starting,Ended} reporter events fire properly. This is done by calling a test binary compiled with diff --git a/packages/Catch2/tests/TestScripts/testRandomOrder.py b/packages/Catch2/tests/TestScripts/testRandomOrder.py index e7d7eca19a1154d39ada84b3de10b96b25cea973..afab231de37297d5bf0eead007cc0a32466f9ae3 100755 --- a/packages/Catch2/tests/TestScripts/testRandomOrder.py +++ b/packages/Catch2/tests/TestScripts/testRandomOrder.py @@ -1,5 +1,12 @@ #!/usr/bin/env python3 +# 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 + """ This test script verifies that the random ordering of tests inside Catch2 is invariant in regards to subsetting. This is done by running @@ -13,6 +20,12 @@ import sys import random import xml.etree.ElementTree as ET +def none_to_empty_str(e): + if e is None: + return "" + assert type(e) is str + return e + def list_tests(self_test_exe, tags, rng_seed): cmd = [self_test_exe, '--reporter', 'xml', '--list-tests', '--order', 'rand', '--rng-seed', str(rng_seed)] @@ -26,7 +39,9 @@ def list_tests(self_test_exe, tags, rng_seed): raise RuntimeError("Unexpected error output:\n" + process.stderr) root = ET.fromstring(stdout) - result = [elem.text for elem in root.findall('./TestCase/Name')] + result = [(none_to_empty_str(tc.find('Name').text), + none_to_empty_str(tc.find('Tags').text), + none_to_empty_str(tc.find('ClassName').text)) for tc in root.findall('./TestCase')] if len(result) < 2: raise RuntimeError("Unexpectedly few tests listed (got {})".format( diff --git a/packages/Catch2/tests/TestScripts/testSharding.py b/packages/Catch2/tests/TestScripts/testSharding.py new file mode 100755 index 0000000000000000000000000000000000000000..6902f83c4a4a0be9354acdd90e7a933d2c5d9219 --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testSharding.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python3 + +# 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 + +""" +This test script verifies that sharding tests does change which tests are run. +This is done by running the binary multiple times, once to list all the tests, +once per shard to list the tests for that shard, and once again per shard to +execute the tests. The sharded lists are compared to the full list to ensure +none are skipped, duplicated, and that the order remains the same. +""" + +import random +import subprocess +import sys +import xml.etree.ElementTree as ET + +from collections import namedtuple + +from typing import List, Dict + +seed = random.randint(0, 2 ** 32 - 1) +number_of_shards = 5 + +def make_base_commandline(self_test_exe): + return [ + self_test_exe, + '--reporter', 'xml', + '--order', 'rand', + '--rng-seed', str(seed), + "[generators]~[benchmarks]~[.]" + ] + + +def list_tests(self_test_exe: str, extra_args: List[str] = None): + cmd = make_base_commandline(self_test_exe) + ['--list-tests'] + if extra_args: + cmd.extend(extra_args) + + try: + ret = subprocess.run(cmd, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + timeout = 10, + check = True, + universal_newlines = True) + except subprocess.CalledProcessError as ex: + print('Could not list tests:\n{}'.format(ex.stderr)) + + if ret.stderr: + raise RuntimeError("Unexpected error output:\n" + ret.stderr) + + root = ET.fromstring(ret.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 execute_tests(self_test_exe: str, extra_args: List[str] = None): + cmd = make_base_commandline(self_test_exe) + if extra_args: + cmd.extend(extra_args) + + try: + ret = subprocess.run(cmd, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + timeout = 10, + check = True, + universal_newlines = True) + except subprocess.CalledProcessError as ex: + print('Could not list tests:\n{}'.format(ex.stderr)) + + if ret.stderr: + raise RuntimeError("Unexpected error output:\n" + process.stderr) + + root = ET.fromstring(ret.stdout) + result = [elem.attrib["name"] for elem in root.findall('./TestCase')] + + if len(result) < 2: + raise RuntimeError("Unexpectedly few tests listed (got {})".format( + len(result))) + + return result + + +def test_sharded_listing(self_test_exe: str) -> Dict[int, List[str]]: + """ + Asks the test binary for list of all tests, and also for lists of + tests from shards. + + The combination of shards is then checked whether it corresponds to + the full list of all tests. + + Returns the dictionary of shard-index => listed tests for later use. + """ + all_tests = list_tests(self_test_exe) + big_shard_tests = list_tests(self_test_exe, ['--shard-count', '1', '--shard-index', '0']) + + assert all_tests == big_shard_tests, ( + "No-sharding test list does not match the listing of big shard:\nNo shard:\n{}\n\nWith shard:\n{}\n".format( + '\n'.join(all_tests), + '\n'.join(big_shard_tests) + ) + ) + + shard_listings = dict() + for shard_idx in range(number_of_shards): + shard_listings[shard_idx] = list_tests(self_test_exe, ['--shard-count', str(number_of_shards), '--shard-index', str(shard_idx)]) + + shard_sizes = [len(v) for v in shard_listings.values()] + assert len(all_tests) == sum(shard_sizes) + + # Check that the shards have roughly the right sizes (e.g. we don't + # have all tests in single shard and the others are empty) + differences = [abs(x1 - x2) for x1, x2 in zip(shard_sizes, shard_sizes[1:])] + assert all(diff <= 1 for diff in differences), "A shard has weird size: {}".format(shard_sizes) + + combined_shards = [inner for outer in shard_listings.values() for inner in outer] + assert all_tests == combined_shards, ( + "All tests and combined shards disagree.\nNo shard:\n{}\n\nCombined:\n{}\n\n".format( + '\n'.join(all_tests), + '\n'.join(combined_shards) + ) + ) + shard_listings[-1] = all_tests + + return shard_listings + + +def test_sharded_execution(self_test_exe: str, listings: Dict[int, List[str]]): + """ + Runs the test binary and checks that the executed tests match the + previously listed tests. + + Also does this for various shard indices, and that the combination + of all shards matches the full run/listing. + """ + all_tests = execute_tests(self_test_exe) + big_shard_tests = execute_tests(self_test_exe, ['--shard-count', '1', '--shard-index', '0']) + assert all_tests == big_shard_tests + + assert listings[-1] == all_tests + + for shard_idx in range(number_of_shards): + assert listings[shard_idx] == execute_tests(self_test_exe, ['--shard-count', str(number_of_shards), '--shard-index', str(shard_idx)]) + + +def main(): + self_test_exe, = sys.argv[1:] + listings = test_sharded_listing(self_test_exe) + test_sharded_execution(self_test_exe, listings) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat b/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat index d9be52eb76717ab83d6feac9ee1d28d6417de68e..727f829baffc888ca2efdd8ec150ebe711f820e7 100644 --- a/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat +++ b/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat @@ -10,10 +10,10 @@ if "%CONFIGURATION%"=="Debug" ( @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! + 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_ENABLE_CONFIGURE_TESTS=%configure_tests% -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_BUILD_SURROGATES=%surrogates% -DCATCH_DEVELOPMENT_BUILD=ON || exit /b !ERRORLEVEL! + cmake -H. -BBuild -A%PLATFORM% -DCATCH_TEST_USE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=%examples% -DCATCH_BUILD_EXTRA_TESTS=%examples% -DCATCH_BUILD_SURROGATES=%surrogates% -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_ENABLE_CONFIGURE_TESTS=%configure_tests% || exit /b !ERRORLEVEL! ) ) if "%CONFIGURATION%"=="Release" ( diff --git a/packages/Catch2/tools/misc/appveyorTestRunScript.bat b/packages/Catch2/tools/misc/appveyorTestRunScript.bat index c491d50760393a4057e3685d77204dbc491e2a40..5982fc929044d349f01b22a02177fc840691c26b 100644 --- a/packages/Catch2/tools/misc/appveyorTestRunScript.bat +++ b/packages/Catch2/tools/misc/appveyorTestRunScript.bat @@ -1,5 +1,7 @@ SETLOCAL EnableDelayedExpansion +rem Disable launching the JIT debugger for ctest.exe +reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList" /v "ctest.ext" /t REG_DWORD /d 1 cd Build if "%CONFIGURATION%"=="Debug" ( if "%coverage%"=="1" ( diff --git a/packages/Catch2/tools/scripts/approvalTests.py b/packages/Catch2/tools/scripts/approvalTests.py index 73e9b832394edf95eaa465316ca43f450f34f619..098f40e35bb61f776dab8810dcc03c8a8f2ec8d2 100755 --- a/packages/Catch2/tools/scripts/approvalTests.py +++ b/packages/Catch2/tools/scripts/approvalTests.py @@ -28,47 +28,24 @@ filelocParser = re.compile(r''' ''', 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]+["']''') +# Note: junit must serialize time with 3 (or or less) decimal places +# before generalizing this parser, make sure that this is checked +# in other places too. +junitDurationsParser = re.compile(r' time="[0-9]+\.[0-9]{3}"') +durationParser = 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]+)?') +versionParser = re.compile(r'[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 + 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+) -') @@ -95,9 +72,15 @@ def diffFiles(fileA, fileB): def normalizeFilepath(line): - if catchPath in line: - # make paths relative to Catch root - line = line.replace(catchPath + os.sep, '') + # Sometimes the path separators used by compiler and Python can differ, + # so we try to match the path with both forward and backward path + # separators, to make the paths relative to Catch2 repo root. + forwardSlashPath = catchPath.replace('\\', '/') + if forwardSlashPath in line: + line = line.replace(forwardSlashPath + '/', '') + backwardSlashPath = catchPath.replace('/', '\\') + if backwardSlashPath in line: + line = line.replace(backwardSlashPath + '\\', '') m = langFilenameParser.match(line) if m: @@ -130,7 +113,7 @@ def filterLine(line, isCompact): # 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 + # strip Catch2 version number line = versionParser.sub("<version>", line) # replace *null* with 0 @@ -143,30 +126,44 @@ def filterLine(line, isCompact): line = hexParser.sub("0x<hex digits>", line) # strip durations and timestamps - line = durationsParser.sub(' time="{duration}"', line) - line = sonarqubeDurationParser.sub(' duration="{duration}"', line) + line = junitDurationsParser.sub(' time="{duration}"', line) + line = durationParser.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 +def get_rawResultsPath(baseName): + return os.path.join(rootPath, '_{0}.tmp'.format(baseName)) + + +def get_baselinesPath(baseName): + return os.path.join(rootPath, '{0}.approved.txt'.format(baseName)) + + +def get_filteredResultsPath(baseName): + return os.path.join(rootPath, '{0}.unapproved.txt'.format(baseName)) + + +def run_test(baseName, args): 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)) + print(args) + rawResultsPath = get_rawResultsPath(baseName) f = open(rawResultsPath, 'w') subprocess.call(args, stdout=f, stderr=f) f.close() + +def check_outputs(baseName): + global overallResult + rawResultsPath = get_rawResultsPath(baseName) + baselinesPath = get_baselinesPath(baseName) + filteredResultsPath = get_filteredResultsPath(baseName) + rawFile = io.open(rawResultsPath, 'r', encoding='utf-8', errors='surrogateescape') filteredFile = io.open(filteredResultsPath, 'w', encoding='utf-8', errors='surrogateescape') for line in rawFile: @@ -194,24 +191,44 @@ def approve(baseName, args): overallResult = 1 +def approve(baseName, args): + run_test(baseName, args) + check_outputs(baseName) + + print("Running approvals against executable:") print(" " + cmdPath) +base_args = ["--order", "lex", "--rng-seed", "1", "--colour-mode", "none"] + ## special cases first: # Standard console reporter -approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *", "--order", "lex", "--rng-seed", "1"]) +approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *"] + base_args) # 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"]) +approve("console.swa4", ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "-x", "4"] + base_args) ## 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"] + common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions"] + base_args reporter_args = ['-r', reporter] approve(filename, common_args + reporter_args) +## All reporters at the same time + +common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions"] + base_args +filenames = ['{}.sw.multi'.format(reporter) for reporter in reporters] +reporter_args = [] +for reporter, filename in zip(reporters, filenames): + reporter_args += ['-r', '{}::out={}'.format(reporter, get_rawResultsPath(filename))] + +run_test("default.sw.multi", common_args + reporter_args) +check_outputs("default.sw.multi") +for reporter, filename in zip(reporters, filenames): + check_outputs(filename) + if overallResult != 0: print("If these differences are expected, run approve.py to approve new baselines.") diff --git a/packages/Catch2/tools/scripts/benchmarkCompile.py b/packages/Catch2/tools/scripts/benchmarkCompile.py deleted file mode 100755 index 34113b9e12115c628b3df6150cf8e899c61b7067..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/benchmarkCompile.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/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 deleted file mode 100755 index dc753cf005005add8613d9bd549a2291a96a9001..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/benchmarkRunner.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/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.cmd b/packages/Catch2/tools/scripts/buildAndTest.cmd new file mode 100644 index 0000000000000000000000000000000000000000..e5222a01c20445d6941e87507fbc1d0ebbaceb56 --- /dev/null +++ b/packages/Catch2/tools/scripts/buildAndTest.cmd @@ -0,0 +1,17 @@ +rem Start at the root of the Catch project directory, for example: +rem cd Catch2 + +rem begin-snippet: catch2-build-and-test-win +rem 1. Regenerate the amalgamated distribution +python tools\scripts\generateAmalgamatedFiles.py + +rem 2. Configure the full test build +cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON + +rem 3. Run the actual build +cmake --build debug-build + +rem 4. Run the tests using CTest +cd debug-build +ctest -j 4 --output-on-failure -C Debug +rem end-snippet diff --git a/packages/Catch2/tools/scripts/buildAndTest.sh b/packages/Catch2/tools/scripts/buildAndTest.sh index b343acad4d0af2b74cd75ca7d3ef062601c97686..4a741598b014a0c78196fc8e6d31957459ae5e1f 100755 --- a/packages/Catch2/tools/scripts/buildAndTest.sh +++ b/packages/Catch2/tools/scripts/buildAndTest.sh @@ -8,7 +8,7 @@ ./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 +cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON # 3. Run the actual build cmake --build debug-build diff --git a/packages/Catch2/tools/scripts/checkLicense.py b/packages/Catch2/tools/scripts/checkLicense.py index 3c2a14f40336b0316fcc86eafba211adefe037ef..634b0bfa95fbd16d3f6da7ddc6788aeb744e8491 100755 --- a/packages/Catch2/tools/scripts/checkLicense.py +++ b/packages/Catch2/tools/scripts/checkLicense.py @@ -1,32 +1,45 @@ #!/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] +import sys +import glob - return license +correct_licence = """\ +// 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) -def check_license(license): - failed = 0 - base_dir = "src/catch2/" +// SPDX-License-Identifier: BSL-1.0 +""" - # 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] +def check_licence_in_file(filename: str) -> bool: + with open(filename, 'r') as f: + file_preamble = ''.join(f.readlines()[:7]) - if file_license != license: - print("File %s does not have license" % file) - failed = 1 + if correct_licence != file_preamble: + print('File {} does not have proper licence'.format(filename)) + return False + return True +def check_licences_in_path(path: str) -> int: + failed = 0 + files_to_check = glob.glob(path + '/**/*.cpp', recursive=True) \ + + glob.glob(path + '/**/*.hpp', recursive=True) + for file in files_to_check: + if not check_licence_in_file(file): + failed += 1 return failed - -license = get_license() -status = check_license(license) -sys.exit(status) +def check_licences(): + failed = 0 + roots = ['src/catch2', 'tests'] + for root in roots: + failed += check_licences_in_path(root) + + if failed: + print('{} files are missing licence'.format(failed)) + sys.exit(1) + +if __name__ == "__main__": + check_licences() diff --git a/packages/Catch2/tools/scripts/embed.py b/packages/Catch2/tools/scripts/embed.py deleted file mode 100644 index 6675703314476b88a198b4c59c947e91b45c9ec8..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/embed.py +++ /dev/null @@ -1,63 +0,0 @@ -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 deleted file mode 100755 index d8c1520a919b7958936abdb2171d1f8788d3f133..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/embedClara.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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/generateAmalgamatedFiles.py b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py index eb96d2a949e50ee05e792c493b63487f97823e6b..812712a3a7c22bab5275419b720c9de0f85bf7f0 100755 --- a/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py +++ b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py @@ -79,6 +79,15 @@ def concatenate_file(out, filename: str, expand_headers: bool) -> int: # hundred thousands lines (~300k as of preview3 :-) ) if next_header in concatenated_headers: continue + + # Skip including the auto-generated user config file, + # because it has not been generated yet at this point. + # The code around it should be written so that just not including + # it is equivalent with all-default user configuration. + if next_header == 'catch2/catch_user_config.hpp': + concatenated_headers.add(next_header) + continue + concatenated_headers.add(next_header) concatenated += concatenate_file(out, os.path.join(root_path, next_header), expand_headers) @@ -103,9 +112,9 @@ def generate_cpp(): concatenate_file(cpp, file, False) print('Concatenated {} cpp files'.format(len(cpp_files))) - -generate_header() -generate_cpp() +if __name__ == "__main__": + generate_header() + generate_cpp() # Notes: diff --git a/packages/Catch2/tools/scripts/releaseCommon.py b/packages/Catch2/tools/scripts/releaseCommon.py index 925e801486f812627cf84c3a3ec77380dfd37d14..20ef1b0cd8064d6e95649c4b45babe71dcb970e9 100644 --- a/packages/Catch2/tools/scripts/releaseCommon.py +++ b/packages/Catch2/tools/scripts/releaseCommon.py @@ -78,32 +78,12 @@ class Version: 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') + replacementRegex = re.compile(b'''VERSION (\\d+.\\d+.\\d+) # CML version placeholder, don't delete''') + replacement = '''VERSION {0} # CML version placeholder, don't delete'''.format(version.getVersionString()).encode('ascii') with open(cmakePath, 'wb') as file: for line in lines: file.write(replacementRegex.sub(replacement, line)) @@ -144,23 +124,12 @@ def updateDocumentationVersionPlaceholders(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) + import generateAmalgamatedFiles + generateAmalgamatedFiles.generate_header() + generateAmalgamatedFiles.generate_cpp() - # updateReadmeFile(version) updateCmakeFile(version) updateDocumentationVersionPlaceholders(version) diff --git a/packages/Catch2/tools/scripts/releaseNotes.py b/packages/Catch2/tools/scripts/releaseNotes.py deleted file mode 100755 index 7f580e9839be556952b3fceaa726820e3c8a979e..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/releaseNotes.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/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/updateWandbox.py b/packages/Catch2/tools/scripts/updateWandbox.py deleted file mode 100644 index 3668da52a5f70f2119ab93495bf8e1caa2d819b4..0000000000000000000000000000000000000000 --- a/packages/Catch2/tools/scripts/updateWandbox.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/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/packages/kokkos/.github/workflows/continuous-integration-workflow.yml b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml index f6a8f22308c6bdfc12fb79582755e7f0bf59337a..dba3a70745ce57d91e788e92fefd66a915ae0826 100644 --- a/packages/kokkos/.github/workflows/continuous-integration-workflow.yml +++ b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml @@ -13,24 +13,32 @@ jobs: distro: ['fedora:latest', 'fedora:rawhide', 'ubuntu:latest'] cxx: ['g++', 'clang++'] cmake_build_type: ['Release', 'Debug'] - openmp: ['ON'] + backend: ['OPENMP'] include: - distro: 'fedora:intel' cxx: 'icpc' cmake_build_type: 'Release' - openmp: 'ON' + backend: 'OPENMP' - distro: 'fedora:intel' cxx: 'icpc' cmake_build_type: 'Debug' - openmp: 'ON' + backend: 'OPENMP' - distro: 'fedora:intel' cxx: 'icpx' cmake_build_type: 'Release' - openmp: 'ON' + backend: 'OPENMP' - distro: 'fedora:intel' cxx: 'icpx' cmake_build_type: 'Debug' - openmp: 'ON' + backend: 'OPENMP' + - distro: 'ubuntu:latest' + cxx: 'clang++' + cmake_build_type: 'RelWithDebInfo' + backend: 'THREADS' + - distro: 'ubuntu:latest' + cxx: 'g++' + cmake_build_type: 'RelWithDebInfo' + backend: 'THREADS' runs-on: ubuntu-latest container: image: ghcr.io/kokkos/ci-containers/${{ matrix.distro }} @@ -54,8 +62,9 @@ jobs: run: | cmake -B builddir \ -DCMAKE_INSTALL_PREFIX=/usr \ + -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_HWLOC=ON \ - -DKokkos_ENABLE_OPENMP=${{ matrix.openmp }} \ + -DKokkos_ENABLE_${{ matrix.backend }}=ON \ -DKokkos_ENABLE_TESTS=ON \ -DKokkos_ENABLE_EXAMPLES=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ diff --git a/packages/kokkos/.gitrepo b/packages/kokkos/.gitrepo index 6b9388486be0998ff3de0c89d365e3f245d0231a..91e0f8daac3d6ca34dc5bde954f56a1d8ea44f86 100644 --- a/packages/kokkos/.gitrepo +++ b/packages/kokkos/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:kokkos/kokkos.git branch = master - commit = b52f8c835f4df003954dad66d9761094f8baa66c - parent = 1994bb4f069142aa3f886d30aa0585ed9117eed1 + commit = d19aab9981a2c447e832a7b4eb7b16992328fb14 + parent = a64ea7589ca011edd41ad9a3468d091cd093430c method = merge cmdver = 0.4.3 diff --git a/packages/kokkos/CHANGELOG.md b/packages/kokkos/CHANGELOG.md index dfbe22eddefef9d634aeb21ccde99d3f0d1a7628..a908507704ed725fd8033aaa4da83d439d659178 100644 --- a/packages/kokkos/CHANGELOG.md +++ b/packages/kokkos/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## [3.6.01](https://github.com/kokkos/kokkos/tree/3.6.01) (2022-05-23) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.6.00...3.6.01) + +### Bug Fixes: +- Fix Threads: Fix serial resizing scratch space (3.6.01 cherry-pick) [\#5109](https://github.com/kokkos/kokkos/pull/5109) +- Fix ScatterMin/ScatterMax to use proper atomics (3.6.01 cherry-pick) [\#5046](https://github.com/kokkos/kokkos/pull/5046) +- Fix allocating large Views [\#4907](https://github.com/kokkos/kokkos/pull/4907) +- Fix bounds errors with Kokkos::sort [\#4980](https://github.com/kokkos/kokkos/pull/4980) +- Fix HIP version when printing the configuration [\#4872](https://github.com/kokkos/kokkos/pull/4872) +- Fixed `_CUDA_ARCH__` to `__CUDA_ARCH__` for CUDA LDG [\#4893](https://github.com/kokkos/kokkos/pull/4893) +- Fixed an incorrect struct initialization [\#5028](https://github.com/kokkos/kokkos/pull/5028) +- Fix racing condition in `HIPParallelLaunch` [\#5008](https://github.com/kokkos/kokkos/pull/5008) +- Avoid deprecation warnings with `OpenMPExec::validate_partition` [\#4982](https://github.com/kokkos/kokkos/pull/4982) +- Make View self-assignment not produce double-free [\#5024](https://github.com/kokkos/kokkos/pull/5024) + + ## [3.6.00](https://github.com/kokkos/kokkos/tree/3.6.00) (2022-02-18) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.5.00...3.6.00) diff --git a/packages/kokkos/CMakeLists.txt b/packages/kokkos/CMakeLists.txt index e1c6893725eab7cd75ca388863abf6a146d07f93..b0a54118a0a52482c4670d72f28c133e5b32ef47 100644 --- a/packages/kokkos/CMakeLists.txt +++ b/packages/kokkos/CMakeLists.txt @@ -136,7 +136,7 @@ ENDIF() set(Kokkos_VERSION_MAJOR 3) set(Kokkos_VERSION_MINOR 6) -set(Kokkos_VERSION_PATCH 00) +set(Kokkos_VERSION_PATCH 01) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") diff --git a/packages/kokkos/Makefile.kokkos b/packages/kokkos/Makefile.kokkos index b1afed5d0663a9f70a0896236dd08b71fdf90c2e..10c4bc46300ab9459815b7e4b5282f04150bcabc 100644 --- a/packages/kokkos/Makefile.kokkos +++ b/packages/kokkos/Makefile.kokkos @@ -2,7 +2,7 @@ KOKKOS_VERSION_MAJOR = 3 KOKKOS_VERSION_MINOR = 6 -KOKKOS_VERSION_PATCH = 00 +KOKKOS_VERSION_PATCH = 01 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial diff --git a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp index cde5e6857e59e2b14a33d4b30dd6c8650f1143d8..ce97de9b7dfb1f97116a18c91c714433e451eec8 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp @@ -422,54 +422,34 @@ class BinSort { template <class KeyViewType> struct BinOp1D { - int max_bins_; - double mul_; - typename KeyViewType::const_value_type range_; - typename KeyViewType::const_value_type min_; + int max_bins_ = {}; + double mul_ = {}; + double min_ = {}; - BinOp1D() - : max_bins_(0), - mul_(0.0), - range_(typename KeyViewType::const_value_type()), - min_(typename KeyViewType::const_value_type()) {} + BinOp1D() = default; // Construct BinOp with number of bins, minimum value and maxuimum value BinOp1D(int max_bins__, typename KeyViewType::const_value_type min, typename KeyViewType::const_value_type max) : max_bins_(max_bins__ + 1), - // Cast to int64_t to avoid possible overflow when using integer - mul_(std::is_integral<typename KeyViewType::const_value_type>::value - ? 1.0 * max_bins__ / (int64_t(max) - int64_t(min)) - : 1.0 * max_bins__ / (max - min)), - range_(max - min), - min_(min) { + // Cast to double to avoid possible overflow when using integer + mul_(static_cast<double>(max_bins__) / + (static_cast<double>(max) - static_cast<double>(min))), + min_(static_cast<double>(min)) { // For integral types the number of bins may be larger than the range // in which case we can exactly have one unique value per bin // and then don't need to sort bins. if (std::is_integral<typename KeyViewType::const_value_type>::value && - static_cast<uint64_t>(range_) <= static_cast<uint64_t>(max_bins__)) { + (static_cast<double>(max) - static_cast<double>(min)) <= + static_cast<double>(max_bins__)) { mul_ = 1.; } } // Determine bin index from key value - template < - class ViewType, - std::enable_if_t<!std::is_integral<typename ViewType::value_type>::value, - bool> = true> - KOKKOS_INLINE_FUNCTION int bin(ViewType& keys, const int& i) const { - return int(mul_ * (keys(i) - min_)); - } - - // Determine bin index from key value - template < - class ViewType, - std::enable_if_t<std::is_integral<typename ViewType::value_type>::value, - bool> = true> + template <class ViewType> KOKKOS_INLINE_FUNCTION int bin(ViewType& keys, const int& i) const { - // The cast to int64_t is necessary because otherwise HIP returns the wrong - // result. - return int(mul_ * (int64_t(keys(i)) - int64_t(min_))); + return static_cast<int>(mul_ * (static_cast<double>(keys(i)) - min_)); } // Return maximum bin index + 1 @@ -486,10 +466,9 @@ struct BinOp1D { template <class KeyViewType> struct BinOp3D { - int max_bins_[3]; - double mul_[3]; - typename KeyViewType::non_const_value_type range_[3]; - typename KeyViewType::non_const_value_type min_[3]; + int max_bins_[3] = {}; + double mul_[3] = {}; + double min_[3] = {}; BinOp3D() = default; @@ -498,15 +477,15 @@ struct BinOp3D { max_bins_[0] = max_bins__[0]; max_bins_[1] = max_bins__[1]; max_bins_[2] = max_bins__[2]; - mul_[0] = 1.0 * max_bins__[0] / (max[0] - min[0]); - mul_[1] = 1.0 * max_bins__[1] / (max[1] - min[1]); - mul_[2] = 1.0 * max_bins__[2] / (max[2] - min[2]); - range_[0] = max[0] - min[0]; - range_[1] = max[1] - min[1]; - range_[2] = max[2] - min[2]; - min_[0] = min[0]; - min_[1] = min[1]; - min_[2] = min[2]; + mul_[0] = static_cast<double>(max_bins__[0]) / + (static_cast<double>(max[0]) - static_cast<double>(min[0])); + mul_[1] = static_cast<double>(max_bins__[1]) / + (static_cast<double>(max[1]) - static_cast<double>(min[1])); + mul_[2] = static_cast<double>(max_bins__[2]) / + (static_cast<double>(max[2]) - static_cast<double>(min[2])); + min_[0] = static_cast<double>(min[0]); + min_[1] = static_cast<double>(min[1]); + min_[2] = static_cast<double>(min[2]); } template <class ViewType> @@ -596,9 +575,9 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( // TODO: figure out better max_bins then this ... int64_t max_bins = view.extent(0) / 2; if (std::is_integral<typename ViewType::non_const_value_type>::value) { - // Cast to int64_t to avoid possible overflow when using integer - int64_t const max_val = result.max_val; - int64_t const min_val = result.min_val; + // Cast to double to avoid possible overflow when using integer + auto const max_val = static_cast<double>(result.max_val); + auto const min_val = static_cast<double>(result.min_val); // using 10M as the cutoff for special behavior (roughly 40MB for the count // array) if ((max_val - min_val) < 10000000) { @@ -606,6 +585,10 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( sort_in_bins = false; } } + if (std::is_floating_point<typename ViewType::non_const_value_type>::value) { + KOKKOS_ASSERT(std::isfinite(static_cast<double>(result.max_val) - + static_cast<double>(result.min_val))); + } BinSort<ViewType, CompType> bin_sort( view, CompType(max_bins, result.min_val, result.max_val), sort_in_bins); diff --git a/packages/kokkos/algorithms/unit_tests/TestSort.hpp b/packages/kokkos/algorithms/unit_tests/TestSort.hpp index a03847f2b26d84946e389aabbd496abaf8ec2d5c..9108731c15800fdd5c95a7cc8b7ae751dfa1272d 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSort.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSort.hpp @@ -353,6 +353,55 @@ void test_issue_1160_impl() { } } +template <class ExecutionSpace> +void test_issue_4978_impl() { + Kokkos::View<long long*, ExecutionSpace> element_("element", 9); + + auto h_element = Kokkos::create_mirror_view(element_); + + h_element(0) = LLONG_MIN; + h_element(1) = 0; + h_element(2) = 3; + h_element(3) = 2; + h_element(4) = 1; + h_element(5) = 3; + h_element(6) = 6; + h_element(7) = 4; + h_element(8) = 3; + + ExecutionSpace exec; + Kokkos::deep_copy(exec, element_, h_element); + + Kokkos::sort(exec, element_); + + Kokkos::deep_copy(exec, h_element, element_); + exec.fence(); + + ASSERT_EQ(h_element(0), LLONG_MIN); + ASSERT_EQ(h_element(1), 0); + ASSERT_EQ(h_element(2), 1); + ASSERT_EQ(h_element(3), 2); + ASSERT_EQ(h_element(4), 3); + ASSERT_EQ(h_element(5), 3); + ASSERT_EQ(h_element(6), 3); + ASSERT_EQ(h_element(7), 4); + ASSERT_EQ(h_element(8), 6); +} + +template <class ExecutionSpace, class T> +void test_sort_integer_overflow() { + // array with two extrema in reverse order to expose integer overflow bug in + // bin calculation + T a[2] = {Kokkos::Experimental::finite_max<T>::value, + Kokkos::Experimental::finite_min<T>::value}; + auto vd = Kokkos::create_mirror_view_and_copy( + ExecutionSpace(), Kokkos::View<T[2], Kokkos::HostSpace>(a)); + Kokkos::sort(vd, /*force using Kokkos bin sort*/ true); + auto vh = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), vd); + EXPECT_TRUE(std::is_sorted(vh.data(), vh.data() + 2)) + << "view (" << vh[0] << ", " << vh[1] << ") is not sorted"; +} + //---------------------------------------------------------------------------- template <class ExecutionSpace, typename KeyType> @@ -376,6 +425,11 @@ void test_issue_1160_sort() { test_issue_1160_impl<ExecutionSpace>(); } +template <class ExecutionSpace> +void test_issue_4978_sort() { + test_issue_4978_impl<ExecutionSpace>(); +} + template <class ExecutionSpace, typename KeyType> void test_sort(unsigned int N) { test_1D_sort<ExecutionSpace, KeyType>(N); @@ -385,6 +439,10 @@ void test_sort(unsigned int N) { test_dynamic_view_sort<ExecutionSpace, KeyType>(N); #endif test_issue_1160_sort<ExecutionSpace>(); + test_issue_4978_sort<ExecutionSpace>(); + test_sort_integer_overflow<ExecutionSpace, long long>(); + test_sort_integer_overflow<ExecutionSpace, unsigned long long>(); + test_sort_integer_overflow<ExecutionSpace, int>(); } } // namespace Impl } // namespace Test diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp index 024b4618a46c23b2aee0ff18e0f5d34b24cf8267..e4dd9531fc3555299fdafedf447b585f8e5cd0b2 100644 --- a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp +++ b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp @@ -369,18 +369,6 @@ struct ScatterValue<ValueType, Kokkos::Experimental::ScatterProd, DeviceType, Kokkos::atomic_div(&value, rhs); } - KOKKOS_FORCEINLINE_FUNCTION - void atomic_prod(ValueType& dest, const ValueType& src) const { - bool success = false; - while (!success) { - ValueType dest_old = dest; - ValueType dest_new = dest_old * src; - dest_new = - Kokkos::atomic_compare_exchange<ValueType>(&dest, dest_old, dest_new); - success = ((dest_new - dest_old) / dest_old <= 1e-15); - } - } - KOKKOS_INLINE_FUNCTION void join(ValueType& dest, const ValueType& src) const { atomic_prod(&dest, src); @@ -440,21 +428,9 @@ struct ScatterValue<ValueType, Kokkos::Experimental::ScatterMin, DeviceType, KOKKOS_FORCEINLINE_FUNCTION ScatterValue(ScatterValue&& other) : value(other.value) {} - KOKKOS_FORCEINLINE_FUNCTION - void atomic_min(ValueType& dest, const ValueType& src) const { - bool success = false; - while (!success) { - ValueType dest_old = dest; - ValueType dest_new = (dest_old > src) ? src : dest_old; - dest_new = - Kokkos::atomic_compare_exchange<ValueType>(&dest, dest_old, dest_new); - success = ((dest_new - dest_old) / dest_old <= 1e-15); - } - } - KOKKOS_INLINE_FUNCTION void join(ValueType& dest, const ValueType& src) const { - atomic_min(dest, src); + atomic_min(&dest, src); } KOKKOS_INLINE_FUNCTION @@ -511,21 +487,9 @@ struct ScatterValue<ValueType, Kokkos::Experimental::ScatterMax, DeviceType, KOKKOS_FORCEINLINE_FUNCTION ScatterValue(ScatterValue&& other) : value(other.value) {} - KOKKOS_FORCEINLINE_FUNCTION - void atomic_max(ValueType& dest, const ValueType& src) const { - bool success = false; - while (!success) { - ValueType dest_old = dest; - ValueType dest_new = (dest_old < src) ? src : dest_old; - dest_new = - Kokkos::atomic_compare_exchange<ValueType>(&dest, dest_old, dest_new); - success = ((dest_new - dest_old) / dest_old <= 1e-15); - } - } - KOKKOS_INLINE_FUNCTION void join(ValueType& dest, const ValueType& src) const { - atomic_max(dest, src); + atomic_max(&dest, src); } KOKKOS_INLINE_FUNCTION diff --git a/packages/kokkos/containers/src/Kokkos_Vector.hpp b/packages/kokkos/containers/src/Kokkos_Vector.hpp index 88721bd89eb2fd86543c480727876a58fd888a56..eddb87800321fd0eeac446eb6a37db6b59d6e8ca 100644 --- a/packages/kokkos/containers/src/Kokkos_Vector.hpp +++ b/packages/kokkos/containers/src/Kokkos_Vector.hpp @@ -162,7 +162,7 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> { } DV::sync_host(); DV::modify_host(); - if (it < begin() || it > end()) + if (std::less<>()(it, begin()) || std::less<>()(end(), it)) Kokkos::abort("Kokkos::vector::insert : invalid insert iterator"); if (count == 0) return it; ptrdiff_t start = std::distance(begin(), it); @@ -189,27 +189,21 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> { iterator>::type insert(iterator it, InputIterator b, InputIterator e) { ptrdiff_t count = std::distance(b, e); - if (count == 0) return it; DV::sync_host(); DV::modify_host(); - if (it < begin() || it > end()) + if (std::less<>()(it, begin()) || std::less<>()(end(), it)) Kokkos::abort("Kokkos::vector::insert : invalid insert iterator"); - bool resized = false; - if ((size() == 0) && (it == begin())) { - resize(count); - it = begin(); - resized = true; - } ptrdiff_t start = std::distance(begin(), it); auto org_size = size(); - if (!resized) resize(size() + count); - it = begin() + start; + + // Note: resize(...) invalidates it; use begin() + start instead + resize(size() + count); std::copy_backward(begin() + start, begin() + org_size, begin() + org_size + count); - std::copy(b, e, it); + std::copy(b, e, begin() + start); return begin() + start; } diff --git a/packages/kokkos/containers/unit_tests/TestVector.hpp b/packages/kokkos/containers/unit_tests/TestVector.hpp index 57b92c38f81798331ef183facc76a99bbe45e0be..c093c7b0c9d8b897c2cec9d6f7e8330501f021f2 100644 --- a/packages/kokkos/containers/unit_tests/TestVector.hpp +++ b/packages/kokkos/containers/unit_tests/TestVector.hpp @@ -172,6 +172,23 @@ struct test_vector_insert { run_test(a); check_test(a, size); } + { test_vector_insert_into_empty(size); } + } + + void test_vector_insert_into_empty(const size_t size) { + using Vector = Kokkos::vector<Scalar, Device>; + { + Vector a; + Vector b(size); + a.insert(a.begin(), b.begin(), b.end()); + ASSERT_EQ(a.size(), size); + } + + { + Vector c; + c.insert(c.begin(), size, Scalar{}); + ASSERT_EQ(c.size(), size); + } } }; diff --git a/packages/kokkos/core/src/CMakeLists.txt b/packages/kokkos/core/src/CMakeLists.txt index 88cca93f3cda0939bfa6effaf6f25d971cef9cbc..793e07a84153f29334655c0284602b0677f7feb3 100644 --- a/packages/kokkos/core/src/CMakeLists.txt +++ b/packages/kokkos/core/src/CMakeLists.txt @@ -8,6 +8,7 @@ KOKKOS_INCLUDE_DIRECTORIES( INSTALL (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" DESTINATION ${KOKKOS_HEADER_DIR} + FILES_MATCHING PATTERN desul/src EXCLUDE PATTERN "*.inc" PATTERN "*.inc_*" diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp index 294be2774b8f93edbeba3893b62e978f08ff28d9..aaa9ea8ad4f86fad749e89b379dc4e52428e6518 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp @@ -1007,6 +1007,15 @@ void CudaSpaceInitializer::print_configuration(std::ostream &msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<Cuda>::id; +} +} // namespace Tools +#endif + } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp index 61563a01007f68547a5a4432f36f04ada6fa67f2..dec6ef15e13c01b2778b78fc91a5ed53f200ae38 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp @@ -139,7 +139,7 @@ struct CudaLDGFetch { template <typename iType> KOKKOS_INLINE_FUNCTION ValueType operator[](const iType& i) const { -#if defined(__CUDA_ARCH__) && (350 <= _CUDA_ARCH__) +#if defined(__CUDA_ARCH__) && (350 <= __CUDA_ARCH__) AliasType v = __ldg(reinterpret_cast<const AliasType*>(&m_ptr[i])); return *(reinterpret_cast<ValueType*>(&v)); #else diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 4a6a3ba99ebd7e6850cf117a787f33cf5d1d49f2..a8a0496afebc8776ef99ba4195d6b7b43a58a497 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -132,7 +132,8 @@ void HIPInternal::print_configuration(std::ostream &s) const { s << "macro KOKKOS_ENABLE_HIP : defined" << '\n'; #if defined(HIP_VERSION) s << "macro HIP_VERSION = " << HIP_VERSION << " = version " - << HIP_VERSION / 100 << "." << HIP_VERSION % 100 << '\n'; + << HIP_VERSION_MAJOR << '.' << HIP_VERSION_MINOR << '.' << HIP_VERSION_PATCH + << '\n'; #endif for (int i = 0; i < dev_info.m_hipDevCount; ++i) { @@ -467,7 +468,6 @@ void HIPInternal::finalize() { } char *HIPInternal::get_next_driver(size_t driverTypeSize) const { - std::lock_guard<std::mutex> const lock(m_mutexWorkArray); if (d_driverWorkArray == nullptr) { KOKKOS_IMPL_HIP_SAFE_CALL( hipHostMalloc(&d_driverWorkArray, diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp index 384b7ffd67e488b727d47e0831da4e84e74b3fc3..70b979e00abd6775904b900899eb3200a8c00581 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp @@ -490,6 +490,8 @@ struct HIPParallelLaunch< KOKKOS_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE(); + std::lock_guard<std::mutex> const lock(hip_instance->m_mutexWorkArray); + // Invoke the driver function on the device DriverType *d_driver = reinterpret_cast<DriverType *>( hip_instance->get_next_driver(sizeof(DriverType))); diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp index f334d934123103edb1212e5ab385aebdaf158504..e9cfbf99f7cf11a3773a18b4637363e42a377888 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp @@ -56,8 +56,7 @@ namespace Kokkos { #ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE namespace Impl { -__device__ __constant__ HIPLockArrays g_device_hip_lock_arrays = {nullptr, - nullptr, 0}; +__device__ __constant__ HIPLockArrays g_device_hip_lock_arrays = {nullptr, 0}; } #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index 6ade677fa89f9e778eb5965d3ae5ae8b13cce711..776b7c6abea81e75ac11497e4447409478c64ce4 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -464,6 +464,15 @@ void HIPSpaceInitializer::print_configuration(std::ostream& msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HIP>::id; +} +} // namespace Tools +#endif + } // namespace Kokkos //============================================================================== diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp index acf2224f027de3abff1ab0cc84787c0b0ccfc255..623c7da02569c4763f5d830fea9f2b7cf75855ff 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp @@ -199,6 +199,15 @@ void HPXSpaceInitializer::print_configuration(std::ostream &msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HPX>::id; +} +} // namespace Tools +#endif + } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/Kokkos_Cuda.hpp b/packages/kokkos/core/src/Kokkos_Cuda.hpp index 6305a1fa5d2f21ea9ae9e996a7415a7ee6b6a239..0063b1cd1ee865f38bb556ff9653688e575fc546 100644 --- a/packages/kokkos/core/src/Kokkos_Cuda.hpp +++ b/packages/kokkos/core/src/Kokkos_Cuda.hpp @@ -260,6 +260,7 @@ template <> struct DeviceTypeTraits<Cuda> { /// \brief An ID to differentiate (for example) Serial from OpenMP in Tooling static constexpr DeviceType id = DeviceType::Cuda; + static int device_id(const Cuda& exec) { return exec.cuda_device(); } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/Kokkos_HIP_Space.hpp index 1371d21d388b681a1327dc6330121686c95d165d..68869a6074369e9e15b6c7743a5bbc572ad38a96 100644 --- a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp +++ b/packages/kokkos/core/src/Kokkos_HIP_Space.hpp @@ -571,6 +571,9 @@ namespace Experimental { template <> struct DeviceTypeTraits<Kokkos::Experimental::HIP> { static constexpr DeviceType id = DeviceType::HIP; + static int device_id(const Kokkos::Experimental::HIP& exec) { + return exec.hip_device(); + } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_HPX.hpp b/packages/kokkos/core/src/Kokkos_HPX.hpp index d2ae9c0ec2b3f755f21cc15b3614df8e1f23ed88..9238ca30a7e4260a740c772b9736f0ba9621c19a 100644 --- a/packages/kokkos/core/src/Kokkos_HPX.hpp +++ b/packages/kokkos/core/src/Kokkos_HPX.hpp @@ -500,6 +500,7 @@ namespace Experimental { template <> struct DeviceTypeTraits<Kokkos::Experimental::HPX> { static constexpr DeviceType id = DeviceType::HPX; + static int device_id(const Kokkos::Experimental::HPX &) { return 0; } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_OpenMP.hpp b/packages/kokkos/core/src/Kokkos_OpenMP.hpp index 5d76e689f21b2809a47b262c7ed7485e9116d164..767e5b9324487e2e050828201c1eae6fcbb296d2 100644 --- a/packages/kokkos/core/src/Kokkos_OpenMP.hpp +++ b/packages/kokkos/core/src/Kokkos_OpenMP.hpp @@ -179,6 +179,7 @@ namespace Experimental { template <> struct DeviceTypeTraits<OpenMP> { static constexpr DeviceType id = DeviceType::OpenMP; + static int device_id(const OpenMP&) { return 0; } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp index f394f3240832a67f22e4056fa27e33500b38178c..373dc3d9c7bc22fb6e3b539c232e8ebfad7bb9bc 100644 --- a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp +++ b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp @@ -130,6 +130,9 @@ template <> struct DeviceTypeTraits<::Kokkos::Experimental::OpenMPTarget> { static constexpr DeviceType id = ::Kokkos::Profiling::Experimental::DeviceType::OpenMPTarget; + static int device_id(const Kokkos::Experimental::OpenMPTarget&) { + return omp_get_default_device(); + } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_SYCL.hpp b/packages/kokkos/core/src/Kokkos_SYCL.hpp index 02095ff7b3f01f7558d8e154d1ebc49ff46d1241..e29093db32953b09e5b98541ec3078a46313a885 100644 --- a/packages/kokkos/core/src/Kokkos_SYCL.hpp +++ b/packages/kokkos/core/src/Kokkos_SYCL.hpp @@ -182,6 +182,9 @@ template <> struct DeviceTypeTraits<Kokkos::Experimental::SYCL> { /// \brief An ID to differentiate (for example) Serial from OpenMP in Tooling static constexpr DeviceType id = DeviceType::SYCL; + static int device_id(const Kokkos::Experimental::SYCL& exec) { + return exec.sycl_device(); + } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_Serial.hpp b/packages/kokkos/core/src/Kokkos_Serial.hpp index 9aada48bf607231731895dd96be8e8f9289ce4a4..b2e524c3744556d2797d40bf0ad9becefc69a904 100644 --- a/packages/kokkos/core/src/Kokkos_Serial.hpp +++ b/packages/kokkos/core/src/Kokkos_Serial.hpp @@ -226,6 +226,7 @@ namespace Experimental { template <> struct DeviceTypeTraits<Serial> { static constexpr DeviceType id = DeviceType::Serial; + static int device_id(const Serial&) { return 0; } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/Kokkos_Threads.hpp b/packages/kokkos/core/src/Kokkos_Threads.hpp index 45a2d0e32621a5dd2aff647954aaa56e18692ea2..5879209f12ab8b2abd265878f2d4c276d6d69087 100644 --- a/packages/kokkos/core/src/Kokkos_Threads.hpp +++ b/packages/kokkos/core/src/Kokkos_Threads.hpp @@ -175,6 +175,7 @@ namespace Experimental { template <> struct DeviceTypeTraits<Threads> { static constexpr DeviceType id = DeviceType::Threads; + static int device_id(const Threads&) { return 0; } }; } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.cpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.cpp index d2283d456f0883bd6cea5f0856a1abba95df11a3..66dbbacce9bc8d00f0d8ce6719fcb96f9a0fcfcc 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.cpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.cpp @@ -67,8 +67,9 @@ __thread int t_openmp_hardware_id = 0; __thread Impl::OpenMPExec *t_openmp_instance = nullptr; #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -void OpenMPExec::validate_partition(const int nthreads, int &num_partitions, - int &partition_size) { +void OpenMPExec::validate_partition_impl(const int nthreads, + int &num_partitions, + int &partition_size) { if (nthreads == 1) { num_partitions = 1; partition_size = 1; @@ -506,6 +507,15 @@ void OpenMPSpaceInitializer::print_configuration(std::ostream &msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<OpenMP>::id; +} +} // namespace Tools +#endif + } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.hpp index 2f647af77eb98d1f5a6d161dc5731450b51c3090..ede24d1094f1582f132b82ba6668cc7264c99086 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Exec.hpp @@ -93,7 +93,11 @@ class OpenMPExec { #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 KOKKOS_DEPRECATED static void validate_partition(const int nthreads, int& num_partitions, - int& partition_size); + int& partition_size) { + validate_partition_impl(nthreads, num_partitions, partition_size); + } + static void validate_partition_impl(const int nthreads, int& num_partitions, + int& partition_size); #endif private: @@ -179,8 +183,8 @@ KOKKOS_DEPRECATED void OpenMP::partition_master(F const& f, int num_partitions, Exec* prev_instance = Impl::t_openmp_instance; - Exec::validate_partition(prev_instance->m_pool_size, num_partitions, - partition_size); + Exec::validate_partition_impl(prev_instance->m_pool_size, num_partitions, + partition_size); OpenMP::memory_space space; diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp index 907e4e9efe1cd4c2921d0721e73b971fa8104d2f..45aacd7258a62c8afe8b25c439bfb1f505f093bc 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp @@ -72,7 +72,7 @@ class SYCLInternal { bool force_shrink = false); uint32_t impl_get_instance_id() const; - int m_syclDev = -1; + int m_syclDev = 0; size_t m_maxWorkgroupSize = 0; uint32_t m_maxConcurrency = 0; diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp index 8a7c49871bc0e3bed33de6fe75eaa3f207739c65..9682564ee0bb339f5e9f412c3d1214e8de94771c 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp +++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp @@ -399,27 +399,68 @@ bool ThreadsExec::wake() { //---------------------------------------------------------------------------- -void *ThreadsExec::root_reduce_scratch() { - return s_threads_process.reduce_memory(); -} +void ThreadsExec::execute_resize_scratch_in_serial() { + const unsigned begin = s_threads_process.m_pool_base ? 1 : 0; -void ThreadsExec::execute_resize_scratch(ThreadsExec &exec, const void *) { - using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HostSpace, void>; + auto deallocate_scratch_memory = [](ThreadsExec &exec) { + if (exec.m_scratch) { + using Record = + Kokkos::Impl::SharedAllocationRecord<Kokkos::HostSpace, void>; + Record *const r = Record::get_record(exec.m_scratch); + exec.m_scratch = nullptr; + Record::decrement(r); + } + }; + if (s_threads_process.m_pool_base) { + for (unsigned i = s_thread_pool_size[0]; begin < i;) { + deallocate_scratch_memory(*s_threads_exec[--i]); + } + } - if (exec.m_scratch) { - Record *const r = Record::get_record(exec.m_scratch); + s_current_function = &first_touch_allocate_thread_private_scratch; + s_current_function_arg = &s_threads_process; - exec.m_scratch = nullptr; + // Make sure function and arguments are written before activating threads. + memory_fence(); - Record::decrement(r); + for (unsigned i = s_thread_pool_size[0]; begin < i;) { + ThreadsExec &th = *s_threads_exec[--i]; + + th.m_pool_state = ThreadsExec::Active; + + wait_yield(th.m_pool_state, ThreadsExec::Active); } + if (s_threads_process.m_pool_base) { + deallocate_scratch_memory(s_threads_process); + s_threads_process.m_pool_state = ThreadsExec::Active; + first_touch_allocate_thread_private_scratch(s_threads_process, nullptr); + s_threads_process.m_pool_state = ThreadsExec::Inactive; + } + + s_current_function_arg = nullptr; + s_current_function = nullptr; + + // Make sure function and arguments are cleared before proceeding. + memory_fence(); +} + +//---------------------------------------------------------------------------- + +void *ThreadsExec::root_reduce_scratch() { + return s_threads_process.reduce_memory(); +} + +void ThreadsExec::first_touch_allocate_thread_private_scratch(ThreadsExec &exec, + const void *) { exec.m_scratch_reduce_end = s_threads_process.m_scratch_reduce_end; exec.m_scratch_thread_end = s_threads_process.m_scratch_thread_end; if (s_threads_process.m_scratch_thread_end) { // Allocate tracked memory: { + using Record = + Kokkos::Impl::SharedAllocationRecord<Kokkos::HostSpace, void>; Record *const r = Record::allocate(Kokkos::HostSpace(), "Kokkos::thread_scratch", s_threads_process.m_scratch_thread_end); @@ -461,7 +502,7 @@ void *ThreadsExec::resize_scratch(size_t reduce_size, size_t thread_size) { s_threads_process.m_scratch_reduce_end = reduce_size; s_threads_process.m_scratch_thread_end = reduce_size + thread_size; - execute_resize_scratch(s_threads_process, nullptr); + execute_resize_scratch_in_serial(); s_threads_process.m_scratch = s_threads_exec[0]->m_scratch; } @@ -845,6 +886,15 @@ void ThreadsSpaceInitializer::print_configuration(std::ostream &msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<Threads>::id; +} +} // namespace Tools +#endif + } /* namespace Kokkos */ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp index 561b1ce292eb387a45891ef2de8c678a3bdda2e1..d17f417bbcac13c2542ed583fbd48bccf0dd3f9b 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp @@ -123,12 +123,15 @@ class ThreadsExec { static void global_unlock(); static void spawn(); - static void execute_resize_scratch(ThreadsExec &, const void *); + static void first_touch_allocate_thread_private_scratch(ThreadsExec &, + const void *); static void execute_sleep(ThreadsExec &, const void *); ThreadsExec(const ThreadsExec &); ThreadsExec &operator=(const ThreadsExec &); + static void execute_resize_scratch_in_serial(); + public: KOKKOS_INLINE_FUNCTION int pool_size() const { return m_pool_size; } KOKKOS_INLINE_FUNCTION int pool_rank() const { return m_pool_rank; } diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp index 4e0e81405f00da10a9a6c89f5360edde08df9e1f..d5266820560eb22b5f71309aff7acaabc9de9ee6 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp @@ -118,11 +118,14 @@ template <typename ExecutionSpace> constexpr uint32_t device_id_root() { constexpr auto device_id = static_cast<uint32_t>(DeviceTypeTraits<ExecutionSpace>::id); - return (device_id << num_instance_bits); + return (device_id << (num_instance_bits + num_device_bits)); } template <typename ExecutionSpace> inline uint32_t device_id(ExecutionSpace const& space) noexcept { - return device_id_root<ExecutionSpace>() + space.impl_instance_id(); + return device_id_root<ExecutionSpace>() + + (DeviceTypeTraits<ExecutionSpace>::device_id(space) + << num_instance_bits) + + space.impl_instance_id(); } } // namespace Experimental } // namespace Tools diff --git a/packages/kokkos/core/src/impl/Kokkos_Serial.cpp b/packages/kokkos/core/src/impl/Kokkos_Serial.cpp index c49e838d8f0b0961b9dfd2bc76c07b5370cb2629..e5917eb59d1aba7a1cb9197fe841361ecca4d512 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Serial.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Serial.cpp @@ -233,6 +233,15 @@ void SerialSpaceInitializer::print_configuration(std::ostream& msg, } } // namespace Impl + +#ifdef KOKKOS_ENABLE_CXX14 +namespace Tools { +namespace Experimental { +constexpr DeviceType DeviceTypeTraits<Serial>::id; +} +} // namespace Tools +#endif + } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp index 09f7af09186966dd797e8c6d6b19b3e735fa4d73..f606a39839ff0f00317709ec9aa24374d762a853 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp @@ -1005,15 +1005,15 @@ struct ViewOffset< /* Cardinality of the domain index space */ KOKKOS_INLINE_FUNCTION constexpr size_type size() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } /* Span of the range space */ KOKKOS_INLINE_FUNCTION constexpr size_type span() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const { @@ -1026,23 +1026,24 @@ struct ViewOffset< return m_dim.N0; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_2() const { - return m_dim.N0 * m_dim.N1; + return size_type(m_dim.N0) * m_dim.N1; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_3() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_4() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_5() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_6() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5; } KOKKOS_INLINE_FUNCTION constexpr size_type stride_7() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6; } // Stride with [ rank ] value is the total length @@ -1288,8 +1289,8 @@ struct ViewOffset< /* Cardinality of the domain index space */ KOKKOS_INLINE_FUNCTION constexpr size_type size() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } /* Span of the range space */ @@ -1633,15 +1634,15 @@ struct ViewOffset< /* Cardinality of the domain index space */ KOKKOS_INLINE_FUNCTION constexpr size_type size() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } /* Span of the range space */ KOKKOS_INLINE_FUNCTION constexpr size_type span() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const { @@ -1916,14 +1917,14 @@ struct ViewOffset< /* Cardinality of the domain index space */ KOKKOS_INLINE_FUNCTION constexpr size_type size() const { - return m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * m_dim.N5 * - m_dim.N6 * m_dim.N7; + return size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * + m_dim.N5 * m_dim.N6 * m_dim.N7; } /* Span of the range space */ KOKKOS_INLINE_FUNCTION constexpr size_type span() const { - return size() > 0 ? m_dim.N0 * m_stride : 0; + return size() > 0 ? size_type(m_dim.N0) * m_stride : 0; } KOKKOS_INLINE_FUNCTION constexpr bool span_is_contiguous() const { @@ -2066,27 +2067,29 @@ struct ViewOffset< stride(/* 2 <= rank */ m_dim.N1 * (dimension_type::rank == 2 - ? 1 + ? size_t(1) : m_dim.N2 * (dimension_type::rank == 3 - ? 1 + ? size_t(1) : m_dim.N3 * (dimension_type::rank == 4 - ? 1 + ? size_t(1) : m_dim.N4 * (dimension_type::rank == 5 - ? 1 + ? size_t(1) : m_dim.N5 * (dimension_type:: rank == 6 - ? 1 + ? size_t( + 1) : m_dim.N6 * (dimension_type:: rank == 7 - ? 1 + ? size_t( + 1) : m_dim .N7)))))))) { } @@ -2447,8 +2450,8 @@ struct ViewOffset<Dimension, Kokkos::LayoutStride, void> { constexpr size_type size() const { return dimension_type::rank == 0 ? 1 - : m_dim.N0 * m_dim.N1 * m_dim.N2 * m_dim.N3 * m_dim.N4 * - m_dim.N5 * m_dim.N6 * m_dim.N7; + : size_type(m_dim.N0) * m_dim.N1 * m_dim.N2 * m_dim.N3 * + m_dim.N4 * m_dim.N5 * m_dim.N6 * m_dim.N7; } private: diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp index fe3651886bd138a0662e4799bcef8950ee4e1e26..972b1b6d9afdffd379f803c003dd35ddab7c751c 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp @@ -91,6 +91,7 @@ struct ViewTracker { template <class RT, class... RP> KOKKOS_INLINE_FUNCTION void assign(const View<RT, RP...>& vt) noexcept { + if (this == reinterpret_cast<const ViewTracker*>(&vt.m_track)) return; KOKKOS_IF_ON_HOST(( if (view_traits::is_managed && Kokkos::Impl::SharedAllocationRecord< void, void>::tracking_enabled()) { @@ -102,6 +103,7 @@ struct ViewTracker { KOKKOS_INLINE_FUNCTION ViewTracker& operator=( const ViewTracker& rhs) noexcept { + if (this == &rhs) return *this; KOKKOS_IF_ON_HOST(( if (view_traits::is_managed && Kokkos::Impl::SharedAllocationRecord< void, void>::tracking_enabled()) { diff --git a/packages/kokkos/core/unit_test/TestViewAPI.hpp b/packages/kokkos/core/unit_test/TestViewAPI.hpp index 21602be086b40d582608042f06d0260a5d63cfac..83efae6170dfe098432f16383f600ea01412cbe0 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI.hpp @@ -1087,6 +1087,20 @@ class TestViewAPI { dView4_unmanaged unmanaged_dx = dx; ASSERT_EQ(dx.use_count(), 1); + // Test self assignment +#if defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wself-assign-overloaded" +#endif + dx = dx; // copy-assignment operator +#if defined(__clang__) +#pragma GCC diagnostic pop +#endif + ASSERT_EQ(dx.use_count(), 1); + dx = reinterpret_cast<typename dView4::uniform_type &>( + dx); // conversion assignment operator + ASSERT_EQ(dx.use_count(), 1); + dView4_unmanaged unmanaged_from_ptr_dx = dView4_unmanaged( dx.data(), dx.extent(0), dx.extent(1), dx.extent(2), dx.extent(3)); diff --git a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp index d4f484a530c952a33b20dada3222180c7785f06a..d1d38022a74e256e06103bd18d3e3cccd9db413e 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp @@ -240,6 +240,35 @@ struct TestViewOverloadResolution { TEST(TEST_CATEGORY, view_overload_resolution) { TestViewOverloadResolution<TEST_EXECSPACE>::test_function_overload(); } + +template <typename MemorySpace> +struct TestViewAllocationLargeRank { + using ViewType = Kokkos::View<char********, MemorySpace>; + + KOKKOS_FUNCTION void operator()(int) const { + size_t idx = v.extent(0) - 1; + auto& lhs = v(idx, idx, idx, idx, idx, idx, idx, idx); + lhs = 42; // This is where it segfaulted + } + + ViewType v; +}; + +TEST(TEST_CATEGORY, view_allocation_large_rank) { + using ExecutionSpace = typename TEST_EXECSPACE::execution_space; + using MemorySpace = typename TEST_EXECSPACE::memory_space; + constexpr int dim = 16; + using FunctorType = TestViewAllocationLargeRank<MemorySpace>; + typename FunctorType::ViewType v("v", dim, dim, dim, dim, dim, dim, dim, dim); + + Kokkos::parallel_for(Kokkos::RangePolicy<ExecutionSpace>(0, 1), + FunctorType{v}); + typename FunctorType::ViewType v_single(v.data() + v.size() - 1, 1, 1, 1, 1, + 1, 1, 1, 1); + auto result = + Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, v_single); + ASSERT_EQ(result(0, 0, 0, 0, 0, 0, 0, 0), 42); +} } // namespace Test #include <TestViewIsAssignable.hpp> diff --git a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp index 08863232ed679c5e70e87a69d02971825427ee07..bb1d3156f53f5b0470303a9748a02b2e532a736a 100644 --- a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp +++ b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp @@ -238,13 +238,10 @@ TEST(kokkosp, test_id_gen) { using Kokkos::Tools::Experimental::DeviceTypeTraits; test_wrapper([&]() { Kokkos::DefaultExecutionSpace ex; - auto id = device_id(ex); - auto id_ref = identifier_from_devid(id); - auto success = (id_ref.instance_id == ex.impl_instance_id()) && - (id_ref.device_id == - static_cast<uint32_t>( - DeviceTypeTraits<Kokkos::DefaultExecutionSpace>::id)); - ASSERT_TRUE(success); + auto id = device_id(ex); + auto id_ref = identifier_from_devid(id); + ASSERT_EQ(DeviceTypeTraits<decltype(ex)>::id, id_ref.type); + ASSERT_EQ(id_ref.instance_id, ex.impl_instance_id()); }); } @@ -253,6 +250,7 @@ TEST(kokkosp, test_id_gen) { */ TEST(kokkosp, test_kernel_sequence) { test_wrapper([&]() { + Kokkos::DefaultExecutionSpace ex; auto root = Kokkos::Tools::Experimental::device_id_root< Kokkos::DefaultExecutionSpace>(); std::vector<FencePayload> expected{ @@ -260,11 +258,10 @@ TEST(kokkosp, test_kernel_sequence) { {"named_instance", FencePayload::distinguishable_devices::no, root + num_instances}, {"test_kernel", FencePayload::distinguishable_devices::no, - root + num_instances} + Kokkos::Tools::Experimental::device_id(ex)} }; expect_fence_events(expected, [=]() { - Kokkos::DefaultExecutionSpace ex; TestFunctor tf; ex.fence("named_instance"); Kokkos::parallel_for( diff --git a/packages/kokkos/master_history.txt b/packages/kokkos/master_history.txt index e174b47f67c1344c2aa355e0d96ab307f41edac0..41c755a8a84be166c3e82b892b8b26b4d5df2bf7 100644 --- a/packages/kokkos/master_history.txt +++ b/packages/kokkos/master_history.txt @@ -27,3 +27,4 @@ tag: 3.4.00 date: 04:26:2021 master: 1fb0c284 release: 5d7738d6 tag: 3.4.01 date: 05:20:2021 master: 4b97a22f release: 410b15c8 tag: 3.5.00 date: 11:19:2021 master: c28a8b03 release: 21b879e4 tag: 3.6.00 date: 04:14:2022 master: 2834f94a release: 6ea708ff +tag: 3.6.01 date: 06:16:2022 master: b52f8c83 release: afe9b404 diff --git a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject index 1df32051b40fc17f0dce457d0beb2815d8425e6d..e4ab07dbc250b945ce654803409371ff4f6f1db3 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject +++ b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject @@ -1,5 +1,7 @@ FROM nvidia/cuda:10.1-devel +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub + RUN apt-get update && apt-get install -y \ bc \ git \ diff --git a/packages/kokkos/scripts/docker/Dockerfile.nvcc b/packages/kokkos/scripts/docker/Dockerfile.nvcc index c3e7a875f3707b601bb3a2a8d379accea352ec5f..cbae8e47dde923705a1065c9330bbc11d0febd16 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.nvcc +++ b/packages/kokkos/scripts/docker/Dockerfile.nvcc @@ -3,6 +3,8 @@ FROM $BASE ARG ADDITIONAL_PACKAGES +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub + RUN apt-get update && apt-get install -y \ bc \ wget \ diff --git a/packages/kokkos/scripts/docker/Dockerfile.openmptarget b/packages/kokkos/scripts/docker/Dockerfile.openmptarget index 0599c60857927a68710404a9f3ce597292a58c2f..caeee1821a00866662cce2b6efa30b5b9d1c82a6 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.openmptarget +++ b/packages/kokkos/scripts/docker/Dockerfile.openmptarget @@ -1,4 +1,4 @@ -ARG BASE=nvidia/cuda:11.1-devel-ubuntu20.04 +ARG BASE=nvidia/cuda:11.1.1-devel-ubuntu20.04 FROM $BASE RUN apt-get update && apt-get install -y \ diff --git a/packages/kokkos/scripts/docker/Dockerfile.sycl b/packages/kokkos/scripts/docker/Dockerfile.sycl index 8f08fe2e528f93b09a8c1a1df4624b3a040f07d6..1cd700648a23341eae53068e770eb144a784aad0 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.sycl +++ b/packages/kokkos/scripts/docker/Dockerfile.sycl @@ -1,6 +1,8 @@ ARG BASE=nvidia/cuda:10.2-devel FROM $BASE +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub + RUN apt-get update && apt-get install -y \ bc \ wget \ diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp index 10314a4dc3b071aa065c36820261e7f596ab7a25..f2a2fe63a437e969a393a418eb529653b692dd12 100644 --- a/tests/mpi_test_main.cpp +++ b/tests/mpi_test_main.cpp @@ -57,13 +57,28 @@ main(int argc, char* argv[]) parallel_output /= output_base_name + stringify(parallel::rank()); Catch::ConfigData data{session.configData()}; - data.outputFilename = parallel_output.string(); + data.defaultOutputFilename = parallel_output.string(); session.useConfigData(data); } std::cout << "Using " << nb_threads << " threads per process [" << nb_threads << "x" << parallel::Messenger::getInstance().size() << "]\n"; + if (parallel::rank() == 0) { + if (parallel::size() > 1) { + std::cout << rang::fgB::green << "Other rank outputs are stored in corresponding files" << rang::style::reset + << '\n'; + + for (size_t i_rank = 1; i_rank < parallel::size(); ++i_rank) { + std::filesystem::path parallel_output = std::filesystem::path{PUGS_BINARY_DIR}.append("tests"); + parallel_output /= output_base_name + stringify(i_rank); + std::cout << " - " << rang::fg::green << parallel_output.parent_path().string() + << parallel_output.preferred_separator << rang::style::reset << rang::fgB::green + << parallel_output.filename().string() << rang::style::reset << '\n'; + } + } + } + // Disable outputs from tested classes to the standard output std::cout.setstate(std::ios::badbit); @@ -76,21 +91,6 @@ main(int argc, char* argv[]) MeshDataBaseForTests::create(); - if (parallel::rank() == 0) { - if (parallel::size() > 1) { - session.config().stream() << rang::fgB::green << "Other rank outputs are stored in corresponding files" - << rang::style::reset << '\n'; - - for (size_t i_rank = 1; i_rank < parallel::size(); ++i_rank) { - std::filesystem::path parallel_output = std::filesystem::path{PUGS_BINARY_DIR}.append("tests"); - parallel_output /= output_base_name + stringify(i_rank); - session.config().stream() << " - " << rang::fg::green << parallel_output.parent_path().string() - << parallel_output.preferred_separator << rang::style::reset << rang::fgB::green - << parallel_output.filename().string() << rang::style::reset << '\n'; - } - } - } - OperatorRepository::create(); result = session.run();