├── Alltest
├── reports
└── .gitignore
├── demo.gif
├── catch2
├── .github
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE
│ │ ├── feature_request.md
│ │ └── bug_report.md
│ ├── workflows
│ │ ├── linux-bazel-builds.yml
│ │ ├── package-manager-builds.yaml
│ │ ├── mac-builds.yml
│ │ ├── windows-simple-builds.yml
│ │ ├── validate-header-guards.yml
│ │ └── linux-meson-builds.yml
│ └── pull_request_template.md
├── tests
│ ├── SelfTest
│ │ ├── Misc
│ │ │ ├── invalid-test-names.input
│ │ │ ├── plain-old-tests.input
│ │ │ └── special-characters-in-file.input
│ │ ├── Baselines
│ │ │ └── default.sw.multi.approved.txt
│ │ ├── helpers
│ │ │ ├── parse_test_spec.hpp
│ │ │ └── parse_test_spec.cpp
│ │ ├── UsageTests
│ │ │ ├── VariadicMacros.tests.cpp
│ │ │ ├── ToStringByte.tests.cpp
│ │ │ ├── Decomposition.tests.cpp
│ │ │ └── ToStringOptional.tests.cpp
│ │ ├── TimingTests
│ │ │ └── Sleep.tests.cpp
│ │ └── IntrospectiveTests
│ │ │ ├── Stream.tests.cpp
│ │ │ ├── AssertionHandler.tests.cpp
│ │ │ └── Parse.tests.cpp
│ ├── ExtraTests
│ │ ├── X92-NoTests.cpp
│ │ ├── X93-AllSkipped.cpp
│ │ ├── X30-BazelReporter.cpp
│ │ ├── X31-DuplicatedTestCases.cpp
│ │ ├── X32-DuplicatedTestCasesDifferentTags.cpp
│ │ ├── ToDo.txt
│ │ ├── X05-DeferredStaticChecks.cpp
│ │ ├── X90-WindowsHeaderInclusion.cpp
│ │ ├── X33-DuplicatedTestCaseMethods.cpp
│ │ ├── X12-CustomDebugBreakMacro.cpp
│ │ ├── X11-DisableStringification.cpp
│ │ ├── X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp
│ │ ├── X40-QuickExit.cpp
│ │ ├── X10-FallbackStringifier.cpp
│ │ ├── X36-ReportingCrashWithJunitReporter.cpp
│ │ ├── X91-AmalgamatedCatch.cpp
│ │ ├── X35-DuplicatedReporterNames.cpp
│ │ ├── X04-DisabledExceptions-CustomHandler.cpp
│ │ ├── X23-CasingInReporterNames.cpp
│ │ └── X03-DisabledExceptions-DefaultHandler.cpp
│ └── TestScripts
│ │ └── DiscoverTests
│ │ ├── CMakeLists.txt
│ │ └── register-tests.cpp
├── data
│ └── sponsors
│ │ └── github_repo_sponsorship.png
├── tools
│ ├── scripts
│ │ ├── scriptCommon.py
│ │ ├── developBuild.py
│ │ ├── patchRelease.py
│ │ ├── majorRelease.py
│ │ ├── minorRelease.py
│ │ ├── checkDuplicateFilenames.py
│ │ ├── buildAndTest.cmd
│ │ ├── buildAndTest.sh
│ │ ├── updateDocumentSnippets.py
│ │ └── approve.py
│ └── misc
│ │ ├── CMakeLists.txt
│ │ ├── appveyorMergeCoverageScript.py
│ │ ├── appveyorTestRunScript.bat
│ │ ├── SelfTest.vcxproj.user
│ │ ├── installOpenCppCoverage.ps1
│ │ └── appveyorBuildConfigurationScript.bat
├── meson_options.txt
├── mdsnippets.json
├── MODULE.bazel
├── .conan
│ └── test_package
│ │ ├── CMakeLists.txt
│ │ └── test_package.cpp
├── CMake
│ ├── Catch2Config.cmake.in
│ ├── catch2.pc.in
│ ├── catch2-with-main.pc.in
│ └── llvm-cov-wrapper
├── .bazelrc
├── MAINTAINERS.md
├── codecov.yml
├── src
│ └── catch2
│ │ ├── interfaces
│ │ ├── catch_interfaces_config.cpp
│ │ ├── catch_interfaces_testcase.cpp
│ │ ├── catch_interfaces_registry_hub.cpp
│ │ ├── catch_interfaces_reporter_factory.cpp
│ │ ├── catch_interfaces_exception.cpp
│ │ ├── catch_interfaces_capture.cpp
│ │ ├── catch_interfaces_test_invoker.hpp
│ │ ├── catch_interfaces_tag_alias_registry.hpp
│ │ ├── catch_interfaces_generatortracker.cpp
│ │ ├── catch_interfaces_testcase.hpp
│ │ └── catch_interfaces_exception.hpp
│ │ ├── internal
│ │ ├── catch_errno_guard.cpp
│ │ ├── catch_uncaught_exceptions.hpp
│ │ ├── catch_debug_console.hpp
│ │ ├── catch_leak_detector.hpp
│ │ ├── catch_stdstreams.hpp
│ │ ├── catch_polyfills.hpp
│ │ ├── catch_getenv.hpp
│ │ ├── catch_commandline.hpp
│ │ ├── catch_deprecation_macro.hpp
│ │ ├── catch_context.cpp
│ │ ├── catch_console_width.hpp
│ │ ├── catch_void_type.hpp
│ │ ├── catch_stdstreams.cpp
│ │ ├── catch_preprocessor_internal_stringify.hpp
│ │ ├── catch_move_and_forward.hpp
│ │ ├── catch_random_seed_generation.hpp
│ │ ├── catch_errno_guard.hpp
│ │ ├── catch_uncaught_exceptions.cpp
│ │ ├── catch_test_case_info_hasher.hpp
│ │ ├── catch_preprocessor_remove_parens.hpp
│ │ ├── catch_parse_numbers.hpp
│ │ ├── catch_windows_h_proxy.hpp
│ │ ├── catch_unique_name.hpp
│ │ ├── catch_to_string.hpp
│ │ ├── catch_startup_exception_registry.hpp
│ │ ├── catch_stream_end_stop.hpp
│ │ ├── catch_noncopyable.hpp
│ │ ├── catch_message_info.cpp
│ │ ├── catch_test_failure_exception.cpp
│ │ ├── catch_lazy_expr.cpp
│ │ ├── catch_exception_translator_registry.hpp
│ │ ├── catch_getenv.cpp
│ │ ├── catch_config_prefix_messages.hpp
│ │ ├── catch_config_android_logwrite.hpp
│ │ ├── catch_list.hpp
│ │ ├── catch_startup_exception_registry.cpp
│ │ ├── catch_case_insensitive_comparisons.hpp
│ │ ├── catch_random_seed_generation.cpp
│ │ ├── catch_config_counter.hpp
│ │ ├── catch_singletons.cpp
│ │ ├── catch_decomposer.cpp
│ │ ├── catch_tag_alias_registry.hpp
│ │ ├── catch_config_wchar.hpp
│ │ ├── catch_test_failure_exception.hpp
│ │ ├── catch_source_line_info.hpp
│ │ ├── catch_wildcard_pattern.hpp
│ │ ├── catch_enum_values_registry.hpp
│ │ ├── catch_leak_detector.cpp
│ │ ├── catch_enforce.cpp
│ │ ├── catch_source_line_info.cpp
│ │ ├── catch_case_insensitive_comparisons.cpp
│ │ ├── catch_lazy_expr.hpp
│ │ ├── catch_polyfills.cpp
│ │ ├── catch_config_static_analysis_support.hpp
│ │ ├── catch_singletons.hpp
│ │ ├── catch_debug_console.cpp
│ │ ├── catch_test_case_info_hasher.cpp
│ │ ├── catch_logical_traits.hpp
│ │ └── catch_floating_point_helpers.cpp
│ │ ├── catch_case_sensitive.hpp
│ │ ├── catch_version_macros.hpp
│ │ ├── generators
│ │ ├── catch_generator_exception.cpp
│ │ ├── catch_generator_exception.hpp
│ │ └── catch_generators_all.hpp
│ │ ├── catch_get_random_seed.cpp
│ │ ├── catch_get_random_seed.hpp
│ │ ├── benchmark
│ │ ├── catch_chronometer.cpp
│ │ ├── catch_estimate.hpp
│ │ ├── detail
│ │ │ ├── catch_benchmark_function.cpp
│ │ │ ├── catch_analyse.hpp
│ │ │ ├── catch_benchmark_stats_fwd.hpp
│ │ │ ├── catch_timing.hpp
│ │ │ ├── catch_run_for_at_least.cpp
│ │ │ ├── catch_repeat.hpp
│ │ │ └── catch_measure.hpp
│ │ ├── catch_clock.hpp
│ │ ├── catch_environment.hpp
│ │ ├── catch_sample_analysis.hpp
│ │ └── catch_outlier_classification.hpp
│ │ ├── matchers
│ │ ├── catch_matchers_predicate.cpp
│ │ ├── catch_matchers.cpp
│ │ ├── catch_matchers_exception.cpp
│ │ ├── catch_matchers_quantifiers.cpp
│ │ ├── catch_matchers_container_properties.cpp
│ │ └── internal
│ │ │ └── catch_matchers_impl.cpp
│ │ ├── catch_test_run_info.hpp
│ │ ├── catch_translate_exception.cpp
│ │ ├── reporters
│ │ ├── catch_reporter_streaming_base.cpp
│ │ ├── catch_reporter_compact.hpp
│ │ ├── catch_reporter_registrars.cpp
│ │ └── catch_reporter_automake.cpp
│ │ ├── catch_tag_alias.hpp
│ │ ├── catch_timer.hpp
│ │ ├── catch_assertion_info.hpp
│ │ ├── catch_tag_alias_autoregistrar.cpp
│ │ ├── catch_totals.hpp
│ │ ├── catch_tag_alias_autoregistrar.hpp
│ │ ├── catch_version.hpp
│ │ ├── catch_timer.cpp
│ │ ├── catch_section_info.hpp
│ │ └── catch_version.cpp
├── meson.build
├── benchmarks
│ ├── CMakeLists.txt
│ ├── runtime_assertion_benches.cpp
│ └── assertion_listener.cpp
├── fuzzing
│ ├── NullOStream.cpp
│ ├── fuzz_XmlWriter.cpp
│ ├── fuzz_TestSpecParser.cpp
│ ├── build_fuzzers.sh
│ ├── NullOStream.h
│ └── CMakeLists.txt
├── docs
│ └── commercial-users.md
├── extras
│ ├── lldbinit
│ └── gdbinit
├── .gitattributes
├── SECURITY.md
├── .gitignore
├── .clang-format
├── LICENSE.txt
└── examples
│ └── 020-TestCase-1.cpp
├── tests
└── exampleTests
│ ├── Make
│ ├── files
│ └── options
│ ├── noCase.C
│ └── time.C
├── .devcontainer
└── devcontainer.json
├── generate.sh
├── cases
└── cavity
│ ├── system
│ ├── fvSolution
│ ├── decomposeParDict
│ ├── controlDict
│ ├── blockMeshDict
│ └── fvSchemes
│ └── constant
│ └── polyMesh
│ └── boundary
├── src
├── initialize.sh
└── lib
│ ├── cleanup.sh
│ ├── create_dummy_libs.sh
│ ├── setup_test_symlinks.sh
│ ├── compile_test_drivers.sh
│ └── compile_catch2.sh
├── .github
└── workflows
│ ├── of9.yml
│ ├── of2206.yml
│ └── fe5.yml
└── LISENCE.txt
/Alltest:
--------------------------------------------------------------------------------
1 | foamut
--------------------------------------------------------------------------------
/reports/.gitignore:
--------------------------------------------------------------------------------
1 | ./tests/*
2 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FoamScience/foamUT/HEAD/demo.gif
--------------------------------------------------------------------------------
/catch2/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: "horenmar"
2 | custom: "https://www.paypal.me/horenmar"
3 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/Misc/invalid-test-names.input:
--------------------------------------------------------------------------------
1 | Test with special, characters in \" name
2 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/Misc/plain-old-tests.input:
--------------------------------------------------------------------------------
1 | random SECTION tests
2 | nested SECTION tests
3 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/Misc/special-characters-in-file.input:
--------------------------------------------------------------------------------
1 | Test with special\, characters \"in name
2 |
--------------------------------------------------------------------------------
/tests/exampleTests/Make/files:
--------------------------------------------------------------------------------
1 | $(FOAM_FOAMUT)/tests/testDriver.C
2 |
3 | time.C
4 | fields.C
5 | noCase.C
6 |
7 | EXE = testDriver
8 |
--------------------------------------------------------------------------------
/catch2/data/sponsors/github_repo_sponsorship.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FoamScience/foamUT/HEAD/catch2/data/sponsors/github_repo_sponsorship.png
--------------------------------------------------------------------------------
/catch2/tools/scripts/scriptCommon.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 | catchPath = os.path.dirname(os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0]))))
5 |
--------------------------------------------------------------------------------
/catch2/meson_options.txt:
--------------------------------------------------------------------------------
1 | option('tests', type: 'boolean', value: true, description: 'Build the unit tests')
2 | option('install', type: 'boolean', value: true, description: 'Install the library')
3 |
--------------------------------------------------------------------------------
/catch2/mdsnippets.json:
--------------------------------------------------------------------------------
1 | {
2 | "ReadOnly": false,
3 | "TocLevel": 5,
4 | "Exclude": [
5 | "cmake-build"
6 | ],
7 | "WriteHeader": false,
8 | "Convention": "InPlaceOverwrite"
9 | }
10 |
--------------------------------------------------------------------------------
/catch2/MODULE.bazel:
--------------------------------------------------------------------------------
1 | module(name = "catch2")
2 |
3 | bazel_dep(name = "bazel_skylib", version = "1.7.1")
4 | bazel_dep(name = "rules_cc", version = "0.1.1")
5 | bazel_dep(name = "rules_license", version = "1.0.0")
6 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/developBuild.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import releaseCommon
4 |
5 | v = releaseCommon.Version()
6 | v.incrementBuildNumber()
7 | releaseCommon.performUpdates(v)
8 |
9 | print( "Updated files to v{0}".format( v.getVersionString() ) )
10 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/patchRelease.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import releaseCommon
4 |
5 | v = releaseCommon.Version()
6 | v.incrementPatchNumber()
7 | releaseCommon.performUpdates(v)
8 |
9 | print( "Updated files to v{0}".format( v.getVersionString() ) )
10 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/majorRelease.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import releaseCommon
4 |
5 | v = releaseCommon.Version()
6 | v.incrementMajorVersion()
7 | releaseCommon.performUpdates(v)
8 |
9 | print( "Updated files to v{0}".format( v.getVersionString() ) )
10 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/minorRelease.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import releaseCommon
4 |
5 | v = releaseCommon.Version()
6 | v.incrementMinorVersion()
7 | releaseCommon.performUpdates(v)
8 |
9 | print( "Updated files to v{0}".format( v.getVersionString() ) )
10 |
--------------------------------------------------------------------------------
/catch2/.conan/test_package/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 | project(PackageTest LANGUAGES CXX)
3 |
4 | find_package(Catch2 CONFIG REQUIRED)
5 |
6 | add_executable(test_package test_package.cpp)
7 | target_link_libraries(test_package Catch2::Catch2WithMain)
8 |
--------------------------------------------------------------------------------
/tests/exampleTests/noCase.C:
--------------------------------------------------------------------------------
1 | #include "catch2/catch_all.hpp"
2 | #include "catch2/catch_test_macros.hpp"
3 |
4 |
5 | TEST_CASE("No case tagged so no time object needed", "[serial]") {
6 | REQUIRE(true);
7 | }
8 |
9 | TEST_CASE("another no case tagged test") {
10 | REQUIRE(true);
11 | }
12 |
--------------------------------------------------------------------------------
/catch2/CMake/Catch2Config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | # Avoid repeatedly including the targets
4 | if(NOT TARGET Catch2::Catch2)
5 | # Provide path for scripts
6 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
7 |
8 | include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake)
9 | endif()
10 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt:
--------------------------------------------------------------------------------
1 | This would not be caught previously
2 | Nor would this
3 | A string sent directly to stdout
4 | A string sent directly to stderr
5 | A string sent to stderr via clog
6 | Message from section one
7 | Message from section two
8 | loose text artifact
9 | a!
10 | b1!
11 | !
12 |
--------------------------------------------------------------------------------
/catch2/tools/misc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 | project(CatchCoverageHelper LANGUAGES CXX)
3 |
4 | add_executable(CoverageHelper coverage-helper.cpp)
5 | target_compile_features(CoverageHelper PRIVATE cxx_std_11)
6 | if(MSVC)
7 | target_compile_options(CoverageHelper PRIVATE /W4 /w44265 /WX /w44061 /w44062)
8 | endif()
9 |
--------------------------------------------------------------------------------
/tests/exampleTests/time.C:
--------------------------------------------------------------------------------
1 | #include "catch2/catch_all.hpp"
2 | #include "catch2/catch_test_macros.hpp"
3 | #include "fvMesh.H"
4 |
5 | using namespace Foam;
6 | extern Time* timePtr;
7 |
8 | TEST_CASE("Check time index", "[cavity][serial][parallel]") {
9 | Time& runTime = *timePtr;
10 | CAPTURE(runTime.timeIndex());
11 | REQUIRE(runTime.timeIndex() == 0);
12 | }
13 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "image": "ghcr.io/foamscience/jammy-openfoam:v2206",
3 | "settings": {
4 | "terminal.integrated.shell.linux": "/bin/bash"
5 | },
6 | "extensions": [
7 | "elwardi.foam-language-client",
8 | "zhikui.vscode-openfoam",
9 | "llvm-vs-code-extensions.vscode-clangd"
10 | ],
11 |
12 | "remoteUser": "openfoam"
13 | }
14 |
--------------------------------------------------------------------------------
/generate.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | # Script to generate foamut executable and create backward compatibility symlink
4 |
5 | set -e
6 |
7 | echo "Generating foamut executable with bashly..."
8 | bashly generate
9 |
10 | echo "Creating Alltest symlink for backward compatibility..."
11 | ln -sf foamut Alltest
12 |
13 | echo "Done! Run ./foamut --help or ./Alltest --help to test"
14 |
--------------------------------------------------------------------------------
/catch2/.bazelrc:
--------------------------------------------------------------------------------
1 | build --enable_platform_specific_config
2 |
3 | build:gcc9 --cxxopt=-std=c++2a
4 | build:gcc11 --cxxopt=-std=c++2a
5 | build:gcc13 --cxxopt=-std=c++2a
6 | build:clang13 --cxxopt=-std=c++17
7 | build:vs2019 --cxxopt=/std:c++17
8 | build:vs2022 --cxxopt=/std:c++17
9 |
10 | build:windows --config=vs2022
11 | build:linux --config=gcc11
12 | build:macos --cxxopt=-std=c++2b
13 |
--------------------------------------------------------------------------------
/catch2/CMake/catch2.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | includedir=${prefix}/@include_dir@
4 | libdir=${prefix}/@lib_dir@
5 |
6 | Name: Catch2
7 | Description: A modern, C++-native, test framework for C++14 and above
8 | URL: https://github.com/catchorg/Catch2
9 | Version: @Catch2_VERSION@
10 | Cflags: -I${includedir}
11 | Libs: -L${libdir} -l@lib_name@
12 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/checkDuplicateFilenames.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import os
4 | import sys
5 |
6 | files_set = set()
7 |
8 | for root, dir, files in os.walk("src/catch2"):
9 | for file in files:
10 | if file not in files_set:
11 | files_set.add(file)
12 | else:
13 | print("File %s is duplicate" % file)
14 | sys.exit(1)
15 |
--------------------------------------------------------------------------------
/catch2/MAINTAINERS.md:
--------------------------------------------------------------------------------
1 |
2 | # Catch2 Maintainers
3 |
4 | ## Current
5 |
6 | * Chris Thrasher ([@christhrasher](https://github.com/ChrisThrasher)), gpg key: 56FB686C9DFC8E2C
7 | * Martin Hořeňovský ([@horenmar](https://github.com/horenmar)), gpg key: E29C46F3B8A7502860793B7DECC9C20E314B2360
8 |
9 | ## Retired
10 |
11 | * Phil Nash ([@philsquared](https://github.com/philsquared))
12 |
--------------------------------------------------------------------------------
/catch2/tools/misc/appveyorMergeCoverageScript.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import glob
4 | import subprocess
5 |
6 | if __name__ == '__main__':
7 | cov_files = list(glob.glob('tests/cov-report*.bin'))
8 | base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files]
9 | subprocess.check_call(base_cmd)
10 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X92-NoTests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Links into executable with no tests which should fail when run
11 | */
12 |
--------------------------------------------------------------------------------
/catch2/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Create an issue that requests a feature or other improvement
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Description**
11 | Describe the feature/change you request and why do you want it.
12 |
13 | **Additional context**
14 | Add any other context or screenshots about the feature request here.
15 |
--------------------------------------------------------------------------------
/catch2/CMake/catch2-with-main.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | libdir=${prefix}/@lib_dir@
3 | pkg_version=@Catch2_VERSION@
4 |
5 | Name: Catch2 with main function
6 | Description: A modern, C++-native test framework for C++14 and above (links in default main)
7 | URL: https://github.com/catchorg/Catch2
8 | Version: ${pkg_version}
9 | Requires: catch2 = ${pkg_version}
10 | Libs: -L${libdir} -l@lib_name@
11 |
--------------------------------------------------------------------------------
/catch2/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | precision: 2
3 | round: nearest
4 | range: "60...90"
5 | status:
6 | project:
7 | default:
8 | threshold: 2%
9 | patch:
10 | default:
11 | target: 80%
12 | ignore:
13 | - "**/external/clara.hpp"
14 | - "tests"
15 |
16 |
17 | codecov:
18 | branch: devel
19 | max_report_age: off
20 |
21 | comment:
22 | layout: "diff"
23 |
--------------------------------------------------------------------------------
/cases/cavity/system/fvSolution:
--------------------------------------------------------------------------------
1 | FoamFile
2 | {
3 | version 2.0;
4 | format ascii;
5 | class dictionary;
6 | object fvSolution;
7 | }
8 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9 |
10 | solvers
11 | {
12 | }
13 |
14 | PISO
15 | {
16 | }
17 |
18 | PIMPLE
19 | {
20 | }
21 |
22 | // ************************************************************************* //
23 |
--------------------------------------------------------------------------------
/catch2/.conan/test_package/test_package.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int Factorial( int number ) {
4 | return number <= 1 ? 1 : Factorial( number - 1 ) * number;
5 | }
6 |
7 | TEST_CASE( "Factorial Tests", "[single-file]" ) {
8 | REQUIRE( Factorial(0) == 1 );
9 | REQUIRE( Factorial(1) == 1 );
10 | REQUIRE( Factorial(2) == 2 );
11 | REQUIRE( Factorial(3) == 6 );
12 | REQUIRE( Factorial(10) == 3628800 );
13 | }
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_config.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | IConfig::~IConfig() = default;
13 | }
14 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | ITestCaseRegistry::~ITestCaseRegistry() = default;
13 | }
14 |
--------------------------------------------------------------------------------
/src/initialize.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | # Bashly initialization hook - runs before command execution
4 | # Validates environment and performs sanity checks
5 |
6 | # Check if OpenFOAM is sourced
7 | if [ -z "${FOAM_LIBBIN}" ]; then
8 | echo "Error: Please source an OpenFOAM version. Aborting..." >&2
9 | echo "USAGE: ./foamut [OPTIONS] [CATCH2_ARGS...]" >&2
10 | exit 1
11 | fi
12 |
13 | # Set root directory as the repository root
14 | root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15 | export FOAM_FOAMUT="$root"
16 |
--------------------------------------------------------------------------------
/catch2/meson.build:
--------------------------------------------------------------------------------
1 | # Copyright Catch2 Authors
2 | # Distributed under the Boost Software License, Version 1.0.
3 | # (See accompanying file LICENSE.txt or copy at
4 | # https://www.boost.org/LICENSE_1_0.txt)
5 |
6 | # SPDX-License-Identifier: BSL-1.0
7 |
8 | project(
9 | 'catch2',
10 | 'cpp',
11 | version: '3.11.0', # CML version placeholder, don't delete
12 | license: 'BSL-1.0',
13 | meson_version: '>=0.54.1',
14 | )
15 |
16 | subdir('src/catch2')
17 | if get_option('tests')
18 | subdir('tests')
19 | endif
20 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | IRegistryHub::~IRegistryHub() = default;
13 | IMutableRegistryHub::~IMutableRegistryHub() = default;
14 | }
15 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_errno_guard.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 |
13 | namespace Catch {
14 | ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
15 | ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
16 | }
17 |
--------------------------------------------------------------------------------
/catch2/benchmarks/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(CatchMiscFunctions)
2 |
3 | add_executable(AssertionsFastPath
4 | runtime_assertion_benches.cpp
5 | )
6 |
7 | add_executable(AssertionsSlowPath
8 | runtime_assertion_benches.cpp
9 | assertion_listener.cpp
10 | )
11 |
12 | target_link_libraries(AssertionsFastPath PRIVATE Catch2::Catch2WithMain)
13 | target_link_libraries(AssertionsSlowPath PRIVATE Catch2::Catch2WithMain)
14 |
15 | list(APPEND CATCH_TEST_TARGETS AssertionsFastPath AssertionsSlowPath)
16 | set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
17 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_case_sensitive.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_CASE_SENSITIVE_HPP_INCLUDED
9 | #define CATCH_CASE_SENSITIVE_HPP_INCLUDED
10 |
11 | namespace Catch {
12 |
13 | enum class CaseSensitive { Yes, No };
14 |
15 | } // namespace Catch
16 |
17 | #endif // CATCH_CASE_SENSITIVE_HPP_INCLUDED
18 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_version_macros.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_VERSION_MACROS_HPP_INCLUDED
9 | #define CATCH_VERSION_MACROS_HPP_INCLUDED
10 |
11 | #define CATCH_VERSION_MAJOR 3
12 | #define CATCH_VERSION_MINOR 11
13 | #define CATCH_VERSION_PATCH 0
14 |
15 | #endif // CATCH_VERSION_MACROS_HPP_INCLUDED
16 |
--------------------------------------------------------------------------------
/catch2/src/catch2/generators/catch_generator_exception.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 |
13 | const char* GeneratorException::what() const noexcept {
14 | return m_msg;
15 | }
16 |
17 | } // end namespace Catch
18 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | IReporterFactory::~IReporterFactory() = default;
13 | EventListenerFactory::~EventListenerFactory() = default;
14 | }
15 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_exception.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | IExceptionTranslator::~IExceptionTranslator() = default;
13 | IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
14 | }
15 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_uncaught_exceptions.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
9 | #define CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
10 |
11 | namespace Catch {
12 | bool uncaught_exceptions();
13 | } // end namespace Catch
14 |
15 | #endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
16 |
--------------------------------------------------------------------------------
/catch2/fuzzing/NullOStream.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include "NullOStream.h"
10 |
11 | void NullOStream::avoidOutOfLineVirtualCompilerWarning()
12 | {
13 | }
14 |
15 | int NullStreambuf::overflow(int c){
16 | setp(dummyBuffer, dummyBuffer + sizeof(dummyBuffer));
17 | return (c == traits_type::eof()) ? '\0' : c;
18 | }
19 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X93-AllSkipped.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | TEST_CASE( "this test case is being skipped" ) { SKIP(); }
12 |
13 | TEST_CASE( "all sections in this test case are being skipped" ) {
14 | SECTION( "A" ) { SKIP(); }
15 | SECTION( "B" ) { SKIP(); }
16 | }
17 |
--------------------------------------------------------------------------------
/src/lib/cleanup.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | # Cleanup dummy libraries and temporary directories
4 |
5 | cleanup() {
6 | local dummyLibChecks="Pstream dynamicFvMesh"
7 |
8 | # Cleanup dummy libraries
9 | for dummy in $dummyLibChecks; do
10 | if [ -f "${FOAM_USER_LIBBIN}/lib${dummy}.so" ] &&
11 | tr '\n' ' ' < "${FOAM_USER_LIBBIN}/lib${dummy}.so" | grep -q '^! $'; then
12 | rm -rf "${FOAM_USER_LIBBIN}/lib${dummy}.so"
13 | fi
14 | done
15 |
16 | # Cleanup temporary case directory
17 | rm -rf "$caseRun"
18 | }
19 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_debug_console.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_DEBUG_CONSOLE_HPP_INCLUDED
9 | #define CATCH_DEBUG_CONSOLE_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 | void writeToDebugConsole( std::string const& text );
15 | }
16 |
17 | #endif // CATCH_DEBUG_CONSOLE_HPP_INCLUDED
18 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_get_random_seed.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | namespace Catch {
15 | std::uint32_t getSeed() {
16 | return getCurrentContext().getConfig()->rngSeed();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_leak_detector.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED
9 | #define CATCH_LEAK_DETECTOR_HPP_INCLUDED
10 |
11 | namespace Catch {
12 |
13 | struct LeakDetector {
14 | LeakDetector();
15 | ~LeakDetector();
16 | };
17 |
18 | }
19 | #endif // CATCH_LEAK_DETECTOR_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/buildAndTest.cmd:
--------------------------------------------------------------------------------
1 | rem Start at the root of the Catch project directory, for example:
2 | rem cd Catch2
3 |
4 | rem begin-snippet: catch2-build-and-test-win
5 | rem 1. Regenerate the amalgamated distribution
6 | python tools\scripts\generateAmalgamatedFiles.py
7 |
8 | rem 2. Configure the full test build
9 | cmake -B debug-build -S . -DCMAKE_BUILD_TYPE=Debug --preset all-tests
10 |
11 | rem 3. Run the actual build
12 | cmake --build debug-build
13 |
14 | rem 4. Run the tests using CTest
15 | ctest -j 4 --output-on-failure -C Debug --test-dir debug-build
16 | rem end-snippet
17 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_get_random_seed.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_GET_RANDOM_SEED_HPP_INCLUDED
9 | #define CATCH_GET_RANDOM_SEED_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 | //! Returns Catch2's current RNG seed.
15 | std::uint32_t getSeed();
16 | }
17 |
18 | #endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED
19 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_stdstreams.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #ifndef CATCH_STDSTREAMS_HPP_INCLUDED
10 | #define CATCH_STDSTREAMS_HPP_INCLUDED
11 |
12 | #include
13 |
14 | namespace Catch {
15 |
16 | std::ostream& cout();
17 | std::ostream& cerr();
18 | std::ostream& clog();
19 |
20 | } // namespace Catch
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X30-BazelReporter.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Test the Bazel report functionality with a simple set
11 | * of dummy test cases.
12 | */
13 |
14 | #include
15 |
16 | TEST_CASE( "Passing test case" ) { REQUIRE( 1 == 1 ); }
17 | TEST_CASE( "Failing test case" ) { REQUIRE( 2 == 1 ); }
18 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/buildAndTest.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | # Start at the root of the Catch project directory, for example:
4 | # cd Catch2
5 |
6 | # begin-snippet: catch2-build-and-test
7 | # 1. Regenerate the amalgamated distribution
8 | ./tools/scripts/generateAmalgamatedFiles.py
9 |
10 | # 2. Configure the full test build
11 | cmake -B debug-build -S . -DCMAKE_BUILD_TYPE=Debug --preset all-tests
12 |
13 | # 3. Run the actual build
14 | cmake --build debug-build
15 |
16 | # 4. Run the tests using CTest
17 | ctest -j 4 --output-on-failure -C Debug --test-dir debug-build
18 | # end-snippet
19 |
--------------------------------------------------------------------------------
/tests/exampleTests/Make/options:
--------------------------------------------------------------------------------
1 | EXE_INC = -std=c++17 \
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \
3 | -I$(LIB_SRC)/meshTools/lnInclude \
4 | -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
5 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
6 | -I$(LIB_SRC)/Pstream/lnInclude \
7 | -I$(FOAM_USER_LIBBIN)/catch2/include
8 |
9 | EXE_LIBS = \
10 | -lfiniteVolume \
11 | -lmeshTools \
12 | -L$(FOAM_USER_LIBBIN) -L$(FOAM_LIBBIN)/$(FOAM_MPI) \
13 | -L$(FOAM_USER_LIBBIN)/catch2/lib \
14 | -L$(FOAM_USER_LIBBIN)/catch2/lib64 \
15 | -l:libCatch2.a \
16 | -ldynamicFvMesh -lPstream
17 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_chronometer.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | namespace Benchmark {
13 | namespace Detail {
14 | ChronometerConcept::~ChronometerConcept() = default;
15 | } // namespace Detail
16 | } // namespace Benchmark
17 | } // namespace Catch
18 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that test cases with identical name and tags are reported as error
11 | */
12 |
13 | #include
14 |
15 | TEST_CASE("A test case with duplicated name and tags", "[tag1][tag2]") {}
16 | TEST_CASE("A test case with duplicated name and tags", "[tag1][tag2]") {}
17 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_polyfills.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_POLYFILLS_HPP_INCLUDED
9 | #define CATCH_POLYFILLS_HPP_INCLUDED
10 |
11 | namespace Catch {
12 |
13 | bool isnan(float f);
14 | bool isnan(double d);
15 |
16 | float nextafter(float x, float y);
17 | double nextafter(double x, double y);
18 |
19 | }
20 |
21 | #endif // CATCH_POLYFILLS_HPP_INCLUDED
22 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_getenv.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_GETENV_HPP_INCLUDED
9 | #define CATCH_GETENV_HPP_INCLUDED
10 |
11 | namespace Catch {
12 | namespace Detail {
13 |
14 | //! Wrapper over `std::getenv` that compiles on UWP (and always returns nullptr there)
15 | char const* getEnv(char const* varName);
16 |
17 | }
18 | }
19 |
20 | #endif // CATCH_GETENV_HPP_INCLUDED
21 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/catch_matchers_predicate.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) {
12 | if (desc.empty()) {
13 | return "matches undescribed predicate";
14 | } else {
15 | return "matches predicate: \"" + desc + '"';
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/lib/create_dummy_libs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | # Create dummy libraries if they don't exist
4 | # Some OpenFOAM forks/configurations may not have certain libraries
5 |
6 | create_dummy_libs() {
7 | # If there is no lib${libName}.so, create a dummy one
8 | local dummyLibChecks="Pstream dynamicFvMesh"
9 | for dummy in $dummyLibChecks; do
10 | if [ ! -f "${FOAM_LIBBIN}/lib${dummy}.so" ] &&
11 | [ ! -f "${FOAM_USER_LIBBIN}/lib${dummy}.so" ] &&
12 | [ ! -f "${FOAM_LIBBIN}/${FOAM_MPI}/lib${dummy}.so" ]; then
13 | echo '!' > "${FOAM_USER_LIBBIN}/lib${dummy}.so"
14 | fi
15 | done
16 | }
17 |
--------------------------------------------------------------------------------
/catch2/fuzzing/fuzz_XmlWriter.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | //By Paul Dreik 2020
9 |
10 | #include
11 |
12 | #include "NullOStream.h"
13 |
14 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
15 |
16 | std::string buf(Data,Data+Size);
17 | NullOStream nul;
18 | Catch::XmlEncode encode(buf);
19 | encode.encodeTo(nul);
20 | return 0;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_commandline.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_COMMANDLINE_HPP_INCLUDED
9 | #define CATCH_COMMANDLINE_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct ConfigData;
16 |
17 | Clara::Parser makeCommandLineParser( ConfigData& config );
18 |
19 | } // end namespace Catch
20 |
21 | #endif // CATCH_COMMANDLINE_HPP_INCLUDED
22 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/helpers/parse_test_spec.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #ifndef CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED
10 | #define CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED
11 |
12 | #include
13 |
14 | #include
15 |
16 | namespace Catch {
17 | TestSpec parseTestSpec( std::string const& arg );
18 | }
19 |
20 | #endif // CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED
21 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that test cases with identical name but different tags are
11 | * not reported as an error.
12 | */
13 |
14 | #include
15 |
16 | TEST_CASE("A test case with duplicated name but different tags", "[tag1]") {}
17 | TEST_CASE("A test case with duplicated name but different tags", "[tag2]") {}
18 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/ToDo.txt:
--------------------------------------------------------------------------------
1 | Configuration options that are left default and thus are not properly tested
2 | yet:
3 |
4 | CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
5 | CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
6 | CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
7 | CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
8 | CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
9 | CATCH_CONFIG_DEFAULT_REPORTER
10 | CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS
11 |
--------------------------------------------------------------------------------
/catch2/docs/commercial-users.md:
--------------------------------------------------------------------------------
1 |
2 | # Commercial users of Catch2
3 |
4 | Catch2 is also widely used in proprietary code bases. This page contains
5 | some of them that are willing to share this information.
6 |
7 | If you want to add your organisation, please check that there is no issue
8 | with you sharing this fact.
9 |
10 | - Bloomberg
11 | - [Bloomlife](https://bloomlife.com)
12 | - [Inscopix Inc.](https://www.inscopix.com/)
13 | - Locksley.CZ
14 | - [Makimo](https://makimo.pl/)
15 | - NASA
16 | - [Nexus Software Systems](https://nexwebsites.com)
17 | - [UX3D](https://ux3d.io)
18 | - [King](https://king.com)
19 |
20 |
21 | ---
22 |
23 | [Home](Readme.md#top)
24 |
--------------------------------------------------------------------------------
/catch2/.github/workflows/linux-bazel-builds.yml:
--------------------------------------------------------------------------------
1 | name: Linux Builds (Bazel)
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build_and_test_ubuntu:
7 | name: Linux Ubuntu 22.04 Bazel build
8 | runs-on: ubuntu-22.04
9 | strategy:
10 | fail-fast: false
11 | matrix:
12 | compilation_mode: [fastbuild, dbg, opt]
13 |
14 | steps:
15 | - uses: actions/checkout@v4
16 |
17 | - name: Mount Bazel cache
18 | uses: actions/cache@v3
19 | with:
20 | path: "/home/runner/.cache/bazel"
21 | key: bazel-ubuntu22-gcc11
22 |
23 | - name: Build
24 | run: bazelisk build --compilation_mode=${{matrix.compilation_mode}} //...
25 |
--------------------------------------------------------------------------------
/catch2/extras/lldbinit:
--------------------------------------------------------------------------------
1 | #
2 | # This file provides a way to skip stepping into Catch code when debugging with lldb.
3 | #
4 | # With the setting "target.process.thread.step-avoid-regexp" you can tell lldb
5 | # to skip functions matching the regexp
6 | #
7 | # Basically the following line tells lldb to skip all functions containing the
8 | # regexp "Catch", which matches the complete Catch namespace.
9 | # If you want to skip just some parts of the Catch code you can modify the
10 | # regexp accordingly.
11 | #
12 | # If you want to permanently skip stepping into Catch code copy the following
13 | # line into your ~/.lldbinit file
14 | #
15 |
16 | settings set target.process.thread.step-avoid-regexp Catch
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_deprecation_macro.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_DEPRECATION_MACRO_HPP_INCLUDED
9 | #define CATCH_DEPRECATION_MACRO_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #if !defined( CATCH_CONFIG_NO_DEPRECATION_ANNOTATIONS )
14 | # define DEPRECATED( msg ) [[deprecated( msg )]]
15 | #else
16 | # define DEPRECATED( msg )
17 | #endif
18 |
19 | #endif // CATCH_DEPRECATION_MACRO_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that when `STATIC_CHECK` is deferred to runtime and fails, it
11 | * does not abort the test case.
12 | */
13 |
14 | #include
15 |
16 | TEST_CASE("Deferred static checks") {
17 | STATIC_CHECK(1 == 2);
18 | STATIC_CHECK_FALSE(1 != 2);
19 | // This last assertion must be executed too
20 | CHECK(1 == 2);
21 | }
22 |
--------------------------------------------------------------------------------
/catch2/tests/TestScripts/DiscoverTests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 | project(discover-tests-test LANGUAGES CXX)
3 |
4 | add_executable(tests register-tests.cpp)
5 | add_subdirectory(${CATCH2_PATH} catch2-build)
6 | target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
7 |
8 | enable_testing()
9 | include(Catch)
10 | set(extra_args)
11 | if(CMAKE_VERSION GREATER_EQUAL 3.27)
12 | list(APPEND extra_args
13 | DL_PATHS "${CMAKE_CURRENT_LIST_DIR};${CMAKE_CURRENT_LIST_DIR}/.."
14 | )
15 | endif()
16 | catch_discover_tests(
17 | tests
18 | ADD_TAGS_AS_LABELS
19 | DISCOVERY_MODE PRE_TEST
20 | ${extra_args}
21 | )
22 |
23 | # DISCOVERY_MODE
24 |
--------------------------------------------------------------------------------
/cases/cavity/system/decomposeParDict:
--------------------------------------------------------------------------------
1 | FoamFile
2 | {
3 | version 2.0;
4 | format ascii;
5 | class dictionary;
6 | object decomposeParDict;
7 | }
8 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9 |
10 | numberOfSubdomains 4;
11 |
12 | method hierarchical;
13 |
14 | simpleCoeffs
15 | {
16 | n (2 2 1);
17 | delta 0.001;
18 | }
19 |
20 | hierarchicalCoeffs
21 | {
22 | n (2 2 1);
23 | delta 0.001;
24 | order xyz;
25 | }
26 |
27 | distributed no;
28 |
29 | roots
30 | (
31 | );
32 |
33 | // ************************************************************************* //
34 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_test_run_info.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TEST_RUN_INFO_HPP_INCLUDED
9 | #define CATCH_TEST_RUN_INFO_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct TestRunInfo {
16 | constexpr TestRunInfo(StringRef _name) : name(_name) {}
17 | StringRef name;
18 | };
19 |
20 | } // end namespace Catch
21 |
22 | #endif // CATCH_TEST_RUN_INFO_HPP_INCLUDED
23 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Test that the Catch2 header compiles even after including windows.h
11 | * without defining NOMINMAX first.
12 | *
13 | * As an FYI, if you do that, you are wrong.
14 | */
15 |
16 | #include
17 | #include
18 |
19 | TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") {
20 | SUCCEED();
21 | }
22 |
--------------------------------------------------------------------------------
/src/lib/setup_test_symlinks.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | # Setup test symlinks if FOAM_FOAMUT_TESTS environment variable is set
4 | # Discovers Make directories and symlinks parent directories under tests/
5 |
6 | setup_test_symlinks() {
7 | # If tests folder is supplied through an env. var. do the symlinking
8 | if [ -n "${FOAM_FOAMUT_TESTS}" ]; then
9 | find "${FOAM_FOAMUT_TESTS}" -type d -name "Make" | while read -r make_dir; do
10 | parent_dir=$(basename "$(dirname "$make_dir")")
11 | target_dir="$root/tests/$parent_dir"
12 | ln -f -s "$(dirname "$make_dir")" "$target_dir"
13 | echo "picked up $parent_dir tests"
14 | done
15 | fi
16 | }
17 |
--------------------------------------------------------------------------------
/catch2/fuzzing/fuzz_TestSpecParser.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | //By Paul Dreik 2020
9 |
10 | #include
11 | #include
12 |
13 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
14 |
15 | Catch::TagAliasRegistry tar;
16 | Catch::TestSpecParser tsp(tar);
17 |
18 | std::string buf(Data,Data+Size);
19 | tsp.parse(buf);
20 |
21 | return 0;
22 | }
23 |
--------------------------------------------------------------------------------
/catch2/.gitattributes:
--------------------------------------------------------------------------------
1 | # This sets the default behaviour, overriding core.autocrlf
2 | * text=auto
3 |
4 | # All source files should have unix line-endings in the repository,
5 | # but convert to native line-endings on checkout
6 | *.cpp text
7 | *.h text
8 | *.hpp text
9 |
10 | # Windows specific files should retain windows line-endings
11 | *.sln text eol=crlf
12 |
13 | # Keep executable scripts with LFs so they can be run after being
14 | # checked out on Windows
15 | *.py text eol=lf
16 |
17 |
18 | # Keep the single include header with LFs to make sure it is uploaded,
19 | # hashed etc with LF
20 | single_include/**/*.hpp eol=lf
21 | # Also keep the LICENCE file with LFs for the same reason
22 | LICENCE.txt eol=lf
23 |
--------------------------------------------------------------------------------
/catch2/extras/gdbinit:
--------------------------------------------------------------------------------
1 | #
2 | # This file provides a way to skip stepping into Catch code when debugging with gdb.
3 | #
4 | # With the gdb "skip" command you can tell gdb to skip files or functions during debugging.
5 | # see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example
6 | #
7 | # Basically the following line tells gdb to skip all functions containing the
8 | # regexp "Catch", which matches the complete Catch namespace.
9 | # If you want to skip just some parts of the Catch code you can modify the
10 | # regexp accordingly.
11 | #
12 | # If you want to permanently skip stepping into Catch code copy the following
13 | # line into your ~/.gdbinit file
14 | #
15 |
16 | skip -rfu Catch
17 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_capture.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace Catch {
13 | namespace Detail {
14 | void missingCaptureInstance() {
15 | CATCH_INTERNAL_ERROR( "No result capture instance" );
16 | }
17 | } // namespace Detail
18 |
19 | IResultCapture::~IResultCapture() = default;
20 | } // namespace Catch
21 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_context.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #include
9 | #include
10 |
11 | namespace Catch {
12 |
13 | Context Context::currentContext;
14 |
15 | Context& getCurrentMutableContext() {
16 | return Context::currentContext;
17 | }
18 |
19 | SimplePcg32& sharedRng() {
20 | static SimplePcg32 s_rng;
21 | return s_rng;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_console_width.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED
9 | #define CATCH_CONSOLE_WIDTH_HPP_INCLUDED
10 |
11 | // This include must be kept so that user's configured value for CONSOLE_WIDTH
12 | // is used before we attempt to provide a default value
13 | #include
14 |
15 | #ifndef CATCH_CONFIG_CONSOLE_WIDTH
16 | #define CATCH_CONFIG_CONSOLE_WIDTH 80
17 | #endif
18 |
19 | #endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 |
12 | TEST_CASE()
13 | {
14 | SUCCEED( "anonymous test case" );
15 | }
16 |
17 | TEST_CASE( "Test case with one argument" )
18 | {
19 | SUCCEED( "no assertions" );
20 | }
21 |
22 | TEST_CASE( "Variadic macros", "[variadic][sections]" )
23 | {
24 | SECTION( "Section with one argument" )
25 | {
26 | SUCCEED( "no assertions" );
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/helpers/parse_test_spec.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | namespace Catch {
15 |
16 | TestSpec parseTestSpec( std::string const& arg ) {
17 | return TestSpecParser( ITagAliasRegistry::get() )
18 | .parse( arg )
19 | .testSpec();
20 | }
21 |
22 | } // namespace Catch
23 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_void_type.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_VOID_TYPE_HPP_INCLUDED
9 | #define CATCH_VOID_TYPE_HPP_INCLUDED
10 |
11 |
12 | namespace Catch {
13 | namespace Detail {
14 |
15 | template
16 | struct make_void { using type = void; };
17 |
18 | template
19 | using void_t = typename make_void::type;
20 |
21 | } // namespace Detail
22 | } // namespace Catch
23 |
24 |
25 | #endif // CATCH_VOID_TYPE_HPP_INCLUDED
26 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/catch_matchers.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 |
10 | #include
11 |
12 | namespace Catch {
13 | namespace Matchers {
14 |
15 | std::string MatcherUntypedBase::toString() const {
16 | if (m_cachedToString.empty()) {
17 | m_cachedToString = describe();
18 | }
19 | return m_cachedToString;
20 | }
21 |
22 | MatcherUntypedBase::~MatcherUntypedBase() = default;
23 |
24 | } // namespace Matchers
25 | } // namespace Catch
26 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that test case methods with identical class, name and tags are
11 | * reported as error.
12 | */
13 |
14 | #include
15 |
16 | class TestCaseFixture {
17 | public:
18 | int m_a;
19 | };
20 |
21 | TEST_CASE_METHOD(TestCaseFixture, "A test case with duplicated name and tags", "[tag1]") {}
22 | TEST_CASE_METHOD(TestCaseFixture, "A test case with duplicated name and tags", "[tag1]") {}
23 |
--------------------------------------------------------------------------------
/catch2/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | * Versions 1.x (branch Catch1.x) are no longer supported.
6 | * Versions 2.x (branch v2.x) are currently supported.
7 | * `devel` branch serves for stable-ish development and is supported,
8 | but branches `devel-*` are considered short lived and are not supported separately.
9 |
10 |
11 | ## Reporting a Vulnerability
12 |
13 | Due to its nature as a _unit_ test framework, Catch2 shouldn't interact
14 | with untrusted inputs and there shouldn't be many security vulnerabilities
15 | in it.
16 |
17 | However, if you find one you send email to martin horenovsky
18 | gmail com. If you want to encrypt the email, my pgp key is
19 | `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`.
20 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | TEST_CASE( "sleep_for_100ms", "[.min_duration_test][approvals]" )
15 | {
16 | std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
17 | CHECK( true );
18 | }
19 |
20 | TEST_CASE( "sleep_for_1000ms", "[.min_duration_test][approvals]" )
21 | {
22 | std::this_thread::sleep_for( std::chrono::milliseconds( 1'000 ) );
23 | CHECK( true );
24 | }
25 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_translate_exception.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace Catch {
13 | namespace Detail {
14 | void registerTranslatorImpl(
15 | Detail::unique_ptr&& translator ) {
16 | getMutableRegistryHub().registerTranslator(
17 | CATCH_MOVE( translator ) );
18 | }
19 | } // namespace Detail
20 | } // namespace Catch
21 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_stdstreams.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace Catch {
16 |
17 | // If you #define this you must implement these functions
18 | #if !defined( CATCH_CONFIG_NOSTDOUT )
19 | std::ostream& cout() { return std::cout; }
20 | std::ostream& cerr() { return std::cerr; }
21 | std::ostream& clog() { return std::clog; }
22 | #endif
23 |
24 | } // namespace Catch
25 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used.
11 | */
12 |
13 | #include
14 |
15 | void custom_debug_break() {
16 | std::cerr << "Pretty please, break into debugger\n";
17 | }
18 |
19 | #define CATCH_BREAK_INTO_DEBUGGER() custom_debug_break()
20 |
21 | #define CATCH_CONFIG_MAIN
22 | #include
23 |
24 | TEST_CASE("Failing test that breaks into debugger", "[macros]") {
25 | REQUIRE(1 == 2);
26 | }
27 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_test_invoker.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED
9 | #define CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED
10 |
11 | namespace Catch {
12 |
13 | class ITestInvoker {
14 | public:
15 | virtual void prepareTestCase();
16 | virtual void tearDownTestCase();
17 | virtual void invoke() const = 0;
18 | virtual ~ITestInvoker(); // = default
19 | };
20 |
21 | } // namespace Catch
22 |
23 | #endif // CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED
24 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X11-DisableStringification.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Test that stringification of original expression can be disabled.
11 | *
12 | * This is a workaround for VS 2017, 2019 issue with Raw String literals
13 | * and preprocessor token pasting.
14 | */
15 |
16 |
17 | #include
18 |
19 | namespace {
20 | struct Hidden {};
21 |
22 | bool operator==(Hidden, Hidden) { return true; }
23 | }
24 |
25 | TEST_CASE("DisableStringification") {
26 | REQUIRE( Hidden{} == Hidden{} );
27 | }
28 |
--------------------------------------------------------------------------------
/catch2/.gitignore:
--------------------------------------------------------------------------------
1 | *.build
2 | !meson.build
3 | *.pbxuser
4 | *.mode1v3
5 | *.ncb
6 | *.suo
7 | Debug
8 | Release
9 | *.user
10 | *.xcuserstate
11 | .DS_Store
12 | xcuserdata
13 | CatchSelfTest.xcscheme
14 | Breakpoints.xcbkptlist
15 | UpgradeLog.XML
16 | Resources/DWARF
17 | projects/Generated
18 | *.pyc
19 | DerivedData
20 | *.xccheckout
21 | Build
22 | .idea
23 | .vs
24 | .vscode
25 | cmake-build-*
26 | benchmark-dir
27 | .conan/test_package/build
28 | **/CMakeUserPresets.json
29 | bazel-*
30 | MODULE.bazel.lock
31 | build-fuzzers
32 | debug-build
33 | .vscode
34 | msvc-sln*
35 | # Currently we use Doxygen for dep graphs and the full docs are only slowly
36 | # being filled in, so we definitely do not want git to deal with the docs.
37 | docs/doxygen
38 | *.cache
39 | compile_commands.json
40 | **/*.unapproved.txt
41 |
--------------------------------------------------------------------------------
/catch2/benchmarks/runtime_assertion_benches.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | TEST_CASE("Simple REQUIRE - 10M") {
12 | for (size_t i = 0; i < 10'000'000; ++i) {
13 | REQUIRE(true);
14 | }
15 | }
16 |
17 | TEST_CASE("Simple NOTHROW - 10M") {
18 | for (size_t i = 0; i < 10'000'000; ++i) {
19 | REQUIRE_NOTHROW([](){}());
20 | }
21 | }
22 |
23 | TEST_CASE("Simple THROWS - 10M") {
24 | for (size_t i = 0; i < 10'000'000; ++i) {
25 | REQUIRE_THROWS([]() { throw 1; }());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/catch2/fuzzing/build_fuzzers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Builds the fuzzers
4 | #
5 | # By Paul Dreik 20200923
6 | set -exu
7 |
8 | CATCHROOT=$(readlink -f $(dirname $0)/..)
9 |
10 |
11 | BUILDDIR=$CATCHROOT/build-fuzzers
12 | mkdir -p $BUILDDIR
13 | cd $BUILDDIR
14 |
15 | if which /usr/lib/ccache/clang++ >/dev/null 2>&1 ; then
16 | CXX=/usr/lib/ccache/clang++
17 | else
18 | CXX=clang++
19 | fi
20 |
21 | cmake $CATCHROOT \
22 | -DCMAKE_CXX_COMPILER=$CXX \
23 | -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -O3 -g" \
24 | -DCATCH_DEVELOPMENT_BUILD=On \
25 | -DCATCH_BUILD_EXAMPLES=Off \
26 | -DCATCH_BUILD_EXTRA_TESTS=Off \
27 | -DCATCH_BUILD_TESTING=Off \
28 | -DBUILD_TESTING=Off \
29 | -DCATCH_ENABLE_WERROR=Off \
30 | -DCATCH_BUILD_FUZZERS=On
31 |
32 | cmake --build . -j $(nproc)
33 |
34 |
--------------------------------------------------------------------------------
/catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #include
9 |
10 | namespace Catch {
11 |
12 | StreamingReporterBase::~StreamingReporterBase() = default;
13 |
14 | void
15 | StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) {
16 | currentTestRunInfo = _testRunInfo;
17 | }
18 |
19 | void StreamingReporterBase::testRunEnded( TestRunStats const& ) {
20 | currentTestCaseInfo = nullptr;
21 | }
22 |
23 | } // end namespace Catch
24 |
--------------------------------------------------------------------------------
/catch2/fuzzing/NullOStream.h:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #pragma once
10 |
11 | #include
12 | #include
13 |
14 | // from https://stackoverflow.com/a/8244052
15 | class NullStreambuf : public std::streambuf {
16 | char dummyBuffer[64];
17 |
18 | protected:
19 | virtual int overflow(int c) final;
20 | };
21 |
22 | class NullOStream final : private NullStreambuf, public std::ostream {
23 | public:
24 | NullOStream() : std::ostream(this) {}
25 | NullStreambuf *rdbuf() { return this; }
26 | virtual void avoidOutOfLineVirtualCompilerWarning();
27 | };
28 |
29 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_estimate.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_ESTIMATE_HPP_INCLUDED
11 | #define CATCH_ESTIMATE_HPP_INCLUDED
12 |
13 | namespace Catch {
14 | namespace Benchmark {
15 | template
16 | struct Estimate {
17 | Type point;
18 | Type lower_bound;
19 | Type upper_bound;
20 | double confidence_interval;
21 | };
22 | } // namespace Benchmark
23 | } // namespace Catch
24 |
25 | #endif // CATCH_ESTIMATE_HPP_INCLUDED
26 |
--------------------------------------------------------------------------------
/cases/cavity/system/controlDict:
--------------------------------------------------------------------------------
1 | FoamFile
2 | {
3 | version 2.0;
4 | format ascii;
5 | class dictionary;
6 | object controlDict;
7 | }
8 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9 |
10 | application icoFoam;
11 |
12 | startFrom startTime;
13 |
14 | startTime 0;
15 |
16 | stopAt endTime;
17 |
18 | endTime 0.5;
19 |
20 | deltaT 0.005;
21 |
22 | writeControl timeStep;
23 |
24 | writeInterval 20;
25 |
26 | purgeWrite 0;
27 |
28 | writeFormat ascii;
29 |
30 | writePrecision 6;
31 |
32 | writeCompression off;
33 |
34 | timeFormat general;
35 |
36 | timePrecision 6;
37 |
38 | runTimeModifiable yes;
39 |
40 | // ************************************************************************* //
41 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_preprocessor_internal_stringify.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED
9 | #define CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
14 | #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__##_catch_sr
15 | #else
16 | #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"_catch_sr
17 | #endif
18 |
19 | #endif // CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/tools/misc/appveyorTestRunScript.bat:
--------------------------------------------------------------------------------
1 | SETLOCAL EnableDelayedExpansion
2 |
3 | rem Disable launching the JIT debugger for ctest.exe
4 | reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList" /v "ctest.ext" /t REG_DWORD /d 1
5 | cd Build
6 | if "%CONFIGURATION%"=="Debug" (
7 | if "%coverage%"=="1" (
8 | ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck -LE uses-signals || exit /b !ERRORLEVEL!
9 | python ..\tools\misc\appveyorMergeCoverageScript.py || exit /b !ERRORLEVEL!
10 | codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% || exit /b !ERRORLEVEL!
11 | ) else (
12 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL!
13 | )
14 | )
15 | if "%CONFIGURATION%"=="Release" (
16 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL!
17 | )
18 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_move_and_forward.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
9 | #define CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
10 |
11 | #include
12 |
13 | //! Replacement for std::move with better compile time performance
14 | #define CATCH_MOVE(...) static_cast&&>(__VA_ARGS__)
15 |
16 | //! Replacement for std::forward with better compile time performance
17 | #define CATCH_FORWARD(...) static_cast(__VA_ARGS__)
18 |
19 | #endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_random_seed_generation.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED
9 | #define CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | enum class GenerateFrom {
16 | Time,
17 | RandomDevice,
18 | //! Currently equivalent to RandomDevice, but can change at any point
19 | Default
20 | };
21 |
22 | std::uint32_t generateRandomSeed(GenerateFrom from);
23 |
24 | } // end namespace Catch
25 |
26 | #endif // CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED
27 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_tag_alias.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TAG_ALIAS_HPP_INCLUDED
9 | #define CATCH_TAG_ALIAS_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace Catch {
16 |
17 | struct TagAlias {
18 | TagAlias(std::string const& _tag, SourceLineInfo _lineInfo):
19 | tag(_tag),
20 | lineInfo(_lineInfo)
21 | {}
22 |
23 | std::string tag;
24 | SourceLineInfo lineInfo;
25 | };
26 |
27 | } // end namespace Catch
28 |
29 | #endif // CATCH_TAG_ALIAS_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_errno_guard.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_ERRNO_GUARD_HPP_INCLUDED
9 | #define CATCH_ERRNO_GUARD_HPP_INCLUDED
10 |
11 | namespace Catch {
12 |
13 | //! Simple RAII class that stores the value of `errno`
14 | //! at construction and restores it at destruction.
15 | class ErrnoGuard {
16 | public:
17 | // Keep these outlined to avoid dragging in macros from
18 |
19 | ErrnoGuard();
20 | ~ErrnoGuard();
21 | private:
22 | int m_oldErrno;
23 | };
24 |
25 | }
26 |
27 | #endif // CATCH_ERRNO_GUARD_HPP_INCLUDED
28 |
--------------------------------------------------------------------------------
/catch2/fuzzing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # License: Boost 1.0
2 | # By Paul Dreik 2020
3 |
4 | # add a library that brings in the main() function from libfuzzer
5 | # and has all the dependencies, so the individual fuzzers can be
6 | # added one line each.
7 | add_library(fuzzhelper NullOStream.h NullOStream.cpp)
8 | target_link_libraries(fuzzhelper PUBLIC Catch2::Catch2)
9 |
10 | # use C++17 so we can get string_view
11 | target_compile_features(fuzzhelper PUBLIC cxx_std_17)
12 |
13 | # This should be possible to set from the outside to be oss-fuzz compatible,
14 | # fix later. For now, target libFuzzer only.
15 | target_link_options(fuzzhelper PUBLIC "-fsanitize=fuzzer")
16 |
17 | foreach(fuzzer TestSpecParser XmlWriter textflow)
18 | add_executable(fuzz_${fuzzer} fuzz_${fuzzer}.cpp)
19 | target_link_libraries(fuzz_${fuzzer} PRIVATE fuzzhelper)
20 | endforeach()
21 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_timer.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TIMER_HPP_INCLUDED
9 | #define CATCH_TIMER_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | class Timer {
16 | uint64_t m_nanoseconds = 0;
17 | public:
18 | void start();
19 | auto getElapsedNanoseconds() const -> uint64_t;
20 | auto getElapsedMicroseconds() const -> uint64_t;
21 | auto getElapsedMilliseconds() const -> unsigned int;
22 | auto getElapsedSeconds() const -> double;
23 | };
24 |
25 | } // namespace Catch
26 |
27 | #endif // CATCH_TIMER_HPP_INCLUDED
28 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 | namespace Benchmark {
13 | namespace Detail {
14 | struct do_nothing {
15 | void operator()() const {}
16 | };
17 |
18 | BenchmarkFunction::callable::~callable() = default;
19 | BenchmarkFunction::BenchmarkFunction():
20 | f( new model{ {} } ){}
21 | } // namespace Detail
22 | } // namespace Benchmark
23 | } // namespace Catch
24 |
--------------------------------------------------------------------------------
/catch2/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create an issue that documents a bug
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **Expected behavior**
14 | A clear and concise description of what you expected to happen.
15 |
16 | **Reproduction steps**
17 | Steps to reproduce the bug.
18 |
19 |
20 |
21 | **Platform information:**
22 |
23 | - OS: **Windows NT**
24 | - Compiler+version: **GCC v2.9.5**
25 | - Catch version: **v1.2.3**
26 |
27 |
28 | **Additional context**
29 | Add any other context about the problem here.
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/catch_matchers_exception.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #include
9 |
10 | namespace Catch {
11 | namespace Matchers {
12 |
13 | bool ExceptionMessageMatcher::match(std::exception const& ex) const {
14 | return ex.what() == m_message;
15 | }
16 |
17 | std::string ExceptionMessageMatcher::describe() const {
18 | return "exception message matches \"" + m_message + '"';
19 | }
20 |
21 | ExceptionMessageMatcher Message(std::string const& message) {
22 | return ExceptionMessageMatcher(message);
23 | }
24 |
25 | } // namespace Matchers
26 | } // namespace Catch
27 |
--------------------------------------------------------------------------------
/catch2/.github/workflows/package-manager-builds.yaml:
--------------------------------------------------------------------------------
1 | name: Package Manager Builds
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | conan_builds:
7 | name: Conan ${{matrix.conan_version}}
8 | runs-on: ubuntu-22.04
9 | strategy:
10 | matrix:
11 | conan_version:
12 | - '1.63'
13 | - '2.1'
14 |
15 | include:
16 | # Conan 1 has default profiles installed
17 | - conan_version: '1.63'
18 | profile_generate: 'false'
19 |
20 | steps:
21 | - uses: actions/checkout@v4
22 |
23 | - name: Install conan
24 | run: pip install conan==${{matrix.conan_version}}
25 |
26 | - name: Setup conan profiles
27 | if: matrix.profile_generate != 'false'
28 | run: conan profile detect
29 |
30 | - name: Run conan package create
31 | run: conan create . -tf .conan/test_package
32 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_uncaught_exceptions.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include
14 |
15 | namespace Catch {
16 | bool uncaught_exceptions() {
17 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
18 | return false;
19 | #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
20 | return std::uncaught_exceptions() > 0;
21 | #else
22 | return std::uncaught_exception();
23 | #endif
24 | }
25 | } // end namespace Catch
26 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_test_case_info_hasher.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED
9 | #define CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct TestCaseInfo;
16 |
17 | class TestCaseInfoHasher {
18 | public:
19 | using hash_t = std::uint64_t;
20 | TestCaseInfoHasher( hash_t seed );
21 | uint32_t operator()( TestCaseInfo const& t ) const;
22 |
23 | private:
24 | hash_t m_seed;
25 | };
26 |
27 | } // namespace Catch
28 |
29 | #endif /* CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED */
30 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that test case methods with different class, but same name and
11 | * tags name and tags are not reported as error.
12 | */
13 |
14 | #include
15 |
16 | class TestCaseFixture1 {
17 | public:
18 | int m_a;
19 | };
20 |
21 | class TestCaseFixture2 {
22 | public:
23 | int m_a;
24 | };
25 |
26 | TEST_CASE_METHOD(TestCaseFixture1, "A test case with duplicated name and tags", "[tag1]") {}
27 | TEST_CASE_METHOD(TestCaseFixture2, "A test case with duplicated name and tags", "[tag1]") {}
28 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED
9 | #define CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED
10 |
11 | #define INTERNAL_CATCH_EXPAND1( param ) INTERNAL_CATCH_EXPAND2( param )
12 | #define INTERNAL_CATCH_EXPAND2( ... ) INTERNAL_CATCH_NO##__VA_ARGS__
13 | #define INTERNAL_CATCH_DEF( ... ) INTERNAL_CATCH_DEF __VA_ARGS__
14 | #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
15 |
16 | #define INTERNAL_CATCH_REMOVE_PARENS( ... ) \
17 | INTERNAL_CATCH_EXPAND1( INTERNAL_CATCH_DEF __VA_ARGS__ )
18 |
19 | #endif // CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED
20 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/detail/catch_analyse.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_ANALYSE_HPP_INCLUDED
11 | #define CATCH_ANALYSE_HPP_INCLUDED
12 |
13 | #include
14 | #include
15 |
16 |
17 | namespace Catch {
18 | class IConfig;
19 |
20 | namespace Benchmark {
21 | namespace Detail {
22 | SampleAnalysis analyse(const IConfig &cfg, FDuration* first, FDuration* last);
23 | } // namespace Detail
24 | } // namespace Benchmark
25 | } // namespace Catch
26 |
27 | #endif // CATCH_ANALYSE_HPP_INCLUDED
28 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #if defined(CATCH_CONFIG_CPP17_BYTE)
12 |
13 | TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) {
14 | using type = std::byte;
15 | REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) );
16 | }
17 |
18 | TEST_CASE( "std::vector -> toString", "[toString][byte][approvals]" ) {
19 | using type = std::vector;
20 | REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) );
21 | }
22 |
23 | #endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE
24 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_clock.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_CLOCK_HPP_INCLUDED
11 | #define CATCH_CLOCK_HPP_INCLUDED
12 |
13 | #include
14 |
15 | namespace Catch {
16 | namespace Benchmark {
17 | using IDuration = std::chrono::nanoseconds;
18 | using FDuration = std::chrono::duration;
19 |
20 | template
21 | using TimePoint = typename Clock::time_point;
22 |
23 | using default_clock = std::chrono::steady_clock;
24 | } // namespace Benchmark
25 | } // namespace Catch
26 |
27 | #endif // CATCH_CLOCK_HPP_INCLUDED
28 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED
9 | #define CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | // We cannot forward declare the type with default template argument
16 | // multiple times, so it is split out into a separate header so that
17 | // we can prevent multiple declarations in dependees
18 | template
19 | struct BenchmarkStats;
20 |
21 | } // end namespace Catch
22 |
23 | #endif // CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED
24 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_parse_numbers.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_PARSE_NUMBERS_HPP_INCLUDED
9 | #define CATCH_PARSE_NUMBERS_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace Catch {
16 |
17 | /**
18 | * Parses unsigned int from the input, using provided base
19 | *
20 | * Effectively a wrapper around std::stoul but with better error checking
21 | * e.g. "-1" is rejected, instead of being parsed as UINT_MAX.
22 | */
23 | Optional parseUInt(std::string const& input, int base = 10);
24 | }
25 |
26 | #endif // CATCH_PARSE_NUMBERS_HPP_INCLUDED
27 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_windows_h_proxy.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
9 | #define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #if defined(CATCH_PLATFORM_WINDOWS)
14 |
15 | // We might end up with the define made globally through the compiler,
16 | // and we don't want to trigger warnings for this
17 | #if !defined(NOMINMAX)
18 | # define NOMINMAX
19 | #endif
20 | #if !defined(WIN32_LEAN_AND_MEAN)
21 | # define WIN32_LEAN_AND_MEAN
22 | #endif
23 |
24 | #include
25 |
26 | #endif // defined(CATCH_PLATFORM_WINDOWS)
27 |
28 | #endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
29 |
--------------------------------------------------------------------------------
/cases/cavity/constant/polyMesh/boundary:
--------------------------------------------------------------------------------
1 | FoamFile
2 | {
3 | version 2.0;
4 | format ascii;
5 | class polyBoundaryMesh;
6 | location "constant/polyMesh";
7 | object boundary;
8 | }
9 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10 |
11 | 3
12 | (
13 | movingWall
14 | {
15 | type wall;
16 | nFaces 20;
17 | startFace 760;
18 | closedSolidBodyMotion false;
19 | }
20 | fixedWalls
21 | {
22 | type wall;
23 | nFaces 60;
24 | startFace 780;
25 | closedSolidBodyMotion false;
26 | }
27 | frontAndBack
28 | {
29 | type empty;
30 | nFaces 800;
31 | startFace 840;
32 | }
33 | )
34 |
35 |
36 | // ************************************************************************* //
37 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X40-QuickExit.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Call ~~quick_exit~~ inside a test.
11 | *
12 | * This is used to test whether Catch2 properly creates the crash guard
13 | * file based on provided arguments.
14 | */
15 |
16 | #include
17 |
18 | #include
19 |
20 | TEST_CASE("quick_exit", "[quick_exit]") {
21 | // Return 0 as fake "successful" exit, while there should be a guard
22 | // file created and kept.
23 | std::exit(0);
24 | // We cannot use quick_exit because libstdc++ on older MacOS versions didn't support it yet.
25 | // std::quick_exit(0);
26 | }
27 |
28 | TEST_CASE("pass") {}
29 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_unique_name.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_UNIQUE_NAME_HPP_INCLUDED
9 | #define CATCH_UNIQUE_NAME_HPP_INCLUDED
10 |
11 | #include
12 | #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
13 | #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
14 | #ifdef CATCH_CONFIG_COUNTER
15 | # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
16 | #else
17 | # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
18 | #endif
19 |
20 | #endif // CATCH_UNIQUE_NAME_HPP_INCLUDED
21 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_to_string.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TO_STRING_HPP_INCLUDED
9 | #define CATCH_TO_STRING_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | namespace Catch {
17 | template
18 | std::string to_string(T const& t) {
19 | #if defined(CATCH_CONFIG_CPP11_TO_STRING)
20 | return std::to_string(t);
21 | #else
22 | ReusableStringStream rss;
23 | rss << t;
24 | return rss.str();
25 | #endif
26 | }
27 | } // end namespace Catch
28 |
29 | #endif // CATCH_TO_STRING_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_assertion_info.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED
9 | #define CATCH_ASSERTION_INFO_HPP_INCLUDED
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | namespace Catch {
16 |
17 | struct AssertionInfo {
18 | // AssertionInfo() = delete;
19 |
20 | StringRef macroName;
21 | SourceLineInfo lineInfo;
22 | StringRef capturedExpression;
23 | ResultDisposition::Flags resultDisposition;
24 | };
25 |
26 | } // end namespace Catch
27 |
28 | #endif // CATCH_ASSERTION_INFO_HPP_INCLUDED
29 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/updateDocumentSnippets.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | from scriptCommon import catchPath
4 | import os
5 | import subprocess
6 |
7 | # ---------------------------------------------------
8 | # Update code examples
9 | # ---------------------------------------------------
10 | # For info on mdsnippets, see https://github.com/SimonCropp/MarkdownSnippets
11 |
12 | # install dotnet SDK from http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
13 | # Then install MarkdownSnippets.Tool with
14 | # dotnet tool install -g MarkdownSnippets.Tool
15 | # To update:
16 | # dotnet tool update -g MarkdownSnippets.Tool
17 | # To uninstall (e.g. to downgrade to a lower version)
18 | # dotnet tool uninstall -g MarkdownSnippets.Tool
19 |
20 | os.chdir(catchPath)
21 |
22 | subprocess.run('dotnet tool update -g MarkdownSnippets.Tool --version 21.2.0', shell=True, check=True)
23 | subprocess.run('mdsnippets', shell=True, check=True)
24 |
--------------------------------------------------------------------------------
/catch2/.github/workflows/mac-builds.yml:
--------------------------------------------------------------------------------
1 | name: Mac Builds
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | # From macos-14 forward, the baseline "macos-X" image is Arm based,
8 | # and not Intel based.
9 | runs-on: ${{matrix.image}}
10 | strategy:
11 | fail-fast: false
12 | matrix:
13 | image: [macos-13, macos-14, macos-15]
14 | build_type: [Debug, Release]
15 | std: [14, 17]
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 |
20 | - name: Configure
21 | run: |
22 | cmake --preset basic-tests -GNinja \
23 | -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
24 | -DCMAKE_CXX_STANDARD=${{matrix.std}} \
25 | -DCATCH_BUILD_EXAMPLES=ON \
26 | -DCATCH_BUILD_EXTRA_TESTS=ON
27 |
28 | - name: Build
29 | run: cmake --build build
30 |
31 | - name: Test
32 | run: ctest --test-dir build -j --output-on-failure
33 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_startup_exception_registry.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED
9 | #define CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED
10 |
11 |
12 | #include
13 | #include
14 |
15 | namespace Catch {
16 |
17 | class StartupExceptionRegistry {
18 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
19 | public:
20 | void add(std::exception_ptr const& exception) noexcept;
21 | std::vector const& getExceptions() const noexcept;
22 | private:
23 | std::vector m_exceptions;
24 | #endif
25 | };
26 |
27 | } // end namespace Catch
28 |
29 | #endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/tools/misc/SelfTest.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 |
7 |
8 |
9 |
10 | false
11 |
12 |
13 |
14 |
15 | false
16 |
17 |
18 |
19 |
20 | false
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #include
9 |
10 | namespace Catch {
11 | namespace Matchers {
12 | std::string AllTrueMatcher::describe() const { return "contains only true"; }
13 |
14 | AllTrueMatcher AllTrue() { return AllTrueMatcher{}; }
15 |
16 | std::string NoneTrueMatcher::describe() const { return "contains no true"; }
17 |
18 | NoneTrueMatcher NoneTrue() { return NoneTrueMatcher{}; }
19 |
20 | std::string AnyTrueMatcher::describe() const { return "contains at least one true"; }
21 |
22 | AnyTrueMatcher AnyTrue() { return AnyTrueMatcher{}; }
23 | } // namespace Matchers
24 | } // namespace Catch
25 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X10-FallbackStringifier.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Test that the user can define custom fallbackStringifier
11 | *
12 | * This is done by defining a custom fallback stringifier that prints
13 | * out a specific string, and then asserting (to cause stringification)
14 | * over a type without stringification support.
15 | */
16 |
17 | #include
18 |
19 | // A catch-all stringifier
20 | template
21 | std::string fallbackStringifier(T const&) {
22 | return "{ !!! }";
23 | }
24 |
25 | #include
26 |
27 | struct foo {
28 | explicit operator bool() const {
29 | return true;
30 | }
31 | };
32 |
33 | TEST_CASE("aa") {
34 | REQUIRE(foo{});
35 | }
36 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X36-ReportingCrashWithJunitReporter.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that signals/SEH within open section does not hard crash JUnit
11 | * (or similar reporter) while we are trying to report fatal error.
12 | */
13 |
14 | #include
15 |
16 | #include
17 |
18 | // On Windows we need to send SEH and not signal to test the
19 | // RunContext::handleFatalErrorCondition code path
20 | #if defined( _MSC_VER )
21 | # include
22 | #endif
23 |
24 | TEST_CASE( "raises signal" ) {
25 | SECTION( "section" ) {
26 | #if defined( _MSC_VER )
27 | RaiseException( 0xC0000005, 0, 0, NULL );
28 | #else
29 | std::raise( SIGILL );
30 | #endif
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_environment.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_ENVIRONMENT_HPP_INCLUDED
11 | #define CATCH_ENVIRONMENT_HPP_INCLUDED
12 |
13 | #include
14 | #include
15 |
16 | namespace Catch {
17 | namespace Benchmark {
18 | struct EnvironmentEstimate {
19 | FDuration mean;
20 | OutlierClassification outliers;
21 | };
22 | struct Environment {
23 | EnvironmentEstimate clock_resolution;
24 | EnvironmentEstimate clock_cost;
25 | };
26 | } // namespace Benchmark
27 | } // namespace Catch
28 |
29 | #endif // CATCH_ENVIRONMENT_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_tag_alias_autoregistrar.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | namespace Catch {
14 |
15 | RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
16 | CATCH_TRY {
17 | getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
18 | } CATCH_CATCH_ALL {
19 | // Do not throw when constructing global objects, instead register the exception to be processed later
20 | getMutableRegistryHub().registerStartupException();
21 | }
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_stream_end_stop.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED
9 | #define CATCH_STREAM_END_STOP_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | // Use this in variadic streaming macros to allow
16 | // << +StreamEndStop
17 | // as well as
18 | // << stuff +StreamEndStop
19 | struct StreamEndStop {
20 | constexpr StringRef operator+() const { return StringRef(); }
21 |
22 | template
23 | constexpr friend T const& operator+( T const& value, StreamEndStop ) {
24 | return value;
25 | }
26 | };
27 |
28 | } // namespace Catch
29 |
30 | #endif // CATCH_STREAM_END_STOP_HPP_INCLUDED
31 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED
9 | #define CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct TagAlias;
16 |
17 | class ITagAliasRegistry {
18 | public:
19 | virtual ~ITagAliasRegistry(); // = default
20 | // Nullptr if not present
21 | virtual TagAlias const* find( std::string const& alias ) const = 0;
22 | virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;
23 |
24 | static ITagAliasRegistry const& get();
25 | };
26 |
27 | } // end namespace Catch
28 |
29 | #endif // CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_noncopyable.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_NONCOPYABLE_HPP_INCLUDED
9 | #define CATCH_NONCOPYABLE_HPP_INCLUDED
10 |
11 | namespace Catch {
12 | namespace Detail {
13 |
14 | //! Deriving classes become noncopyable and nonmovable
15 | class NonCopyable {
16 | public:
17 | NonCopyable( NonCopyable const& ) = delete;
18 | NonCopyable( NonCopyable&& ) = delete;
19 | NonCopyable& operator=( NonCopyable const& ) = delete;
20 | NonCopyable& operator=( NonCopyable&& ) = delete;
21 |
22 | protected:
23 | NonCopyable() noexcept = default;
24 | };
25 |
26 | } // namespace Detail
27 | } // namespace Catch
28 |
29 | #endif // CATCH_NONCOPYABLE_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/generators/catch_generator_exception.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED
9 | #define CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | // Exception type to be thrown when a Generator runs into an error,
16 | // e.g. it cannot initialize the first return value based on
17 | // runtime information
18 | class GeneratorException : public std::exception {
19 | const char* const m_msg = "";
20 |
21 | public:
22 | GeneratorException(const char* msg):
23 | m_msg(msg)
24 | {}
25 |
26 | const char* what() const noexcept final;
27 | };
28 |
29 | } // end namespace Catch
30 |
31 | #endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED
32 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/detail/catch_timing.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_TIMING_HPP_INCLUDED
11 | #define CATCH_TIMING_HPP_INCLUDED
12 |
13 | #include
14 | #include
15 |
16 | namespace Catch {
17 | namespace Benchmark {
18 | template
19 | struct Timing {
20 | IDuration elapsed;
21 | Result result;
22 | int iterations;
23 | };
24 | template
25 | using TimingOf = Timing>>;
26 | } // namespace Benchmark
27 | } // namespace Catch
28 |
29 | #endif // CATCH_TIMING_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_message_info.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 |
13 | MessageInfo::MessageInfo( StringRef _macroName,
14 | SourceLineInfo const& _lineInfo,
15 | ResultWas::OfType _type )
16 | : macroName( _macroName ),
17 | lineInfo( _lineInfo ),
18 | type( _type ),
19 | sequence( ++globalCount )
20 | {}
21 |
22 | // Messages are owned by their individual threads, so the counter should be thread-local as well.
23 | // Alternative consideration: atomic, so threads don't share IDs and things are easier to debug.
24 | thread_local unsigned int MessageInfo::globalCount = 0;
25 |
26 | } // end namespace Catch
27 |
--------------------------------------------------------------------------------
/catch2/tests/TestScripts/DiscoverTests/register-tests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | TEST_CASE("@Script[C:\\EPM1A]=x;\"SCALA_ZERO:\"", "[script regressions]"){}
12 | TEST_CASE("Some test") {}
13 | TEST_CASE( "Let's have a test case with a long name. Longer. No, even longer. "
14 | "Really looooooooooooong. Even longer than that. Multiple lines "
15 | "worth of test name. Yep, like this." ) {}
16 | TEST_CASE( "And now a test case with weird tags.", "[tl;dr][tl;dw][foo,bar]" ) {}
17 | // Also check that we handle tests on class, which have name in output as 'class-name', not 'name'.
18 | class TestCaseFixture {
19 | public:
20 | int m_a;
21 | };
22 |
23 | TEST_CASE_METHOD(TestCaseFixture, "A test case as method", "[tagstagstags]") {}
24 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_test_failure_exception.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | namespace Catch {
14 |
15 | void throw_test_failure_exception() {
16 | #if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
17 | throw TestFailureException{};
18 | #else
19 | CATCH_ERROR( "Test failure requires aborting test!" );
20 | #endif
21 | }
22 |
23 | void throw_test_skip_exception() {
24 | #if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
25 | throw Catch::TestSkipException();
26 | #else
27 | CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" );
28 | #endif
29 | }
30 |
31 | } // namespace Catch
32 |
--------------------------------------------------------------------------------
/catch2/.github/workflows/windows-simple-builds.yml:
--------------------------------------------------------------------------------
1 | name: Windows Builds (Basic)
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | name: ${{matrix.os}}, ${{matrix.std}}, ${{matrix.build_type}}, ${{matrix.platform}}
8 | runs-on: ${{matrix.os}}
9 | strategy:
10 | fail-fast: false
11 | matrix:
12 | os: [windows-2022, windows-2025]
13 | platform: [Win32, x64]
14 | build_type: [Debug, Release]
15 | std: [14, 17]
16 | steps:
17 | - uses: actions/checkout@v4
18 |
19 | - name: Configure build
20 | run: |
21 | cmake --preset all-tests `
22 | -A ${{matrix.platform}} `
23 | -DCMAKE_CXX_STANDARD=${{matrix.std}} `
24 |
25 | - name: Build tests
26 | run: cmake --build build --config ${{matrix.build_type}} --parallel %NUMBER_OF_PROCESSORS%
27 | shell: cmd
28 |
29 | - name: Run tests
30 | run: ctest --test-dir build -C ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS% --output-on-failure
31 | shell: cmd
32 |
--------------------------------------------------------------------------------
/catch2/benchmarks/assertion_listener.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | /**
13 | * Event listener that listens to all assertions, forcing assertion slow path
14 | */
15 | class AssertionSlowPathListener : public Catch::EventListenerBase {
16 | public:
17 | static std::string getDescription() {
18 | return "Validates ordering of Catch2's listener events";
19 | }
20 |
21 | AssertionSlowPathListener(Catch::IConfig const* config) :
22 | EventListenerBase(config) {
23 | m_preferences.shouldReportAllAssertions = true;
24 | m_preferences.shouldReportAllAssertionStarts = true;
25 | }
26 | };
27 |
28 | CATCH_REGISTER_LISTENER( AssertionSlowPathListener )
29 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/catch_matchers_container_properties.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace Catch {
13 | namespace Matchers {
14 |
15 | std::string IsEmptyMatcher::describe() const {
16 | return "is empty";
17 | }
18 |
19 | std::string HasSizeMatcher::describe() const {
20 | ReusableStringStream sstr;
21 | sstr << "has size == " << m_target_size;
22 | return sstr.str();
23 | }
24 |
25 | IsEmptyMatcher IsEmpty() {
26 | return {};
27 | }
28 |
29 | HasSizeMatcher SizeIs(std::size_t sz) {
30 | return HasSizeMatcher{ sz };
31 | }
32 |
33 | } // end namespace Matchers
34 | } // end namespace Catch
35 |
--------------------------------------------------------------------------------
/catch2/tools/scripts/approve.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import os
4 | import sys
5 | import shutil
6 | import glob
7 | from scriptCommon import catchPath
8 |
9 | rootPath = os.path.join( catchPath, 'tests/SelfTest/Baselines' )
10 |
11 | if len(sys.argv) > 1:
12 | files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
13 | else:
14 | files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) )
15 |
16 |
17 | def approveFile( approvedFile, unapprovedFile ):
18 | justFilename = unapprovedFile[len(rootPath)+1:]
19 | if os.path.exists( unapprovedFile ):
20 | if os.path.exists( approvedFile ):
21 | os.remove( approvedFile )
22 | os.rename( unapprovedFile, approvedFile )
23 | print( "approved " + justFilename )
24 | else:
25 | print( "approval file " + justFilename + " does not exist" )
26 |
27 | if files:
28 | for unapprovedFile in files:
29 | approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
30 | else:
31 | print( "no files to approve" )
32 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_lazy_expr.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace Catch {
13 |
14 | auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
15 | if (lazyExpr.m_isNegated)
16 | os << '!';
17 |
18 | if (lazyExpr) {
19 | if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
20 | os << '(' << *lazyExpr.m_transientExpression << ')';
21 | else
22 | os << *lazyExpr.m_transientExpression;
23 | } else {
24 | os << "{** error - unchecked empty expression requested **}";
25 | }
26 | return os;
27 | }
28 |
29 | } // namespace Catch
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace Catch {
13 | namespace Generators {
14 |
15 | bool GeneratorUntypedBase::countedNext() {
16 | auto ret = next();
17 | if ( ret ) {
18 | m_stringReprCache.clear();
19 | ++m_currentElementIndex;
20 | }
21 | return ret;
22 | }
23 |
24 | StringRef GeneratorUntypedBase::currentElementAsString() const {
25 | if ( m_stringReprCache.empty() ) {
26 | m_stringReprCache = stringifyImpl();
27 | }
28 | return m_stringReprCache;
29 | }
30 |
31 | } // namespace Generators
32 | } // namespace Catch
33 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_exception_translator_registry.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
9 | #define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace Catch {
17 |
18 | class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
19 | public:
20 | ~ExceptionTranslatorRegistry() override;
21 | void registerTranslator( Detail::unique_ptr&& translator );
22 | std::string translateActiveException() const override;
23 |
24 | private:
25 | ExceptionTranslators m_translators;
26 | };
27 | }
28 |
29 | #endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_sample_analysis.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED
11 | #define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED
12 |
13 | #include
14 | #include
15 | #include
16 |
17 | #include
18 |
19 | namespace Catch {
20 | namespace Benchmark {
21 | struct SampleAnalysis {
22 | std::vector samples;
23 | Estimate mean;
24 | Estimate standard_deviation;
25 | OutlierClassification outliers;
26 | double outlier_variance;
27 | };
28 | } // namespace Benchmark
29 | } // namespace Catch
30 |
31 | #endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED
32 |
--------------------------------------------------------------------------------
/.github/workflows/of9.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to run tests in OpenFOAM 10 containers
2 | name: OF9
3 |
4 | # Make sure shells are interactive, so OF can get sourced
5 | defaults:
6 | run:
7 | shell: bash -o pipefail -i {0}
8 |
9 | # Controls when the workflow will run
10 | on:
11 | push
12 |
13 | jobs:
14 | build:
15 | runs-on: ubuntu-22.04
16 |
17 | container:
18 | image: ghcr.io/foamscience/jammy-openfoam:9
19 | options: --cpus 2 --user openfoam
20 | env:
21 | CATCH_TIMEOUT: 20
22 |
23 | steps:
24 | - name: Checkout repository
25 | uses: actions/checkout@v3
26 |
27 | - name: Setup tmate session
28 | uses: mxschmitt/action-tmate@v3
29 | if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
30 | with:
31 | detached: true
32 |
33 | - name: Compile and Test
34 | run: |
35 | source /opt/openfoam9/etc/bashrc
36 | mkdir -p $FOAM_USER_LIBBIN
37 | export FOAM_FOAMUT=$PWD
38 | ./foamut
39 | ./foamut --parallel --mpirun-options oversubscribe
40 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_getenv.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace Catch {
17 | namespace Detail {
18 |
19 | #if !defined (CATCH_CONFIG_GETENV)
20 | char const* getEnv( char const* ) { return nullptr; }
21 | #else
22 |
23 | char const* getEnv( char const* varName ) {
24 | # if defined( _MSC_VER )
25 | # pragma warning( push )
26 | # pragma warning( disable : 4996 ) // use getenv_s instead of getenv
27 | # endif
28 |
29 | return std::getenv( varName );
30 |
31 | # if defined( _MSC_VER )
32 | # pragma warning( pop )
33 | # endif
34 | }
35 | #endif
36 | } // namespace Detail
37 | } // namespace Catch
38 |
--------------------------------------------------------------------------------
/catch2/tools/misc/installOpenCppCoverage.ps1:
--------------------------------------------------------------------------------
1 | # Downloads are done from the official github release page links
2 | $downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe"
3 | $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe")
4 |
5 | if(-Not (Test-Path $installerPath)) {
6 | Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl)
7 | Start-BitsTransfer $downloadUrl -Destination $installerPath
8 | }
9 |
10 | Write-Host -ForegroundColor White "About to install OpenCppCoverage..."
11 |
12 | $installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait)
13 | if($installProcess.ExitCode -ne 0) {
14 | throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode)
15 | }
16 |
17 | # Assume standard, boring, installation path of ".../Program Files/OpenCppCoverage"
18 | $installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage")
19 | $env:Path="$env:Path;$installPath"
20 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_config_prefix_messages.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /** \file
10 | * Wrapper for the CATCH_CONFIG_PREFIX_MESSAGES configuration option
11 | *
12 | * CATCH_CONFIG_PREFIX_ALL can be used to avoid clashes with other macros
13 | * by prepending CATCH_. This may not be desirable if the only clashes are with
14 | * logger macros such as INFO and WARN. In this cases
15 | * CATCH_CONFIG_PREFIX_MESSAGES can be used to only prefix a small subset
16 | * of relevant macros.
17 | *
18 | */
19 |
20 | #ifndef CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED
21 | #define CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED
22 |
23 | #include
24 |
25 | #if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_PREFIX_MESSAGES)
26 | #define CATCH_CONFIG_PREFIX_MESSAGES
27 | #endif
28 |
29 | #endif // CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | namespace Catch {
15 | namespace Benchmark {
16 | namespace Detail {
17 | struct optimized_away_error : std::exception {
18 | const char* what() const noexcept override;
19 | };
20 |
21 | const char* optimized_away_error::what() const noexcept {
22 | return "could not measure benchmark, maybe it was optimized away";
23 | }
24 |
25 | void throw_optimized_away_error() {
26 | Catch::throw_exception(optimized_away_error{});
27 | }
28 |
29 | } // namespace Detail
30 | } // namespace Benchmark
31 | } // namespace Catch
32 |
--------------------------------------------------------------------------------
/catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_INTERFACES_TESTCASE_HPP_INCLUDED
9 | #define CATCH_INTERFACES_TESTCASE_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct TestCaseInfo;
16 | class TestCaseHandle;
17 | class IConfig;
18 |
19 | class ITestCaseRegistry {
20 | public:
21 | virtual ~ITestCaseRegistry(); // = default
22 | // TODO: this exists only for adding filenames to test cases -- let's expose this in a saner way later
23 | virtual std::vector const& getAllInfos() const = 0;
24 | virtual std::vector const& getAllTests() const = 0;
25 | virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0;
26 | };
27 |
28 | }
29 |
30 | #endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED
31 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_config_android_logwrite.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /** \file
10 | * Wrapper for ANDROID_LOGWRITE configuration option
11 | *
12 | * We want to default to enabling it when compiled for android, but
13 | * users of the library should also be able to disable it if they want
14 | * to.
15 | */
16 |
17 | #ifndef CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED
18 | #define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED
19 |
20 | #include
21 |
22 | #if defined(__ANDROID__)
23 | # define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE
24 | #endif
25 |
26 |
27 | #if defined( CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE ) && \
28 | !defined( CATCH_CONFIG_NO_ANDROID_LOGWRITE ) && \
29 | !defined( CATCH_CONFIG_ANDROID_LOGWRITE )
30 | # define CATCH_CONFIG_ANDROID_LOGWRITE
31 | #endif
32 |
33 | #endif // CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED
34 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_list.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_LIST_HPP_INCLUDED
9 | #define CATCH_LIST_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 |
17 | namespace Catch {
18 |
19 | class IEventListener;
20 | class Config;
21 |
22 |
23 | struct ReporterDescription {
24 | std::string name, description;
25 | };
26 | struct ListenerDescription {
27 | StringRef name;
28 | std::string description;
29 | };
30 |
31 | struct TagInfo {
32 | void add(StringRef spelling);
33 | std::string all() const;
34 |
35 | std::set spellings;
36 | std::size_t count = 0;
37 | };
38 |
39 | bool list( IEventListener& reporter, Config const& config );
40 |
41 | } // end namespace Catch
42 |
43 | #endif // CATCH_LIST_HPP_INCLUDED
44 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_startup_exception_registry.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | namespace Catch {
14 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
15 | void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
16 | CATCH_TRY {
17 | m_exceptions.push_back(exception);
18 | } CATCH_CATCH_ALL {
19 | // If we run out of memory during start-up there's really not a lot more we can do about it
20 | std::terminate();
21 | }
22 | }
23 |
24 | std::vector const& StartupExceptionRegistry::getExceptions() const noexcept {
25 | return m_exceptions;
26 | }
27 | #endif
28 |
29 | } // end namespace Catch
30 |
--------------------------------------------------------------------------------
/.github/workflows/of2206.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to run tests in OpenFOAM v2206 containers
2 | name: OF2206
3 |
4 | # Make sure shells are interactive, so OF can get sourced
5 | defaults:
6 | run:
7 | shell: bash -o pipefail -i {0}
8 |
9 | # Controls when the workflow will run
10 | on:
11 | push
12 |
13 | jobs:
14 | build:
15 | runs-on: ubuntu-22.04
16 |
17 | container:
18 | image: ghcr.io/foamscience/jammy-openfoam:v2206
19 | options: --cpus 2 --user openfoam
20 | env:
21 | CATCH_TIMEOUT: 20
22 |
23 | steps:
24 | - name: Checkout repository
25 | uses: actions/checkout@v3
26 |
27 | - name: Setup tmate session
28 | uses: mxschmitt/action-tmate@v3
29 | if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
30 | with:
31 | detached: true
32 |
33 | - name: Compile and Test
34 | run: |
35 | source /usr/lib/openfoam/openfoam2206/etc/bashrc
36 | mkdir -p $FOAM_USER_LIBBIN
37 | export FOAM_FOAMUT=$PWD
38 | ./foamut
39 | ./foamut --parallel --mpirun-options oversubscribe
40 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
9 | #define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 | namespace Detail {
15 | //! Provides case-insensitive `op<` semantics when called
16 | struct CaseInsensitiveLess {
17 | bool operator()( StringRef lhs,
18 | StringRef rhs ) const;
19 | };
20 |
21 | //! Provides case-insensitive `op==` semantics when called
22 | struct CaseInsensitiveEqualTo {
23 | bool operator()( StringRef lhs,
24 | StringRef rhs ) const;
25 | };
26 |
27 | } // namespace Detail
28 | } // namespace Catch
29 |
30 | #endif // CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
31 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_random_seed_generation.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 |
17 | namespace Catch {
18 |
19 | std::uint32_t generateRandomSeed( GenerateFrom from ) {
20 | switch ( from ) {
21 | case GenerateFrom::Time:
22 | return static_cast( std::time( nullptr ) );
23 |
24 | case GenerateFrom::Default:
25 | case GenerateFrom::RandomDevice: {
26 | std::random_device rd;
27 | return Detail::fillBitsFrom( rd );
28 | }
29 |
30 | default:
31 | CATCH_ERROR("Unknown generation method");
32 | }
33 | }
34 |
35 | } // end namespace Catch
36 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * This file serves as a simple compilation test against the amalgamated
11 | * version of Catch2.
12 | */
13 |
14 | #include "catch_amalgamated.hpp"
15 |
16 | TEST_CASE("Just a dummy test") {
17 | auto i = GENERATE(1, 2, 3);
18 | SECTION("a") {
19 | REQUIRE(i != 4);
20 | }
21 | SECTION("b") {
22 | CHECK(i != 5);
23 | }
24 | REQUIRE_THAT(1,
25 | Catch::Matchers::Predicate([](int i) {
26 | return i % 2 == 1;
27 | }));
28 | }
29 |
30 | TEMPLATE_TEST_CASE("Trivial template test case", "", char, short) {
31 | STATIC_REQUIRE(sizeof(TestType) <= sizeof(int));
32 | }
33 |
34 | TEST_CASE("Benchmark test", "[!benchmark]") {
35 | BENCHMARK("Allocation benchmark") {
36 | return std::vector(10);
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/catch2/.github/workflows/validate-header-guards.yml:
--------------------------------------------------------------------------------
1 | name: Check header guards
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | # Set the type of machine to run on
8 | runs-on: ubuntu-22.04
9 | steps:
10 |
11 | - name: Checkout source code
12 | uses: actions/checkout@v4
13 |
14 | - name: Setup Dependencies
15 | uses: actions/setup-python@v2
16 | with:
17 | python-version: '3.7'
18 | - name: Install checkguard
19 | run: pip install guardonce
20 |
21 | - name: Check that include guards are properly named
22 | run: |
23 | wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper")
24 | if [[ $wrong_files ]]; then
25 | echo "Files with wrong header guard:"
26 | echo $wrong_files
27 | exit 1
28 | fi
29 |
30 | - name: Check that there are no duplicated filenames
31 | run: |
32 | ./tools/scripts/checkDuplicateFilenames.py
33 |
34 | - name: Check that all source files have the correct license header
35 | run: |
36 | ./tools/scripts/checkLicense.py
37 |
--------------------------------------------------------------------------------
/catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /**\file
10 | * Checks that reporter registration errors are caught and handled as
11 | * startup errors, by causing a registration error by registering multiple
12 | * reporters with the same name.
13 | */
14 |
15 | #include
16 |
17 | #include
18 | #include
19 |
20 | namespace {
21 | //! Trivial custom reporter for registration
22 | class TestReporter : public Catch::StreamingReporterBase {
23 | public:
24 | using StreamingReporterBase::StreamingReporterBase;
25 |
26 | static std::string getDescription() { return "X35 test reporter"; }
27 | };
28 | }
29 |
30 | CATCH_REGISTER_REPORTER( "test-reporter", TestReporter )
31 | CATCH_REGISTER_REPORTER( "test-reporter", TestReporter )
32 |
--------------------------------------------------------------------------------
/catch2/src/catch2/benchmark/catch_outlier_classification.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | // Adapted from donated nonius code.
9 |
10 | #ifndef CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED
11 | #define CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED
12 |
13 | namespace Catch {
14 | namespace Benchmark {
15 | struct OutlierClassification {
16 | int samples_seen = 0;
17 | int low_severe = 0; // more than 3 times IQR below Q1
18 | int low_mild = 0; // 1.5 to 3 times IQR below Q1
19 | int high_mild = 0; // 1.5 to 3 times IQR above Q3
20 | int high_severe = 0; // more than 3 times IQR above Q3
21 |
22 | constexpr int total() const {
23 | return low_severe + low_mild + high_mild + high_severe;
24 | }
25 | };
26 | } // namespace Benchmark
27 | } // namespace Catch
28 |
29 | #endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED
30 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_config_counter.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | /** \file
10 | * Wrapper for the CONFIG configuration option
11 | *
12 | * When generating internal unique names, there are two options. Either
13 | * we mix in the current line number, or mix in an incrementing number.
14 | * We prefer the latter, using `__COUNTER__`, but users might want to
15 | * use the former.
16 | */
17 |
18 | #ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED
19 | #define CATCH_CONFIG_COUNTER_HPP_INCLUDED
20 |
21 | #include
22 |
23 | #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
24 | #define CATCH_INTERNAL_CONFIG_COUNTER
25 | #endif
26 |
27 | #if defined( CATCH_INTERNAL_CONFIG_COUNTER ) && \
28 | !defined( CATCH_CONFIG_NO_COUNTER ) && \
29 | !defined( CATCH_CONFIG_COUNTER )
30 | # define CATCH_CONFIG_COUNTER
31 | #endif
32 |
33 |
34 | #endif // CATCH_CONFIG_COUNTER_HPP_INCLUDED
35 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_singletons.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #include
9 |
10 | #include
11 |
12 | namespace Catch {
13 |
14 | namespace {
15 | static auto getSingletons() -> std::vector*& {
16 | static std::vector* g_singletons = nullptr;
17 | if( !g_singletons )
18 | g_singletons = new std::vector();
19 | return g_singletons;
20 | }
21 | }
22 |
23 | ISingleton::~ISingleton() = default;
24 |
25 | void addSingleton(ISingleton* singleton ) {
26 | getSingletons()->push_back( singleton );
27 | }
28 | void cleanupSingletons() {
29 | auto& singletons = getSingletons();
30 | for( auto singleton : *singletons )
31 | delete singleton;
32 | delete singletons;
33 | singletons = nullptr;
34 | }
35 |
36 | } // namespace Catch
37 |
--------------------------------------------------------------------------------
/catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | namespace Catch {
15 |
16 | // This is the general overload that takes a any string matcher
17 | // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
18 | // the Equals matcher (so the header does not mention matchers)
19 | void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ) {
20 | std::string exceptionMessage = Catch::translateActiveException();
21 | MatchExpr expr( CATCH_MOVE(exceptionMessage), matcher );
22 | handler.handleExpr( expr );
23 | }
24 |
25 | } // namespace Catch
26 |
--------------------------------------------------------------------------------
/catch2/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 | ## Description
12 |
18 |
19 | ## GitHub Issues
20 |
29 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_decomposer.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 |
11 | namespace Catch {
12 |
13 | void ITransientExpression::streamReconstructedExpression(
14 | std::ostream& os ) const {
15 | // We can't make this function pure virtual to keep ITransientExpression
16 | // constexpr, so we write error message instead
17 | os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression";
18 | }
19 |
20 | void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
21 | if( lhs.size() + rhs.size() < 40 &&
22 | lhs.find('\n') == std::string::npos &&
23 | rhs.find('\n') == std::string::npos )
24 | os << lhs << ' ' << op << ' ' << rhs;
25 | else
26 | os << lhs << '\n' << op << '\n' << rhs;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/catch2/src/catch2/catch_totals.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TOTALS_HPP_INCLUDED
9 | #define CATCH_TOTALS_HPP_INCLUDED
10 |
11 | #include
12 |
13 | namespace Catch {
14 |
15 | struct Counts {
16 | Counts operator - ( Counts const& other ) const;
17 | Counts& operator += ( Counts const& other );
18 |
19 | std::uint64_t total() const;
20 | bool allPassed() const;
21 | bool allOk() const;
22 |
23 | std::uint64_t passed = 0;
24 | std::uint64_t failed = 0;
25 | std::uint64_t failedButOk = 0;
26 | std::uint64_t skipped = 0;
27 | };
28 |
29 | struct Totals {
30 |
31 | Totals operator - ( Totals const& other ) const;
32 | Totals& operator += ( Totals const& other );
33 |
34 | Totals delta( Totals const& prevTotals ) const;
35 |
36 | Counts assertions;
37 | Counts testCases;
38 | };
39 | }
40 |
41 | #endif // CATCH_TOTALS_HPP_INCLUDED
42 |
--------------------------------------------------------------------------------
/catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 |
9 | #include
10 | #include
11 |
12 | namespace {
13 |
14 | struct truthy {
15 | truthy(bool b):m_value(b){}
16 | operator bool() const {
17 | return false;
18 | }
19 | bool m_value;
20 | };
21 |
22 | std::ostream& operator<<(std::ostream& o, truthy) {
23 | o << "Hey, its truthy!";
24 | return o;
25 | }
26 |
27 | } // end anonymous namespace
28 |
29 | #include
30 |
31 | TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") {
32 | CHECK(truthy(false));
33 | }
34 |
35 | TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition][approvals]") {
36 | FILE* fptr = nullptr;
37 | REQUIRE( fptr == 0 );
38 | REQUIRE_FALSE( fptr != 0 );
39 | REQUIRE( fptr == 0l );
40 | REQUIRE_FALSE( fptr != 0l );
41 | }
42 |
--------------------------------------------------------------------------------
/catch2/src/catch2/internal/catch_tag_alias_registry.hpp:
--------------------------------------------------------------------------------
1 |
2 | // Copyright Catch2 Authors
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE.txt or copy at
5 | // https://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // SPDX-License-Identifier: BSL-1.0
8 | #ifndef CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED
9 | #define CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED
10 |
11 | #include
12 | #include
13 |
14 | #include