├── .gitattributes ├── third_party ├── catch2 │ ├── VERSION.txt │ ├── CMake │ │ ├── Catch2Config.cmake.in │ │ └── llvm-cov-wrapper │ ├── src │ │ └── catch2 │ │ │ ├── interfaces │ │ │ ├── catch_interfaces_config.cpp │ │ │ ├── catch_interfaces_capture.cpp │ │ │ ├── catch_interfaces_testcase.cpp │ │ │ ├── catch_interfaces_registry_hub.cpp │ │ │ ├── catch_interfaces_reporter_factory.cpp │ │ │ ├── catch_interfaces_exception.cpp │ │ │ ├── catch_interfaces_test_invoker.hpp │ │ │ ├── catch_interfaces_tag_alias_registry.hpp │ │ │ ├── catch_interfaces_generatortracker.cpp │ │ │ ├── catch_interfaces_testcase.hpp │ │ │ ├── catch_interfaces_exception.hpp │ │ │ ├── catch_interfaces_reporter_factory.hpp │ │ │ ├── catch_interfaces_all.hpp │ │ │ └── catch_interfaces_enum_values_registry.hpp │ │ │ ├── generators │ │ │ ├── catch_generators_random.cpp │ │ │ ├── catch_generator_exception.cpp │ │ │ ├── catch_generator_exception.hpp │ │ │ ├── catch_generators_all.hpp │ │ │ └── catch_generators.cpp │ │ │ ├── internal │ │ │ ├── catch_polyfills.hpp │ │ │ ├── catch_errno_guard.cpp │ │ │ ├── catch_case_sensitive.hpp │ │ │ ├── catch_uncaught_exceptions.hpp │ │ │ ├── catch_debug_console.hpp │ │ │ ├── catch_leak_detector.hpp │ │ │ ├── catch_stdstreams.hpp │ │ │ ├── catch_getenv.hpp │ │ │ ├── catch_commandline.hpp │ │ │ ├── catch_test_run_info.hpp │ │ │ ├── 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_test_case_info_hasher.hpp │ │ │ ├── catch_preprocessor_remove_parens.hpp │ │ │ ├── catch_message_info.cpp │ │ │ ├── catch_decomposer.cpp │ │ │ ├── catch_parse_numbers.hpp │ │ │ ├── catch_windows_h_proxy.hpp │ │ │ ├── catch_unique_name.hpp │ │ │ ├── catch_to_string.hpp │ │ │ ├── catch_uncaught_exceptions.cpp │ │ │ ├── catch_startup_exception_registry.hpp │ │ │ ├── catch_polyfills.cpp │ │ │ ├── catch_noncopyable.hpp │ │ │ ├── catch_stream_end_stop.hpp │ │ │ ├── catch_test_failure_exception.cpp │ │ │ ├── catch_lazy_expr.cpp │ │ │ ├── catch_floating_point_helpers.cpp │ │ │ ├── catch_result_type.cpp │ │ │ ├── catch_exception_translator_registry.hpp │ │ │ ├── catch_getenv.cpp │ │ │ ├── catch_config_android_logwrite.hpp │ │ │ ├── catch_list.hpp │ │ │ ├── catch_startup_exception_registry.cpp │ │ │ ├── catch_case_insensitive_comparisons.hpp │ │ │ ├── catch_config_counter.hpp │ │ │ ├── catch_singletons.cpp │ │ │ ├── catch_random_seed_generation.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_lazy_expr.hpp │ │ │ ├── catch_leak_detector.cpp │ │ │ ├── catch_source_line_info.cpp │ │ │ ├── catch_case_insensitive_comparisons.cpp │ │ │ ├── catch_enforce.cpp │ │ │ ├── catch_config_static_analysis_support.hpp │ │ │ ├── catch_context.cpp │ │ │ ├── catch_platform.hpp │ │ │ ├── catch_message_info.hpp │ │ │ ├── catch_singletons.hpp │ │ │ ├── catch_debug_console.cpp │ │ │ ├── catch_test_case_info_hasher.cpp │ │ │ ├── catch_logical_traits.hpp │ │ │ ├── catch_main.cpp │ │ │ ├── catch_sharding.hpp │ │ │ ├── catch_config_uncaught_exceptions.hpp │ │ │ ├── catch_meta.hpp │ │ │ ├── catch_context.hpp │ │ │ ├── catch_enforce.hpp │ │ │ ├── catch_istream.hpp │ │ │ ├── catch_reporter_registry.hpp │ │ │ ├── catch_reusable_string_stream.hpp │ │ │ ├── catch_result_type.hpp │ │ │ ├── catch_wildcard_pattern.cpp │ │ │ ├── catch_parse_numbers.cpp │ │ │ ├── catch_stringref.cpp │ │ │ └── catch_random_number_generator.cpp │ │ │ ├── catch_version_macros.hpp │ │ │ ├── catch_get_random_seed.cpp │ │ │ ├── catch_get_random_seed.hpp │ │ │ ├── benchmark │ │ │ ├── catch_chronometer.cpp │ │ │ ├── detail │ │ │ │ ├── catch_benchmark_function.cpp │ │ │ │ ├── catch_benchmark_stats_fwd.hpp │ │ │ │ ├── catch_run_for_at_least.cpp │ │ │ │ ├── catch_timing.hpp │ │ │ │ ├── catch_repeat.hpp │ │ │ │ ├── catch_measure.hpp │ │ │ │ └── catch_benchmark_stats.hpp │ │ │ ├── catch_estimate.hpp │ │ │ ├── catch_outlier_classification.hpp │ │ │ ├── catch_clock.hpp │ │ │ ├── catch_environment.hpp │ │ │ └── catch_sample_analysis.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_matchers_templated.cpp │ │ │ ├── catch_matchers_all.hpp │ │ │ ├── catch_matchers_exception.hpp │ │ │ └── catch_matchers_predicate.hpp │ │ │ ├── catch_translate_exception.cpp │ │ │ ├── reporters │ │ │ ├── catch_reporter_streaming_base.cpp │ │ │ ├── catch_reporter_compact.hpp │ │ │ ├── catch_reporter_registrars.cpp │ │ │ ├── catch_reporter_automake.hpp │ │ │ ├── catch_reporter_automake.cpp │ │ │ ├── catch_reporter_tap.hpp │ │ │ ├── catch_reporter_common_base.cpp │ │ │ ├── catch_reporters_all.hpp │ │ │ ├── catch_reporter_junit.hpp │ │ │ ├── catch_reporter_event_listener.cpp │ │ │ └── catch_reporter_teamcity.hpp │ │ │ ├── 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_timer.cpp │ │ │ ├── catch_version.hpp │ │ │ ├── catch_section_info.hpp │ │ │ ├── catch_version.cpp │ │ │ ├── catch_session.hpp │ │ │ ├── catch_assertion_result.hpp │ │ │ └── catch_totals.cpp │ ├── SECURITY.md │ └── LICENSE.txt └── boost_context │ ├── asm │ └── not_modified_yet │ │ ├── jump_i386_x86_64_sysv_macho_gas.S │ │ ├── jump_ppc32_ppc64_sysv_macho_gas.S │ │ ├── make_i386_x86_64_sysv_macho_gas.S │ │ ├── make_ppc32_ppc64_sysv_macho_gas.S │ │ ├── jump_combined_sysv_macho_gas.S │ │ ├── make_combined_sysv_macho_gas.S │ │ └── make_ppc64_sysv_xcoff_gas.S │ ├── include │ └── boost_context │ │ └── fcontext.h │ └── LICENSE_1_0.txt ├── .github └── workflows │ ├── commit.yaml │ ├── ci.yaml │ └── release.yaml ├── .gitignore ├── include └── ftl │ ├── assert.h │ ├── alloc.h │ ├── task.h │ └── ftl_valgrind.h ├── tools └── LICENSE-run-clang-format ├── benchmarks ├── CMakeLists.txt └── empty │ └── empty.cpp ├── examples └── CMakeLists.txt ├── source └── task_scheduler_internal.h ├── LICENSE-THIRD-PARTY └── tests ├── CMakeLists.txt └── fiber_abstraction └── single_fiber_switch.cpp /.gitattributes: -------------------------------------------------------------------------------- 1 | # Shell scripts 2 | *.sh eol=lf 3 | *.py eol=lf 4 | tools/clang-tidy-checks.txt eol=lf 5 | -------------------------------------------------------------------------------- /third_party/catch2/VERSION.txt: -------------------------------------------------------------------------------- 1 | v3.4.0 2 | 3 | https://github.com/catchorg/Catch2/releases/tag/v3.4.0 4 | -------------------------------------------------------------------------------- /.github/workflows/commit.yaml: -------------------------------------------------------------------------------- 1 | name: Commit Testing 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - master 7 | 8 | jobs: 9 | test: 10 | uses: ./.github/workflows/test.yaml 11 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: Continuous Testing 2 | 3 | on: 4 | # Run once a week, so we CI backend updates don't sneak up on us 5 | schedule: 6 | - cron: "0 13 * * SUN" 7 | 8 | jobs: 9 | test: 10 | uses: ./.github/workflows/test.yaml 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build files 2 | build*/ 3 | 4 | # CLion Project files 5 | .idea/ 6 | # CLion build files 7 | cmake-build*/ 8 | 9 | 10 | # Visual Studio local files 11 | .vs/ 12 | Folder.DotSettings.user 13 | 14 | # Lint output files 15 | clang-tidy-output.txt 16 | -------------------------------------------------------------------------------- /third_party/catch2/CMake/Catch2Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | 4 | # Avoid repeatedly including the targets 5 | if(NOT TARGET Catch2::Catch2) 6 | # Provide path for scripts 7 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake) 10 | endif() 11 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | 11 | namespace Catch { 12 | IResultCapture::~IResultCapture() = default; 13 | } 14 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/generators/catch_generators_random.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 | std::uint32_t Catch::Generators::Detail::getSeed() { return sharedRng()(); } 14 | -------------------------------------------------------------------------------- /third_party/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 | bool isnan(float f); 13 | bool isnan(double d); 14 | } 15 | 16 | #endif // CATCH_POLYFILLS_HPP_INCLUDED 17 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/jump_i386_x86_64_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__i386__) 11 | #include "jump_i386_sysv_macho_gas.S" 12 | #elif defined(__x86_64__) 13 | #include "jump_x86_64_sysv_macho_gas.S" 14 | #else 15 | #error "No arch's" 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/jump_ppc32_ppc64_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__ppc__) 11 | #include "jump_ppc32_sysv_macho_gas.S" 12 | #elif defined(__ppc64__) 13 | #include "jump_ppc64_sysv_macho_gas.S" 14 | #else 15 | #error "No arch's" 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/make_i386_x86_64_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__i386__) 11 | #include "make_i386_sysv_macho_gas.S" 12 | #elif defined(__x86_64__) 13 | #include "make_x86_64_sysv_macho_gas.S" 14 | #else 15 | #error "No arch's" 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/make_ppc32_ppc64_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__ppc__) 11 | #include "make_ppc32_sysv_macho_gas.S" 12 | #elif defined(__ppc64__) 13 | #include "make_ppc64_sysv_macho_gas.S" 14 | #else 15 | #error "No arch's" 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/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 4 13 | #define CATCH_VERSION_PATCH 0 14 | 15 | #endif // CATCH_VERSION_MACROS_HPP_INCLUDED 16 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | BenchmarkFunction::callable::~callable() = default; 15 | } // namespace Detail 16 | } // namespace Benchmark 17 | } // namespace Catch 18 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/jump_combined_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__i386__) 11 | #include "jump_i386_sysv_macho_gas.S" 12 | #elif defined(__x86_64__) 13 | #include "jump_x86_64_sysv_macho_gas.S" 14 | #elif defined(__ppc__) 15 | #include "jump_ppc32_sysv_macho_gas.S" 16 | #elif defined(__ppc64__) 17 | #include "jump_ppc64_sysv_macho_gas.S" 18 | #else 19 | #error "No arch's" 20 | #endif 21 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/make_combined_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__i386__) 11 | #include "make_i386_sysv_macho_gas.S" 12 | #elif defined(__x86_64__) 13 | #include "make_x86_64_sysv_macho_gas.S" 14 | #elif defined(__ppc__) 15 | #include "make_ppc32_sysv_macho_gas.S" 16 | #elif defined(__ppc64__) 17 | #include "make_ppc64_sysv_macho_gas.S" 18 | #else 19 | #error "No arch's" 20 | #endif 21 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | release: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Bump version and push tag 14 | id: tag_version 15 | uses: mathieudutour/github-tag-action@v6.1 16 | with: 17 | github_token: ${{ secrets.GITHUB_TOKEN }} 18 | - name: Create a GitHub release 19 | uses: ncipollo/release-action@v1 20 | with: 21 | tag: ${{ steps.tag_version.outputs.new_tag }} 22 | name: Release ${{ steps.tag_version.outputs.new_tag }} 23 | body: ${{ steps.tag_version.outputs.changelog }} 24 | -------------------------------------------------------------------------------- /third_party/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 invoke() const = 0; 16 | virtual ~ITestInvoker(); // = default 17 | }; 18 | 19 | } // namespace Catch 20 | 21 | #endif // CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED 22 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /include/ftl/assert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define FTL_EXPAND(s) s 7 | #define FTL_STR_IMPL(s) #s 8 | #define FTL_STR(s) FTL_EXPAND(FTL_STR_IMPL(s)) 9 | #ifndef NDEBUG 10 | # define FTL_ASSERT(msg, expr) \ 11 | if (!(expr)) { \ 12 | std::fputs("FTL Assertion Failure: " FTL_STR(msg) ". Expr: " FTL_STR(expr) "\n", stderr); \ 13 | std::fputs("Source File: " __FILE__ ":" FTL_STR(__LINE__) "\n", stderr); \ 14 | std::abort(); \ 15 | } 16 | #else 17 | # define FTL_ASSERT(msg, expr) 18 | #endif 19 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/boost_context/include/boost_context/fcontext.h: -------------------------------------------------------------------------------- 1 | // Copyright Oliver Kowalke 2009. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | // Modified for use in FiberTaskingLib 7 | // 8 | // FiberTaskingLib is the legal property of Adrian Astley 9 | // Copyright Adrian Astley 2015 - 2018 10 | 11 | #pragma once 12 | 13 | #include // size_t 14 | 15 | namespace boost_context { 16 | 17 | using fcontext_t = void *; 18 | 19 | extern "C" void jump_fcontext(fcontext_t *from, fcontext_t to, void *arg); 20 | extern "C" fcontext_t make_fcontext(void *sp, size_t size, void (*func)(void *)); 21 | // sp is the pointer to the _top_ of the stack (ie &stack_buffer[size]). 22 | 23 | } // End of namespace boost_context 24 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | // This may need protecting if threading support is added 23 | unsigned int MessageInfo::globalCount = 0; 24 | 25 | } // end namespace Catch 26 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | ITransientExpression::~ITransientExpression() = default; 14 | 15 | void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { 16 | if( lhs.size() + rhs.size() < 40 && 17 | lhs.find('\n') == std::string::npos && 18 | rhs.find('\n') == std::string::npos ) 19 | os << lhs << ' ' << op << ' ' << rhs; 20 | else 21 | os << lhs << '\n' << op << '\n' << rhs; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | #include 13 | 14 | #include 15 | 16 | namespace Catch { 17 | bool uncaught_exceptions() { 18 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 19 | return false; 20 | #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 21 | return std::uncaught_exceptions() > 0; 22 | #else 23 | return std::uncaught_exception(); 24 | #endif 25 | } 26 | } // end namespace Catch 27 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_polyfills.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 | 17 | #if !defined(CATCH_CONFIG_POLYFILL_ISNAN) 18 | bool isnan(float f) { 19 | return std::isnan(f); 20 | } 21 | bool isnan(double d) { 22 | return std::isnan(d); 23 | } 24 | #else 25 | // For now we only use this for embarcadero 26 | bool isnan(float f) { 27 | return std::_isnan(f); 28 | } 29 | bool isnan(double d) { 30 | return std::_isnan(d); 31 | } 32 | #endif 33 | 34 | } // end namespace Catch 35 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | NonCopyable( NonCopyable const& ) = delete; 17 | NonCopyable( NonCopyable&& ) = delete; 18 | NonCopyable& operator=( NonCopyable const& ) = delete; 19 | NonCopyable& operator=( NonCopyable&& ) = delete; 20 | 21 | protected: 22 | NonCopyable() noexcept = default; 23 | }; 24 | 25 | } // namespace Detail 26 | } // namespace Catch 27 | 28 | #endif // CATCH_NONCOPYABLE_HPP_INCLUDED 29 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | Duration point; 18 | Duration lower_bound; 19 | Duration upper_bound; 20 | double confidence_interval; 21 | 22 | template 23 | operator Estimate() const { 24 | return { point, lower_bound, upper_bound, confidence_interval }; 25 | } 26 | }; 27 | } // namespace Benchmark 28 | } // namespace Catch 29 | 30 | #endif // CATCH_ESTIMATE_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /third_party/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 override final; 27 | }; 28 | 29 | } // end namespace Catch 30 | 31 | #endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_floating_point_helpers.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 | namespace Detail { 15 | 16 | uint32_t convertToBits(float f) { 17 | static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated"); 18 | uint32_t i; 19 | std::memcpy(&i, &f, sizeof(f)); 20 | return i; 21 | } 22 | 23 | uint64_t convertToBits(double d) { 24 | static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated"); 25 | uint64_t i; 26 | std::memcpy(&i, &d, sizeof(d)); 27 | return i; 28 | } 29 | 30 | } // end namespace Detail 31 | } // end namespace Catch 32 | 33 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_result_type.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 | bool isOk( ResultWas::OfType resultType ) { 13 | return ( resultType & ResultWas::FailureBit ) == 0; 14 | } 15 | bool isJustInfo( int flags ) { 16 | return flags == ResultWas::Info; 17 | } 18 | 19 | ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { 20 | return static_cast( static_cast( lhs ) | static_cast( rhs ) ); 21 | } 22 | 23 | bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } 24 | bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } 25 | 26 | } // end namespace Catch 27 | -------------------------------------------------------------------------------- /third_party/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 | #include 16 | 17 | namespace Catch { 18 | 19 | class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { 20 | public: 21 | ~ExceptionTranslatorRegistry() override; 22 | void registerTranslator( Detail::unique_ptr&& translator ); 23 | std::string translateActiveException() const override; 24 | 25 | private: 26 | ExceptionTranslators m_translators; 27 | }; 28 | } 29 | 30 | #endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | #include 17 | 18 | namespace Catch { 19 | namespace Benchmark { 20 | template 21 | struct Timing { 22 | Duration elapsed; 23 | Result result; 24 | int iterations; 25 | }; 26 | template 27 | using TimingOf = Timing, Detail::CompleteType_t>>; 28 | } // namespace Benchmark 29 | } // namespace Catch 30 | 31 | #endif // CATCH_TIMING_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /tools/LICENSE-run-clang-format: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Guillaume Papin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /third_party/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 | 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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | std::uint32_t generateRandomSeed( GenerateFrom from ) { 19 | switch ( from ) { 20 | case GenerateFrom::Time: 21 | return static_cast( std::time( nullptr ) ); 22 | 23 | case GenerateFrom::Default: 24 | case GenerateFrom::RandomDevice: 25 | // In theory, a platform could have random_device that returns just 26 | // 16 bits. That is still some randomness, so we don't care too much 27 | return static_cast( std::random_device{}() ); 28 | 29 | default: 30 | CATCH_ERROR("Unknown generation method"); 31 | } 32 | } 33 | 34 | } // end namespace Catch 35 | -------------------------------------------------------------------------------- /third_party/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 | -------------------------------------------------------------------------------- /third_party/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 15 | #include 16 | 17 | namespace Catch { 18 | struct SourceLineInfo; 19 | 20 | class TagAliasRegistry : public ITagAliasRegistry { 21 | public: 22 | ~TagAliasRegistry() override; 23 | TagAlias const* find( std::string const& alias ) const override; 24 | std::string expandAliases( std::string const& unexpandedTestSpec ) const override; 25 | void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); 26 | 27 | private: 28 | std::map m_registry; 29 | }; 30 | 31 | } // end namespace Catch 32 | 33 | #endif // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_config_wchar.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 WCHAR configuration option 11 | * 12 | * We want to support platforms that do not provide `wchar_t`, so we 13 | * sometimes have to disable providing wchar_t overloads through Catch2, 14 | * e.g. the StringMaker specialization for `std::wstring`. 15 | */ 16 | 17 | #ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED 18 | #define CATCH_CONFIG_WCHAR_HPP_INCLUDED 19 | 20 | #include 21 | 22 | // We assume that WCHAR should be enabled by default, and only disabled 23 | // for a shortlist (so far only DJGPP) of compilers. 24 | 25 | #if defined(__DJGPP__) 26 | # define CATCH_INTERNAL_CONFIG_NO_WCHAR 27 | #endif // __DJGPP__ 28 | 29 | #if !defined( CATCH_INTERNAL_CONFIG_NO_WCHAR ) && \ 30 | !defined( CATCH_CONFIG_NO_WCHAR ) && \ 31 | !defined( CATCH_CONFIG_WCHAR ) 32 | # define CATCH_CONFIG_WCHAR 33 | #endif 34 | 35 | #endif // CATCH_CONFIG_WCHAR_HPP_INCLUDED 36 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/benchmark/detail/catch_repeat.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_REPEAT_HPP_INCLUDED 11 | #define CATCH_REPEAT_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | namespace Benchmark { 18 | namespace Detail { 19 | template 20 | struct repeater { 21 | void operator()(int k) const { 22 | for (int i = 0; i < k; ++i) { 23 | fun(); 24 | } 25 | } 26 | Fun fun; 27 | }; 28 | template 29 | repeater> repeat(Fun&& fun) { 30 | return { CATCH_FORWARD(fun) }; 31 | } 32 | } // namespace Detail 33 | } // namespace Benchmark 34 | } // namespace Catch 35 | 36 | #endif // CATCH_REPEAT_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_tag_alias_autoregistrar.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_AUTOREGISTRAR_HPP_INCLUDED 9 | #define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | 17 | struct RegistrarForTagAliases { 18 | RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); 19 | }; 20 | 21 | } // end namespace Catch 22 | 23 | #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ 24 | CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ 25 | CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ 26 | namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ 27 | CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION 28 | 29 | #endif // CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_test_failure_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_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | //! Used to signal that an assertion macro failed 14 | struct TestFailureException{}; 15 | //! Used to signal that the remainder of a test should be skipped 16 | struct TestSkipException {}; 17 | 18 | /** 19 | * Outlines throwing of `TestFailureException` into a single TU 20 | * 21 | * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers. 22 | */ 23 | [[noreturn]] void throw_test_failure_exception(); 24 | 25 | /** 26 | * Outlines throwing of `TestSkipException` into a single TU 27 | * 28 | * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers. 29 | */ 30 | [[noreturn]] void throw_test_skip_exception(); 31 | 32 | } // namespace Catch 33 | 34 | #endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 35 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_source_line_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_SOURCE_LINE_INFO_HPP_INCLUDED 9 | #define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | 16 | struct SourceLineInfo { 17 | 18 | SourceLineInfo() = delete; 19 | constexpr SourceLineInfo( char const* _file, std::size_t _line ) noexcept: 20 | file( _file ), 21 | line( _line ) 22 | {} 23 | 24 | bool operator == ( SourceLineInfo const& other ) const noexcept; 25 | bool operator < ( SourceLineInfo const& other ) const noexcept; 26 | 27 | char const* file; 28 | std::size_t line; 29 | 30 | friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info); 31 | }; 32 | } 33 | 34 | #define CATCH_INTERNAL_LINEINFO \ 35 | ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) 36 | 37 | #endif // CATCH_SOURCE_LINE_INFO_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_wildcard_pattern.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_WILDCARD_PATTERN_HPP_INCLUDED 9 | #define CATCH_WILDCARD_PATTERN_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch 16 | { 17 | class WildcardPattern { 18 | enum WildcardPosition { 19 | NoWildcard = 0, 20 | WildcardAtStart = 1, 21 | WildcardAtEnd = 2, 22 | WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd 23 | }; 24 | 25 | public: 26 | 27 | WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity ); 28 | bool matches( std::string const& str ) const; 29 | 30 | private: 31 | std::string normaliseString( std::string const& str ) const; 32 | CaseSensitive m_caseSensitivity; 33 | WildcardPosition m_wildcard = NoWildcard; 34 | std::string m_pattern; 35 | }; 36 | } 37 | 38 | #endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED 39 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_compact.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_REPORTER_COMPACT_HPP_INCLUDED 9 | #define CATCH_REPORTER_COMPACT_HPP_INCLUDED 10 | 11 | 12 | #include 13 | 14 | 15 | namespace Catch { 16 | 17 | class CompactReporter final : public StreamingReporterBase { 18 | public: 19 | using StreamingReporterBase::StreamingReporterBase; 20 | 21 | ~CompactReporter() override; 22 | 23 | static std::string getDescription(); 24 | 25 | void noMatchingTestCases( StringRef unmatchedSpec ) override; 26 | 27 | void testRunStarting( TestRunInfo const& _testInfo ) override; 28 | 29 | void assertionEnded(AssertionStats const& _assertionStats) override; 30 | 31 | void sectionEnded(SectionStats const& _sectionStats) override; 32 | 33 | void testRunEnded(TestRunStats const& _testRunStats) override; 34 | 35 | }; 36 | 37 | } // end namespace Catch 38 | 39 | #endif // CATCH_REPORTER_COMPACT_HPP_INCLUDED 40 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/benchmark/detail/catch_measure.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_MEASURE_HPP_INCLUDED 11 | #define CATCH_MEASURE_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | namespace Benchmark { 19 | namespace Detail { 20 | template 21 | TimingOf measure(Fun&& fun, Args&&... args) { 22 | auto start = Clock::now(); 23 | auto&& r = Detail::complete_invoke(fun, CATCH_FORWARD(args)...); 24 | auto end = Clock::now(); 25 | auto delta = end - start; 26 | return { delta, CATCH_FORWARD(r), 1 }; 27 | } 28 | } // namespace Detail 29 | } // namespace Benchmark 30 | } // namespace Catch 31 | 32 | #endif // CATCH_MEASURE_HPP_INCLUDED 33 | -------------------------------------------------------------------------------- /third_party/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 | #include 15 | 16 | namespace Catch { 17 | namespace Benchmark { 18 | template 19 | using ClockDuration = typename Clock::duration; 20 | template 21 | using FloatDuration = std::chrono::duration; 22 | 23 | template 24 | using TimePoint = typename Clock::time_point; 25 | 26 | using default_clock = std::chrono::steady_clock; 27 | 28 | template 29 | struct now { 30 | TimePoint operator()() const { 31 | return Clock::now(); 32 | } 33 | }; 34 | 35 | using fp_seconds = std::chrono::duration>; 36 | } // namespace Benchmark 37 | } // namespace Catch 38 | 39 | #endif // CATCH_CLOCK_HPP_INCLUDED 40 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/interfaces/catch_interfaces_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_INTERFACES_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | using exceptionTranslateFunction = std::string(*)(); 18 | 19 | class IExceptionTranslator; 20 | using ExceptionTranslators = std::vector>; 21 | 22 | class IExceptionTranslator { 23 | public: 24 | virtual ~IExceptionTranslator(); // = default 25 | virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; 26 | }; 27 | 28 | class IExceptionTranslatorRegistry { 29 | public: 30 | virtual ~IExceptionTranslatorRegistry(); // = default 31 | virtual std::string translateActiveException() const = 0; 32 | }; 33 | 34 | } // namespace Catch 35 | 36 | #endif // CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_enum_values_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_ENUM_VALUES_REGISTRY_HPP_INCLUDED 9 | #define CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace Catch { 18 | 19 | namespace Detail { 20 | 21 | Catch::Detail::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); 22 | 23 | class EnumValuesRegistry : public IMutableEnumValuesRegistry { 24 | 25 | std::vector> m_enumInfos; 26 | 27 | EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values) override; 28 | }; 29 | 30 | std::vector parseEnums( StringRef enums ); 31 | 32 | } // Detail 33 | 34 | } // Catch 35 | 36 | #endif // CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/generators/catch_generators_all.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 | /** \file 9 | * This is a convenience header for Catch2's Generator support. It includes 10 | * **all** of Catch2 headers related to generators. 11 | * 12 | * Generally the Catch2 users should use specific includes they need, 13 | * but this header can be used instead for ease-of-experimentation, or 14 | * just plain convenience, at the cost of (significantly) increased 15 | * compilation times. 16 | * 17 | * When a new header is added to either the `generators` folder, 18 | * or to the corresponding internal subfolder, it should be added here. 19 | */ 20 | 21 | #ifndef CATCH_GENERATORS_ALL_HPP_INCLUDED 22 | #define CATCH_GENERATORS_ALL_HPP_INCLUDED 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif // CATCH_GENERATORS_ALL_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /third_party/catch2/CMake/llvm-cov-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of CMake-codecov. 4 | # 5 | # Copyright (c) 6 | # 2015-2017 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # See the LICENSE file in the package base directory for details 9 | # 10 | # Written by Alexander Haase, alexander.haase@rwth-aachen.de 11 | # 12 | 13 | if [ -z "$LLVM_COV_BIN" ] 14 | then 15 | echo "LLVM_COV_BIN not set!" >& 2 16 | exit 1 17 | fi 18 | 19 | 20 | # Get LLVM version to find out. 21 | LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ 22 | | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") 23 | 24 | if [ "$1" = "-v" ] 25 | then 26 | echo "llvm-cov-wrapper $LLVM_VERSION" 27 | exit 0 28 | fi 29 | 30 | 31 | if [ -n "$LLVM_VERSION" ] 32 | then 33 | MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1) 34 | MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2) 35 | 36 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ] 37 | then 38 | if [ -f "$1" ] 39 | then 40 | filename=$(basename "$1") 41 | extension="${filename##*.}" 42 | 43 | case "$extension" in 44 | "gcno") exec $LLVM_COV_BIN --gcno="$1" ;; 45 | "gcda") exec $LLVM_COV_BIN --gcda="$1" ;; 46 | esac 47 | fi 48 | fi 49 | 50 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ] 51 | then 52 | exec $LLVM_COV_BIN $@ 53 | fi 54 | fi 55 | 56 | exec $LLVM_COV_BIN gcov $@ 57 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_lazy_expr.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_LAZY_EXPR_HPP_INCLUDED 9 | #define CATCH_LAZY_EXPR_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | class ITransientExpression; 16 | 17 | class LazyExpression { 18 | friend class AssertionHandler; 19 | friend struct AssertionStats; 20 | friend class RunContext; 21 | 22 | ITransientExpression const* m_transientExpression = nullptr; 23 | bool m_isNegated; 24 | public: 25 | LazyExpression( bool isNegated ): 26 | m_isNegated(isNegated) 27 | {} 28 | LazyExpression(LazyExpression const& other) = default; 29 | LazyExpression& operator = ( LazyExpression const& ) = delete; 30 | 31 | explicit operator bool() const { 32 | return m_transientExpression != nullptr; 33 | } 34 | 35 | friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; 36 | }; 37 | 38 | } // namespace Catch 39 | 40 | #endif // CATCH_LAZY_EXPR_HPP_INCLUDED 41 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_leak_detector.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 | #ifdef CATCH_CONFIG_WINDOWS_CRTDBG 14 | #include 15 | 16 | namespace Catch { 17 | 18 | LeakDetector::LeakDetector() { 19 | int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); 20 | flag |= _CRTDBG_LEAK_CHECK_DF; 21 | flag |= _CRTDBG_ALLOC_MEM_DF; 22 | _CrtSetDbgFlag(flag); 23 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 24 | _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 25 | // Change this to leaking allocation's number to break there 26 | _CrtSetBreakAlloc(-1); 27 | } 28 | } 29 | 30 | #else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv 31 | 32 | Catch::LeakDetector::LeakDetector() {} 33 | 34 | #endif // CATCH_CONFIG_WINDOWS_CRTDBG 35 | 36 | Catch::LeakDetector::~LeakDetector() { 37 | Catch::cleanUp(); 38 | } 39 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_source_line_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 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Catch { 14 | 15 | bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { 16 | return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); 17 | } 18 | bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { 19 | // We can assume that the same file will usually have the same pointer. 20 | // Thus, if the pointers are the same, there is no point in calling the strcmp 21 | return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); 22 | } 23 | 24 | std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { 25 | #ifndef __GNUG__ 26 | os << info.file << '(' << info.line << ')'; 27 | #else 28 | os << info.file << ':' << info.line; 29 | #endif 30 | return os; 31 | } 32 | 33 | } // end namespace Catch 34 | -------------------------------------------------------------------------------- /third_party/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 | template 19 | struct EnvironmentEstimate { 20 | Duration mean; 21 | OutlierClassification outliers; 22 | 23 | template 24 | operator EnvironmentEstimate() const { 25 | return { mean, outliers }; 26 | } 27 | }; 28 | template 29 | struct Environment { 30 | using clock_type = Clock; 31 | EnvironmentEstimate> clock_resolution; 32 | EnvironmentEstimate> clock_cost; 33 | }; 34 | } // namespace Benchmark 35 | } // namespace Catch 36 | 37 | #endif // CATCH_ENVIRONMENT_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_case_insensitive_comparisons.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 Detail { 16 | 17 | bool CaseInsensitiveLess::operator()( StringRef lhs, 18 | StringRef rhs ) const { 19 | return std::lexicographical_compare( 20 | lhs.begin(), lhs.end(), 21 | rhs.begin(), rhs.end(), 22 | []( char l, char r ) { return toLower( l ) < toLower( r ); } ); 23 | } 24 | 25 | bool 26 | CaseInsensitiveEqualTo::operator()( StringRef lhs, 27 | StringRef rhs ) const { 28 | return std::equal( 29 | lhs.begin(), lhs.end(), 30 | rhs.begin(), rhs.end(), 31 | []( char l, char r ) { return toLower( l ) == toLower( r ); } ); 32 | } 33 | 34 | } // namespace Detail 35 | } // namespace Catch 36 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_enforce.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 | #include 12 | 13 | 14 | namespace Catch { 15 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) 16 | [[noreturn]] 17 | void throw_exception(std::exception const& e) { 18 | Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" 19 | << "The message was: " << e.what() << '\n'; 20 | std::terminate(); 21 | } 22 | #endif 23 | 24 | [[noreturn]] 25 | void throw_logic_error(std::string const& msg) { 26 | throw_exception(std::logic_error(msg)); 27 | } 28 | 29 | [[noreturn]] 30 | void throw_domain_error(std::string const& msg) { 31 | throw_exception(std::domain_error(msg)); 32 | } 33 | 34 | [[noreturn]] 35 | void throw_runtime_error(std::string const& msg) { 36 | throw_exception(std::runtime_error(msg)); 37 | } 38 | 39 | 40 | 41 | } // namespace Catch; 42 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_timer.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 getCurrentNanosecondsSinceEpoch() -> uint64_t { 16 | return std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); 17 | } 18 | } // end unnamed namespace 19 | 20 | void Timer::start() { 21 | m_nanoseconds = getCurrentNanosecondsSinceEpoch(); 22 | } 23 | auto Timer::getElapsedNanoseconds() const -> uint64_t { 24 | return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; 25 | } 26 | auto Timer::getElapsedMicroseconds() const -> uint64_t { 27 | return getElapsedNanoseconds()/1000; 28 | } 29 | auto Timer::getElapsedMilliseconds() const -> unsigned int { 30 | return static_cast(getElapsedMicroseconds()/1000); 31 | } 32 | auto Timer::getElapsedSeconds() const -> double { 33 | return getElapsedMicroseconds()/1000000.0; 34 | } 35 | 36 | 37 | } // namespace Catch 38 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_version.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_HPP_INCLUDED 9 | #define CATCH_VERSION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | // Versioning information 16 | struct Version { 17 | Version( Version const& ) = delete; 18 | Version& operator=( Version const& ) = delete; 19 | Version( unsigned int _majorVersion, 20 | unsigned int _minorVersion, 21 | unsigned int _patchNumber, 22 | char const * const _branchName, 23 | unsigned int _buildNumber ); 24 | 25 | unsigned int const majorVersion; 26 | unsigned int const minorVersion; 27 | unsigned int const patchNumber; 28 | 29 | // buildNumber is only used if branchName is not null 30 | char const * const branchName; 31 | unsigned int const buildNumber; 32 | 33 | friend std::ostream& operator << ( std::ostream& os, Version const& version ); 34 | }; 35 | 36 | Version const& libraryVersion(); 37 | } 38 | 39 | #endif // CATCH_VERSION_HPP_INCLUDED 40 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_config_static_analysis_support.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 STATIC_ANALYSIS_SUPPORT configuration option 11 | * 12 | * Some of Catch2's macros can be defined differently to work better with 13 | * static analysis tools, like clang-tidy or coverity. 14 | * Currently the main use case is to show that `SECTION`s are executed 15 | * exclusively, and not all in one run of a `TEST_CASE`. 16 | */ 17 | 18 | #ifndef CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED 19 | #define CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED 20 | 21 | #include 22 | 23 | #if defined(__clang_analyzer__) || defined(__COVERITY__) 24 | #define CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT 25 | #endif 26 | 27 | #if defined( CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT ) && \ 28 | !defined( CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) && \ 29 | !defined( CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) 30 | # define CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT 31 | #endif 32 | 33 | 34 | #endif // CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED 35 | -------------------------------------------------------------------------------- /third_party/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 | #include 11 | 12 | namespace Catch { 13 | 14 | Context* Context::currentContext = nullptr; 15 | 16 | void cleanUpContext() { 17 | delete Context::currentContext; 18 | Context::currentContext = nullptr; 19 | } 20 | void Context::createContext() { 21 | currentContext = new Context(); 22 | } 23 | 24 | Context& getCurrentMutableContext() { 25 | if ( !Context::currentContext ) { Context::createContext(); } 26 | // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) 27 | return *Context::currentContext; 28 | } 29 | 30 | void Context::setResultCapture( IResultCapture* resultCapture ) { 31 | m_resultCapture = resultCapture; 32 | } 33 | 34 | void Context::setConfig( IConfig const* config ) { m_config = config; } 35 | 36 | SimplePcg32& sharedRng() { 37 | static SimplePcg32 s_rng; 38 | return s_rng; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_platform.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_PLATFORM_HPP_INCLUDED 9 | #define CATCH_PLATFORM_HPP_INCLUDED 10 | 11 | // See e.g.: 12 | // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html 13 | #ifdef __APPLE__ 14 | # include 15 | # if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ 16 | (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) 17 | # define CATCH_PLATFORM_MAC 18 | # elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) 19 | # define CATCH_PLATFORM_IPHONE 20 | # endif 21 | 22 | #elif defined(linux) || defined(__linux) || defined(__linux__) 23 | # define CATCH_PLATFORM_LINUX 24 | 25 | #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) 26 | # define CATCH_PLATFORM_WINDOWS 27 | 28 | # if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP ) 29 | # define CATCH_PLATFORM_WINDOWS_UWP 30 | # endif 31 | 32 | #elif defined(__ORBIS__) || defined(__PROSPERO__) 33 | # define CATCH_PLATFORM_PLAYSTATION 34 | 35 | #endif 36 | 37 | #endif // CATCH_PLATFORM_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_message_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_MESSAGE_INFO_HPP_INCLUDED 9 | #define CATCH_MESSAGE_INFO_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace Catch { 18 | 19 | struct MessageInfo { 20 | MessageInfo( StringRef _macroName, 21 | SourceLineInfo const& _lineInfo, 22 | ResultWas::OfType _type ); 23 | 24 | StringRef macroName; 25 | std::string message; 26 | SourceLineInfo lineInfo; 27 | ResultWas::OfType type; 28 | unsigned int sequence; 29 | 30 | bool operator == (MessageInfo const& other) const { 31 | return sequence == other.sequence; 32 | } 33 | bool operator < (MessageInfo const& other) const { 34 | return sequence < other.sequence; 35 | } 36 | private: 37 | static unsigned int globalCount; 38 | }; 39 | 40 | } // end namespace Catch 41 | 42 | #endif // CATCH_MESSAGE_INFO_HPP_INCLUDED 43 | -------------------------------------------------------------------------------- /include/ftl/alloc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace ftl { 30 | 31 | void MemoryGuard(void *memory, size_t bytes); 32 | void MemoryGuardRelease(void *memory, size_t bytes); 33 | size_t SystemPageSize(); 34 | void *AlignedAlloc(size_t size, size_t alignment); 35 | void AlignedFree(void *block); 36 | 37 | } // End of namespace ftl 38 | -------------------------------------------------------------------------------- /include/ftl/task.h: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | namespace ftl { 28 | 29 | class TaskScheduler; 30 | 31 | using TaskFunction = void (*)(TaskScheduler *taskScheduler, void *arg); 32 | 33 | struct Task { 34 | TaskFunction Function; 35 | void *ArgData; 36 | }; 37 | 38 | enum class TaskPriority { 39 | High, 40 | Normal, 41 | }; 42 | 43 | } // End of namespace ftl 44 | -------------------------------------------------------------------------------- /third_party/catch2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /third_party/boost_context/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_section_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_SECTION_INFO_HPP_INCLUDED 9 | #define CATCH_SECTION_INFO_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace Catch { 19 | 20 | struct SectionInfo { 21 | // The last argument is ignored, so that people can write 22 | // SECTION("ShortName", "Proper description that is long") and 23 | // still use the `-c` flag comfortably. 24 | SectionInfo( SourceLineInfo const& _lineInfo, std::string _name, 25 | const char* const = nullptr ): 26 | name(CATCH_MOVE(_name)), 27 | lineInfo(_lineInfo) 28 | {} 29 | 30 | std::string name; 31 | SourceLineInfo lineInfo; 32 | }; 33 | 34 | struct SectionEndInfo { 35 | SectionInfo sectionInfo; 36 | Counts prevAssertions; 37 | double durationInSeconds; 38 | }; 39 | 40 | } // end namespace Catch 41 | 42 | #endif // CATCH_SECTION_INFO_HPP_INCLUDED 43 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_registrars.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 | namespace Detail { 16 | 17 | void registerReporterImpl( std::string const& name, 18 | IReporterFactoryPtr reporterPtr ) { 19 | CATCH_TRY { 20 | getMutableRegistryHub().registerReporter( 21 | name, CATCH_MOVE( reporterPtr ) ); 22 | } 23 | CATCH_CATCH_ALL { 24 | // Do not throw when constructing global objects, instead 25 | // register the exception to be processed later 26 | getMutableRegistryHub().registerStartupException(); 27 | } 28 | } 29 | 30 | void registerListenerImpl( Detail::unique_ptr listenerFactory ) { 31 | getMutableRegistryHub().registerListener( CATCH_MOVE(listenerFactory) ); 32 | } 33 | 34 | 35 | } // namespace Detail 36 | } // namespace Catch 37 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_singletons.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_SINGLETONS_HPP_INCLUDED 9 | #define CATCH_SINGLETONS_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | struct ISingleton { 14 | virtual ~ISingleton(); // = default 15 | }; 16 | 17 | 18 | void addSingleton( ISingleton* singleton ); 19 | void cleanupSingletons(); 20 | 21 | 22 | template 23 | class Singleton : SingletonImplT, public ISingleton { 24 | 25 | static auto getInternal() -> Singleton* { 26 | static Singleton* s_instance = nullptr; 27 | if( !s_instance ) { 28 | s_instance = new Singleton; 29 | addSingleton( s_instance ); 30 | } 31 | return s_instance; 32 | } 33 | 34 | public: 35 | static auto get() -> InterfaceT const& { 36 | return *getInternal(); 37 | } 38 | static auto getMutable() -> MutableInterfaceT& { 39 | return *getInternal(); 40 | } 41 | }; 42 | 43 | } // namespace Catch 44 | 45 | #endif // CATCH_SINGLETONS_HPP_INCLUDED 46 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_debug_console.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 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #if defined(CATCH_CONFIG_ANDROID_LOGWRITE) 20 | #include 21 | 22 | namespace Catch { 23 | void writeToDebugConsole( std::string const& text ) { 24 | __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() ); 25 | } 26 | } 27 | 28 | #elif defined(CATCH_PLATFORM_WINDOWS) 29 | 30 | namespace Catch { 31 | void writeToDebugConsole( std::string const& text ) { 32 | ::OutputDebugStringA( text.c_str() ); 33 | } 34 | } 35 | 36 | #else 37 | 38 | namespace Catch { 39 | void writeToDebugConsole( std::string const& text ) { 40 | // !TBD: Need a version for Mac/ XCode and other IDEs 41 | Catch::cout() << text; 42 | } 43 | } 44 | 45 | #endif // Platform 46 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_automake.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_REPORTER_AUTOMAKE_HPP_INCLUDED 9 | #define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | namespace Catch { 17 | 18 | class AutomakeReporter final : public StreamingReporterBase { 19 | public: 20 | // GCC5 compat: we cannot use inherited constructor, because it 21 | // doesn't implement backport of P0136 22 | AutomakeReporter(ReporterConfig&& _config): 23 | StreamingReporterBase(CATCH_MOVE(_config)) 24 | {} 25 | ~AutomakeReporter() override; 26 | 27 | static std::string getDescription() { 28 | using namespace std::string_literals; 29 | return "Reports test results in the format of Automake .trs files"s; 30 | } 31 | 32 | void testCaseEnded(TestCaseStats const& _testCaseStats) override; 33 | void skipTest(TestCaseInfo const& testInfo) override; 34 | }; 35 | 36 | } // end namespace Catch 37 | 38 | #endif // CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED 39 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_automake.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 | #include 12 | 13 | namespace Catch { 14 | 15 | AutomakeReporter::~AutomakeReporter() {} 16 | 17 | void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { 18 | // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. 19 | m_stream << ":test-result: "; 20 | if ( _testCaseStats.totals.testCases.skipped > 0 ) { 21 | m_stream << "SKIP"; 22 | } else if (_testCaseStats.totals.assertions.allPassed()) { 23 | m_stream << "PASS"; 24 | } else if (_testCaseStats.totals.assertions.allOk()) { 25 | m_stream << "XFAIL"; 26 | } else { 27 | m_stream << "FAIL"; 28 | } 29 | m_stream << ' ' << _testCaseStats.testInfo->name << '\n'; 30 | StreamingReporterBase::testCaseEnded(_testCaseStats); 31 | } 32 | 33 | void AutomakeReporter::skipTest(TestCaseInfo const& testInfo) { 34 | m_stream << ":test-result: SKIP " << testInfo.name << '\n'; 35 | } 36 | 37 | } // end namespace Catch 38 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_version.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 | Version::Version 14 | ( unsigned int _majorVersion, 15 | unsigned int _minorVersion, 16 | unsigned int _patchNumber, 17 | char const * const _branchName, 18 | unsigned int _buildNumber ) 19 | : majorVersion( _majorVersion ), 20 | minorVersion( _minorVersion ), 21 | patchNumber( _patchNumber ), 22 | branchName( _branchName ), 23 | buildNumber( _buildNumber ) 24 | {} 25 | 26 | std::ostream& operator << ( std::ostream& os, Version const& version ) { 27 | os << version.majorVersion << '.' 28 | << version.minorVersion << '.' 29 | << version.patchNumber; 30 | // branchName is never null -> 0th char is \0 if it is empty 31 | if (version.branchName[0]) { 32 | os << '-' << version.branchName 33 | << '.' << version.buildNumber; 34 | } 35 | return os; 36 | } 37 | 38 | Version const& libraryVersion() { 39 | static Version version( 3, 4, 0, "", 0 ); 40 | return version; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_test_case_info_hasher.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 | TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {} 14 | 15 | uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const { 16 | // FNV-1a hash algorithm that is designed for uniqueness: 17 | const hash_t prime = 1099511628211u; 18 | hash_t hash = 14695981039346656037u; 19 | for ( const char c : t.name ) { 20 | hash ^= c; 21 | hash *= prime; 22 | } 23 | for ( const char c : t.className ) { 24 | hash ^= c; 25 | hash *= prime; 26 | } 27 | for ( const Tag& tag : t.tags ) { 28 | for ( const char c : tag.original ) { 29 | hash ^= c; 30 | hash *= prime; 31 | } 32 | } 33 | hash ^= m_seed; 34 | hash *= prime; 35 | const uint32_t low{ static_cast( hash ) }; 36 | const uint32_t high{ static_cast( hash >> 32 ) }; 37 | return low * high; 38 | } 39 | } // namespace Catch 40 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_logical_traits.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_LOGICAL_TRAITS_HPP_INCLUDED 9 | #define CATCH_LOGICAL_TRAITS_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Detail { 15 | 16 | #if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 17 | 18 | using std::conjunction; 19 | using std::disjunction; 20 | using std::negation; 21 | 22 | #else 23 | 24 | template struct conjunction : std::true_type {}; 25 | template struct conjunction : B1 {}; 26 | template 27 | struct conjunction 28 | : std::conditional_t, B1> {}; 29 | 30 | template struct disjunction : std::false_type {}; 31 | template struct disjunction : B1 {}; 32 | template 33 | struct disjunction 34 | : std::conditional_t> {}; 35 | 36 | template 37 | struct negation : std::integral_constant {}; 38 | 39 | #endif 40 | 41 | } // namespace Detail 42 | } // namespace Catch 43 | 44 | #endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED 45 | -------------------------------------------------------------------------------- /benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### 2 | # FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | # 4 | # This library was created as a proof of concept of the ideas presented by 5 | # Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | # 7 | # http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | # 9 | # FiberTaskingLib is the legal property of Adrian Astley 10 | # Copyright Adrian Astley 2015 - 2018 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | ## 24 | 25 | 26 | set(FTL_BENCHMARK_SRC 27 | empty/empty.cpp 28 | producer_consumer/producer_consumer.cpp 29 | ) 30 | 31 | # Set the c++ std 32 | if (FTL_CPP_17) 33 | target_compile_features(ftl PUBLIC cxx_std_17) 34 | add_definitions(-DFTL_CPP_17=1) 35 | else() 36 | target_compile_features(ftl PUBLIC cxx_std_11) 37 | endif() 38 | 39 | add_executable(ftl-benchmark ${FTL_BENCHMARK_SRC}) 40 | target_link_libraries(ftl-benchmark ftl Catch2::Catch2WithMain) 41 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### 2 | # FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | # 4 | # This library was created as a proof of concept of the ideas presented by 5 | # Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | # 7 | # http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | # 9 | # FiberTaskingLib is the legal property of Adrian Astley 10 | # Copyright Adrian Astley 2015 - 2018 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | ## 24 | 25 | include(AddCompilerFlags) 26 | 27 | # Set the c++ std 28 | if (FTL_CPP_17) 29 | target_compile_features(ftl PUBLIC cxx_std_17) 30 | add_definitions(-DFTL_CPP_17=1) 31 | else() 32 | target_compile_features(ftl PUBLIC cxx_std_11) 33 | endif() 34 | 35 | # Create an executable for each example 36 | add_executable(ftl-example-triangle-num triangle_num.cpp) 37 | target_link_libraries(ftl-example-triangle-num ftl) 38 | AddCompilerFlags(ftl-example-triangle-num) 39 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_tap.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_REPORTER_TAP_HPP_INCLUDED 9 | #define CATCH_REPORTER_TAP_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | 16 | class TAPReporter final : public StreamingReporterBase { 17 | public: 18 | TAPReporter( ReporterConfig&& config ): 19 | StreamingReporterBase( CATCH_MOVE(config) ) { 20 | m_preferences.shouldReportAllAssertions = true; 21 | } 22 | ~TAPReporter() override = default; 23 | 24 | static std::string getDescription() { 25 | using namespace std::string_literals; 26 | return "Reports test results in TAP format, suitable for test harnesses"s; 27 | } 28 | 29 | void testRunStarting( TestRunInfo const& testInfo ) override; 30 | 31 | void noMatchingTestCases( StringRef unmatchedSpec ) override; 32 | 33 | void assertionEnded(AssertionStats const& _assertionStats) override; 34 | 35 | void testRunEnded(TestRunStats const& _testRunStats) override; 36 | 37 | private: 38 | std::size_t counter = 0; 39 | }; 40 | 41 | } // end namespace Catch 42 | 43 | #endif // CATCH_REPORTER_TAP_HPP_INCLUDED 44 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/generators/catch_generators.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 | IGeneratorTracker::~IGeneratorTracker() = default; 17 | 18 | namespace Generators { 19 | 20 | namespace Detail { 21 | 22 | [[noreturn]] 23 | void throw_generator_exception(char const* msg) { 24 | Catch::throw_exception(GeneratorException{ msg }); 25 | } 26 | } // end namespace Detail 27 | 28 | GeneratorUntypedBase::~GeneratorUntypedBase() = default; 29 | 30 | IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) { 31 | return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); 32 | } 33 | 34 | IGeneratorTracker* createGeneratorTracker( StringRef generatorName, 35 | SourceLineInfo lineInfo, 36 | GeneratorBasePtr&& generator ) { 37 | return getResultCapture().createGeneratorTracker( 38 | generatorName, lineInfo, CATCH_MOVE( generator ) ); 39 | } 40 | 41 | } // namespace Generators 42 | } // namespace Catch 43 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_main.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 | #include 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | CATCH_INTERNAL_START_WARNINGS_SUPPRESSION 16 | CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS 17 | static LeakDetector leakDetector; 18 | CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION 19 | } 20 | 21 | // Allow users of amalgamated .cpp file to remove our main and provide their own. 22 | #if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN) 23 | 24 | #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) 25 | // Standard C/C++ Win32 Unicode wmain entry point 26 | extern "C" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) { 27 | #else 28 | // Standard C/C++ main entry point 29 | int main (int argc, char * argv[]) { 30 | #endif 31 | 32 | // We want to force the linker not to discard the global variable 33 | // and its constructor, as it (optionally) registers leak detector 34 | (void)&Catch::leakDetector; 35 | 36 | return Catch::Session().run( argc, argv ); 37 | } 38 | 39 | #endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN 40 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_sharding.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_SHARDING_HPP_INCLUDED 9 | #define CATCH_SHARDING_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | template 19 | Container createShard(Container const& container, std::size_t const shardCount, std::size_t const shardIndex) { 20 | assert(shardCount > shardIndex); 21 | 22 | if (shardCount == 1) { 23 | return container; 24 | } 25 | 26 | const std::size_t totalTestCount = container.size(); 27 | 28 | const std::size_t shardSize = totalTestCount / shardCount; 29 | const std::size_t leftoverTests = totalTestCount % shardCount; 30 | 31 | const std::size_t startIndex = shardIndex * shardSize + (std::min)(shardIndex, leftoverTests); 32 | const std::size_t endIndex = (shardIndex + 1) * shardSize + (std::min)(shardIndex + 1, leftoverTests); 33 | 34 | auto startIterator = std::next(container.begin(), static_cast(startIndex)); 35 | auto endIterator = std::next(container.begin(), static_cast(endIndex)); 36 | 37 | return Container(startIterator, endIterator); 38 | } 39 | 40 | } 41 | 42 | #endif // CATCH_SHARDING_HPP_INCLUDED 43 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_config_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 | 9 | /** \file 10 | * Wrapper for UNCAUGHT_EXCEPTIONS configuration option 11 | * 12 | * For some functionality, Catch2 requires to know whether there is 13 | * an active exception. Because `std::uncaught_exception` is deprecated 14 | * in C++17, we want to use `std::uncaught_exceptions` if possible. 15 | */ 16 | 17 | #ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 18 | #define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 19 | 20 | #include 21 | 22 | #if defined(_MSC_VER) 23 | # if _MSC_VER >= 1900 // Visual Studio 2015 or newer 24 | # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 25 | # endif 26 | #endif 27 | 28 | 29 | #include 30 | 31 | #if defined(__cpp_lib_uncaught_exceptions) \ 32 | && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 33 | 34 | # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 35 | #endif // __cpp_lib_uncaught_exceptions 36 | 37 | 38 | #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ 39 | && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ 40 | && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 41 | 42 | # define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 43 | #endif 44 | 45 | 46 | #endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 47 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/matchers/catch_matchers_templated.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 | MatcherGenericBase::~MatcherGenericBase() = default; 13 | 14 | namespace Detail { 15 | 16 | std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) { 17 | std::string description; 18 | std::size_t combined_size = 4; 19 | for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { 20 | combined_size += desc->size(); 21 | } 22 | combined_size += static_cast(descriptions_end - descriptions_begin - 1) * combine.size(); 23 | 24 | description.reserve(combined_size); 25 | 26 | description += "( "; 27 | bool first = true; 28 | for( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { 29 | if( first ) 30 | first = false; 31 | else 32 | description += combine; 33 | description += *desc; 34 | } 35 | description += " )"; 36 | return description; 37 | } 38 | 39 | } // namespace Detail 40 | } // namespace Matchers 41 | } // namespace Catch 42 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.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_REPORTER_FACTORY_HPP_INCLUDED 9 | #define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | namespace Catch { 17 | 18 | struct ReporterConfig; 19 | class IConfig; 20 | class IEventListener; 21 | using IEventListenerPtr = Detail::unique_ptr; 22 | 23 | 24 | class IReporterFactory { 25 | public: 26 | virtual ~IReporterFactory(); // = default 27 | 28 | virtual IEventListenerPtr 29 | create( ReporterConfig&& config ) const = 0; 30 | virtual std::string getDescription() const = 0; 31 | }; 32 | using IReporterFactoryPtr = Detail::unique_ptr; 33 | 34 | class EventListenerFactory { 35 | public: 36 | virtual ~EventListenerFactory(); // = default 37 | virtual IEventListenerPtr create( IConfig const* config ) const = 0; 38 | //! Return a meaningful name for the listener, e.g. its type name 39 | virtual StringRef getName() const = 0; 40 | //! Return listener's description if available 41 | virtual std::string getDescription() const = 0; 42 | }; 43 | } // namespace Catch 44 | 45 | #endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED 46 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_meta.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_META_HPP_INCLUDED 9 | #define CATCH_META_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | template 15 | struct true_given : std::true_type {}; 16 | 17 | struct is_callable_tester { 18 | template 19 | static true_given()(std::declval()...))> test(int); 20 | template 21 | static std::false_type test(...); 22 | }; 23 | 24 | template 25 | struct is_callable; 26 | 27 | template 28 | struct is_callable : decltype(is_callable_tester::test(0)) {}; 29 | 30 | 31 | #if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 32 | // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is 33 | // replaced with std::invoke_result here. 34 | template 35 | using FunctionReturnType = std::remove_reference_t>>; 36 | #else 37 | template 38 | using FunctionReturnType = std::remove_reference_t>>; 39 | #endif 40 | 41 | } // namespace Catch 42 | 43 | namespace mpl_{ 44 | struct na; 45 | } 46 | 47 | #endif // CATCH_META_HPP_INCLUDED 48 | -------------------------------------------------------------------------------- /include/ftl/ftl_valgrind.h: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | #if defined(FTL_VALGRIND) 28 | # include 29 | # include 30 | 31 | # define FTL_VALGRIND_ID unsigned m_stackId; 32 | # define FTL_VALGRIND_REGISTER(s, e) m_stackId = VALGRIND_STACK_REGISTER(s, e) 33 | # define FTL_VALGRIND_DEREGISTER() VALGRIND_STACK_DEREGISTER(m_stackId) 34 | 35 | # define FTL_VALGRIND_HG_DISABLE_CHECKING(s, e) VALGRIND_HG_DISABLE_CHECKING(s, e) 36 | #else 37 | # define FTL_VALGRIND_ID 38 | # define FTL_VALGRIND_REGISTER(s, e) 39 | # define FTL_VALGRIND_DEREGISTER() 40 | 41 | # define FTL_VALGRIND_HG_DISABLE_CHECKING(s, e) 42 | #endif 43 | -------------------------------------------------------------------------------- /source/task_scheduler_internal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | namespace ftl { 28 | 29 | struct WaitingFiberBundle { 30 | // The fiber 31 | unsigned FiberIndex; 32 | // A flag used to signal if the fiber has been successfully switched out of and "cleaned up". See @TaskScheduler::CleanUpOldFiber() 33 | std::atomic FiberIsSwitched; 34 | /** 35 | * The index of the thread this fiber is pinned to 36 | * If the fiber *isn't* pinned, this will equal std::numeric_limits::max() 37 | */ 38 | unsigned PinnedThreadIndex; 39 | 40 | WaitingFiberBundle *Next; 41 | WaitingFiberBundle *QueueTail; 42 | }; 43 | 44 | } // End of namespace ftl 45 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/matchers/catch_matchers_all.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 | /** \file 9 | * This is a convenience header for Catch2's Matcher support. It includes 10 | * **all** of Catch2 headers related to matchers. 11 | * 12 | * Generally the Catch2 users should use specific includes they need, 13 | * but this header can be used instead for ease-of-experimentation, or 14 | * just plain convenience, at the cost of increased compilation times. 15 | * 16 | * When a new header is added to either the `matchers` folder, or to 17 | * the corresponding internal subfolder, it should be added here. 18 | */ 19 | 20 | #ifndef CATCH_MATCHERS_ALL_HPP_INCLUDED 21 | #define CATCH_MATCHERS_ALL_HPP_INCLUDED 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #endif // CATCH_MATCHERS_ALL_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /third_party/boost_context/asm/not_modified_yet/make_ppc64_sysv_xcoff_gas.S: -------------------------------------------------------------------------------- 1 | .globl make_fcontext[DS] 2 | .globl .make_fcontext[PR] 3 | .align 2 4 | .csect .make_fcontext[PR], 3 5 | .globl _make_fcontext 6 | #._make_fcontext: 7 | # save return address into R6 8 | mflr 6 9 | 10 | # first arg of make_fcontext() == top address of context-function 11 | # shift address in R3 to lower 16 byte boundary 12 | clrrwi 3, 3, 4 13 | 14 | # reserve space for context-data on context-stack 15 | # including 64 byte of linkage + parameter area (R1 % 16 == 0) 16 | subi 3, 3, 248 17 | 18 | # third arg of make_fcontext() == address of context-function 19 | stw 5, 176(3) 20 | 21 | # set back-chain to zero 22 | li 0, 0 23 | std 0, 184(3) 24 | 25 | # compute address of returned transfer_t 26 | addi 0, 3, 232 27 | mr 4, 0 28 | std 4, 152(3) 29 | 30 | # load LR 31 | mflr 0 32 | # jump to label 1 33 | bl .Label 34 | .Label: 35 | # load LR into R4 36 | mflr 4 37 | # compute abs address of label .L_finish 38 | addi 4, 4, .L_finish - .Label 39 | # restore LR 40 | mtlr 0 41 | # save address of finish as return-address for context-function 42 | # will be entered after context-function returns 43 | stw 4, 168(3) 44 | 45 | # restore return address from R6 46 | mtlr 6 47 | 48 | blr # return pointer to context-data 49 | 50 | .L_finish: 51 | # save return address into R0 52 | mflr 0 53 | # save return address on stack, set up stack frame 54 | stw 0, 8(1) 55 | # allocate stack space, R1 % 16 == 0 56 | stwu 1, -32(1) 57 | 58 | # exit code is zero 59 | li 3, 0 60 | # exit application 61 | bl ._exit 62 | nop 63 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/interfaces/catch_interfaces_all.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 | /** \file 9 | * This is a convenience header for Catch2's interfaces. It includes 10 | * **all** of Catch2 headers related to interfaces. 11 | * 12 | * Generally the Catch2 users should use specific includes they need, 13 | * but this header can be used instead for ease-of-experimentation, or 14 | * just plain convenience, at the cost of somewhat increased compilation 15 | * times. 16 | * 17 | * When a new header is added to either the `interfaces` folder, or to 18 | * the corresponding internal subfolder, it should be added here. 19 | */ 20 | 21 | 22 | #ifndef CATCH_INTERFACES_ALL_HPP_INCLUDED 23 | #define CATCH_INTERFACES_ALL_HPP_INCLUDED 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #endif // CATCH_INTERFACES_ALL_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /LICENSE-THIRD-PARTY: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | Boost Software License 3 | applies to: 4 | - Boost Context, Copyright Oliver Kowalke 2009 5 | - Catch2, Copyright Two Blue Cubes Ltd. 2019 6 | ----------------------------------------------------------------------------- 7 | 8 | Boost Software License - Version 1.0 - August 17th, 2003 9 | 10 | Permission is hereby granted, free of charge, to any person or organization 11 | obtaining a copy of the software and accompanying documentation covered by 12 | this license (the "Software") to use, reproduce, display, distribute, 13 | execute, and transmit the Software, and to prepare derivative works of the 14 | Software, and to permit third-parties to whom the Software is furnished to 15 | do so, all subject to the following: 16 | 17 | The copyright notices in the Software and this entire statement, including 18 | the above license grant, this restriction and the following disclaimer, 19 | must be included in all copies of the Software, in whole or in part, and 20 | all derivative works of the Software, unless such copies or derivative 21 | works are solely in the form of machine-executable object code generated by 22 | a source language processor. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 27 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 28 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 29 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 30 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /third_party/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 | template 22 | struct SampleAnalysis { 23 | std::vector samples; 24 | Estimate mean; 25 | Estimate standard_deviation; 26 | OutlierClassification outliers; 27 | double outlier_variance; 28 | 29 | template 30 | operator SampleAnalysis() const { 31 | std::vector samples2; 32 | samples2.reserve(samples.size()); 33 | for (auto const& d : samples) { 34 | samples2.push_back(Duration2(d)); 35 | } 36 | return { 37 | CATCH_MOVE(samples2), 38 | mean, 39 | standard_deviation, 40 | outliers, 41 | outlier_variance, 42 | }; 43 | } 44 | }; 45 | } // namespace Benchmark 46 | } // namespace Catch 47 | 48 | #endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED 49 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/interfaces/catch_interfaces_enum_values_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_ENUM_VALUES_REGISTRY_HPP_INCLUDED 9 | #define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | namespace Detail { 18 | struct EnumInfo { 19 | StringRef m_name; 20 | std::vector> m_values; 21 | 22 | ~EnumInfo(); 23 | 24 | StringRef lookup( int value ) const; 25 | }; 26 | } // namespace Detail 27 | 28 | class IMutableEnumValuesRegistry { 29 | public: 30 | virtual ~IMutableEnumValuesRegistry(); // = default; 31 | 32 | virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values ) = 0; 33 | 34 | template 35 | Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list values ) { 36 | static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); 37 | std::vector intValues; 38 | intValues.reserve( values.size() ); 39 | for( auto enumValue : values ) 40 | intValues.push_back( static_cast( enumValue ) ); 41 | return registerEnum( enumName, allEnums, intValues ); 42 | } 43 | }; 44 | 45 | } // Catch 46 | 47 | #endif // CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED 48 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_context.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_CONTEXT_HPP_INCLUDED 9 | #define CATCH_CONTEXT_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | class IResultCapture; 16 | class IConfig; 17 | 18 | class Context { 19 | IConfig const* m_config = nullptr; 20 | IResultCapture* m_resultCapture = nullptr; 21 | 22 | CATCH_EXPORT static Context* currentContext; 23 | friend Context& getCurrentMutableContext(); 24 | friend Context const& getCurrentContext(); 25 | static void createContext(); 26 | friend void cleanUpContext(); 27 | 28 | public: 29 | IResultCapture* getResultCapture() const { return m_resultCapture; } 30 | IConfig const* getConfig() const { return m_config; } 31 | void setResultCapture( IResultCapture* resultCapture ); 32 | void setConfig( IConfig const* config ); 33 | }; 34 | 35 | Context& getCurrentMutableContext(); 36 | 37 | inline Context const& getCurrentContext() { 38 | // We duplicate the logic from `getCurrentMutableContext` here, 39 | // to avoid paying the call overhead in debug mode. 40 | if ( !Context::currentContext ) { Context::createContext(); } 41 | // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) 42 | return *Context::currentContext; 43 | } 44 | 45 | void cleanUpContext(); 46 | 47 | class SimplePcg32; 48 | SimplePcg32& sharedRng(); 49 | } 50 | 51 | #endif // CATCH_CONTEXT_HPP_INCLUDED 52 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_enforce.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_ENFORCE_HPP_INCLUDED 9 | #define CATCH_ENFORCE_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace Catch { 18 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 19 | template 20 | [[noreturn]] 21 | void throw_exception(Ex const& e) { 22 | throw e; 23 | } 24 | #else // ^^ Exceptions are enabled // Exceptions are disabled vv 25 | [[noreturn]] 26 | void throw_exception(std::exception const& e); 27 | #endif 28 | 29 | [[noreturn]] 30 | void throw_logic_error(std::string const& msg); 31 | [[noreturn]] 32 | void throw_domain_error(std::string const& msg); 33 | [[noreturn]] 34 | void throw_runtime_error(std::string const& msg); 35 | 36 | } // namespace Catch; 37 | 38 | #define CATCH_MAKE_MSG(...) \ 39 | (Catch::ReusableStringStream() << __VA_ARGS__).str() 40 | 41 | #define CATCH_INTERNAL_ERROR(...) \ 42 | Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)) 43 | 44 | #define CATCH_ERROR(...) \ 45 | Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )) 46 | 47 | #define CATCH_RUNTIME_ERROR(...) \ 48 | Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )) 49 | 50 | #define CATCH_ENFORCE( condition, ... ) \ 51 | do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) 52 | 53 | 54 | #endif // CATCH_ENFORCE_HPP_INCLUDED 55 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### 2 | # FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | # 4 | # This library was created as a proof of concept of the ideas presented by 5 | # Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | # 7 | # http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | # 9 | # FiberTaskingLib is the legal property of Adrian Astley 10 | # Copyright Adrian Astley 2015 - 2018 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | ## 24 | 25 | include(AddCompilerFlags) 26 | 27 | set(FTL_TEST_SRC 28 | fiber_abstraction/floating_point_fiber_switch.cpp 29 | fiber_abstraction/nested_fiber_switch.cpp 30 | fiber_abstraction/single_fiber_switch.cpp 31 | functional/producer_consumer.cpp 32 | utilities/event_callbacks.cpp 33 | utilities/fibtex.cpp 34 | utilities/parallel_for.cpp 35 | utilities/thread_local.cpp 36 | functional/calc_triangle_num.cpp 37 | ) 38 | 39 | # Set the c++ std 40 | if (FTL_CPP_17) 41 | target_compile_features(ftl PUBLIC cxx_std_17) 42 | add_definitions(-DFTL_CPP_17=1) 43 | else() 44 | target_compile_features(ftl PUBLIC cxx_std_11) 45 | endif() 46 | 47 | add_executable(ftl-test ${FTL_TEST_SRC}) 48 | target_link_libraries(ftl-test Catch2::Catch2WithMain ftl) 49 | 50 | # Set the warnings 51 | AddCompilerFlags(ftl-test) 52 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_istream.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_ISTREAM_HPP_INCLUDED 9 | #define CATCH_ISTREAM_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace Catch { 20 | 21 | class IStream { 22 | public: 23 | virtual ~IStream(); // = default 24 | virtual std::ostream& stream() = 0; 25 | /** 26 | * Best guess on whether the instance is writing to a console (e.g. via stdout/stderr) 27 | * 28 | * This is useful for e.g. Win32 colour support, because the Win32 29 | * API manipulates console directly, unlike POSIX escape codes, 30 | * that can be written anywhere. 31 | * 32 | * Due to variety of ways to change where the stdout/stderr is 33 | * _actually_ being written, users should always assume that 34 | * the answer might be wrong. 35 | */ 36 | virtual bool isConsole() const { return false; } 37 | }; 38 | 39 | /** 40 | * Creates a stream wrapper that writes to specific file. 41 | * 42 | * Also recognizes 4 special filenames 43 | * * `-` for stdout 44 | * * `%stdout` for stdout 45 | * * `%stderr` for stderr 46 | * * `%debug` for platform specific debugging output 47 | * 48 | * \throws if passed an unrecognized %-prefixed stream 49 | */ 50 | auto makeStream( std::string const& filename ) -> Detail::unique_ptr; 51 | 52 | } 53 | 54 | #endif // CATCH_STREAM_HPP_INCLUDED 55 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_reporter_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_REPORTER_REGISTRY_HPP_INCLUDED 9 | #define CATCH_REPORTER_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Catch { 19 | 20 | class IEventListener; 21 | using IEventListenerPtr = Detail::unique_ptr; 22 | class IReporterFactory; 23 | using IReporterFactoryPtr = Detail::unique_ptr; 24 | struct ReporterConfig; 25 | class EventListenerFactory; 26 | 27 | class ReporterRegistry { 28 | struct ReporterRegistryImpl; 29 | Detail::unique_ptr m_impl; 30 | 31 | public: 32 | ReporterRegistry(); 33 | ~ReporterRegistry(); // = default; 34 | 35 | IEventListenerPtr create( std::string const& name, 36 | ReporterConfig&& config ) const; 37 | 38 | void registerReporter( std::string const& name, 39 | IReporterFactoryPtr factory ); 40 | 41 | void 42 | registerListener( Detail::unique_ptr factory ); 43 | 44 | std::map const& 47 | getFactories() const; 48 | 49 | std::vector> const& 50 | getListeners() const; 51 | }; 52 | 53 | } // end namespace Catch 54 | 55 | #endif // CATCH_REPORTER_REGISTRY_HPP_INCLUDED 56 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_common_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 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | namespace Catch { 17 | ReporterBase::ReporterBase( ReporterConfig&& config ): 18 | IEventListener( config.fullConfig() ), 19 | m_wrapped_stream( CATCH_MOVE(config).takeStream() ), 20 | m_stream( m_wrapped_stream->stream() ), 21 | m_colour( makeColourImpl( config.colourMode(), m_wrapped_stream.get() ) ), 22 | m_customOptions( config.customOptions() ) 23 | {} 24 | 25 | ReporterBase::~ReporterBase() = default; 26 | 27 | void ReporterBase::listReporters( 28 | std::vector const& descriptions ) { 29 | defaultListReporters(m_stream, descriptions, m_config->verbosity()); 30 | } 31 | 32 | void ReporterBase::listListeners( 33 | std::vector const& descriptions ) { 34 | defaultListListeners( m_stream, descriptions ); 35 | } 36 | 37 | void ReporterBase::listTests(std::vector const& tests) { 38 | defaultListTests(m_stream, 39 | m_colour.get(), 40 | tests, 41 | m_config->hasTestFilters(), 42 | m_config->verbosity()); 43 | } 44 | 45 | void ReporterBase::listTags(std::vector const& tags) { 46 | defaultListTags( m_stream, tags, m_config->hasTestFilters() ); 47 | } 48 | 49 | } // namespace Catch 50 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporters_all.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 | /** \file 9 | * This is a convenience header for Catch2's Reporter support. It includes 10 | * **all** of Catch2 headers related to reporters, including all reporters. 11 | * 12 | * Generally the Catch2 users should use specific includes they need, 13 | * but this header can be used instead for ease-of-experimentation, or 14 | * just plain convenience, at the cost of (significantly) increased 15 | * compilation times. 16 | * 17 | * When a new header (reporter) is added to either the `reporter` folder, 18 | * or to the corresponding internal subfolder, it should be added here. 19 | */ 20 | 21 | #ifndef CATCH_REPORTERS_ALL_HPP_INCLUDED 22 | #define CATCH_REPORTERS_ALL_HPP_INCLUDED 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif // CATCH_REPORTERS_ALL_HPP_INCLUDED 41 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_reusable_string_stream.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_REUSABLE_STRING_STREAM_HPP_INCLUDED 9 | #define CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Catch { 19 | 20 | class ReusableStringStream : Detail::NonCopyable { 21 | std::size_t m_index; 22 | std::ostream* m_oss; 23 | public: 24 | ReusableStringStream(); 25 | ~ReusableStringStream(); 26 | 27 | //! Returns the serialized state 28 | std::string str() const; 29 | //! Sets internal state to `str` 30 | void str(std::string const& str); 31 | 32 | #if defined(__GNUC__) && !defined(__clang__) 33 | #pragma GCC diagnostic push 34 | // Old versions of GCC do not understand -Wnonnull-compare 35 | #pragma GCC diagnostic ignored "-Wpragmas" 36 | // Streaming a function pointer triggers Waddress and Wnonnull-compare 37 | // on GCC, because it implicitly converts it to bool and then decides 38 | // that the check it uses (a? true : false) is tautological and cannot 39 | // be null... 40 | #pragma GCC diagnostic ignored "-Waddress" 41 | #pragma GCC diagnostic ignored "-Wnonnull-compare" 42 | #endif 43 | 44 | template 45 | auto operator << ( T const& value ) -> ReusableStringStream& { 46 | *m_oss << value; 47 | return *this; 48 | } 49 | 50 | #if defined(__GNUC__) && !defined(__clang__) 51 | #pragma GCC diagnostic pop 52 | #endif 53 | auto get() -> std::ostream& { return *m_oss; } 54 | }; 55 | } 56 | 57 | #endif // CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED 58 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_result_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_RESULT_TYPE_HPP_INCLUDED 9 | #define CATCH_RESULT_TYPE_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | // ResultWas::OfType enum 14 | struct ResultWas { enum OfType { 15 | Unknown = -1, 16 | Ok = 0, 17 | Info = 1, 18 | Warning = 2, 19 | // TODO: Should explicit skip be considered "not OK" (cf. isOk)? I.e., should it have the failure bit? 20 | ExplicitSkip = 4, 21 | 22 | FailureBit = 0x10, 23 | 24 | ExpressionFailed = FailureBit | 1, 25 | ExplicitFailure = FailureBit | 2, 26 | 27 | Exception = 0x100 | FailureBit, 28 | 29 | ThrewException = Exception | 1, 30 | DidntThrowException = Exception | 2, 31 | 32 | FatalErrorCondition = 0x200 | FailureBit 33 | 34 | }; }; 35 | 36 | bool isOk( ResultWas::OfType resultType ); 37 | bool isJustInfo( int flags ); 38 | 39 | 40 | // ResultDisposition::Flags enum 41 | struct ResultDisposition { enum Flags { 42 | Normal = 0x01, 43 | 44 | ContinueOnFailure = 0x02, // Failures fail test, but execution continues 45 | FalseTest = 0x04, // Prefix expression with ! 46 | SuppressFail = 0x08 // Failures are reported but do not fail the test 47 | }; }; 48 | 49 | ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); 50 | 51 | bool shouldContinueOnFailure( int flags ); 52 | inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } 53 | bool shouldSuppressFailure( int flags ); 54 | 55 | } // end namespace Catch 56 | 57 | #endif // CATCH_RESULT_TYPE_HPP_INCLUDED 58 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_wildcard_pattern.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 | #include 11 | 12 | namespace Catch { 13 | 14 | WildcardPattern::WildcardPattern( std::string const& pattern, 15 | CaseSensitive caseSensitivity ) 16 | : m_caseSensitivity( caseSensitivity ), 17 | m_pattern( normaliseString( pattern ) ) 18 | { 19 | if( startsWith( m_pattern, '*' ) ) { 20 | m_pattern = m_pattern.substr( 1 ); 21 | m_wildcard = WildcardAtStart; 22 | } 23 | if( endsWith( m_pattern, '*' ) ) { 24 | m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); 25 | m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); 26 | } 27 | } 28 | 29 | bool WildcardPattern::matches( std::string const& str ) const { 30 | switch( m_wildcard ) { 31 | case NoWildcard: 32 | return m_pattern == normaliseString( str ); 33 | case WildcardAtStart: 34 | return endsWith( normaliseString( str ), m_pattern ); 35 | case WildcardAtEnd: 36 | return startsWith( normaliseString( str ), m_pattern ); 37 | case WildcardAtBothEnds: 38 | return contains( normaliseString( str ), m_pattern ); 39 | default: 40 | CATCH_INTERNAL_ERROR( "Unknown enum" ); 41 | } 42 | } 43 | 44 | std::string WildcardPattern::normaliseString( std::string const& str ) const { 45 | return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_parse_numbers.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 | #include 15 | 16 | namespace Catch { 17 | 18 | Optional parseUInt(std::string const& input, int base) { 19 | auto trimmed = trim( input ); 20 | // std::stoull is annoying and accepts numbers starting with '-', 21 | // it just negates them into unsigned int 22 | if ( trimmed.empty() || trimmed[0] == '-' ) { 23 | return {}; 24 | } 25 | 26 | CATCH_TRY { 27 | size_t pos = 0; 28 | const auto ret = std::stoull( trimmed, &pos, base ); 29 | 30 | // We did not consume the whole input, so there is an issue 31 | // This can be bunch of different stuff, like multiple numbers 32 | // in the input, or invalid digits/characters and so on. Either 33 | // way, we do not want to return the partially parsed result. 34 | if ( pos != trimmed.size() ) { 35 | return {}; 36 | } 37 | // Too large 38 | if ( ret > std::numeric_limits::max() ) { 39 | return {}; 40 | } 41 | return static_cast(ret); 42 | } 43 | CATCH_CATCH_ANON( std::invalid_argument const& ) { 44 | // no conversion could be performed 45 | } 46 | CATCH_CATCH_ANON( std::out_of_range const& ) { 47 | // the input does not fit into an unsigned long long 48 | } 49 | return {}; 50 | } 51 | 52 | } // namespace Catch 53 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_session.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_SESSION_HPP_INCLUDED 9 | #define CATCH_SESSION_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | 19 | class Session : Detail::NonCopyable { 20 | public: 21 | 22 | Session(); 23 | ~Session(); 24 | 25 | void showHelp() const; 26 | void libIdentify(); 27 | 28 | int applyCommandLine( int argc, char const * const * argv ); 29 | #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) 30 | int applyCommandLine( int argc, wchar_t const * const * argv ); 31 | #endif 32 | 33 | void useConfigData( ConfigData const& configData ); 34 | 35 | template 36 | int run(int argc, CharT const * const argv[]) { 37 | if (m_startupExceptions) 38 | return 1; 39 | int returnCode = applyCommandLine(argc, argv); 40 | if (returnCode == 0) 41 | returnCode = run(); 42 | return returnCode; 43 | } 44 | 45 | int run(); 46 | 47 | Clara::Parser const& cli() const; 48 | void cli( Clara::Parser const& newParser ); 49 | ConfigData& configData(); 50 | Config& config(); 51 | private: 52 | int runInternal(); 53 | 54 | Clara::Parser m_cli; 55 | ConfigData m_configData; 56 | Detail::unique_ptr m_config; 57 | bool m_startupExceptions = false; 58 | }; 59 | 60 | } // end namespace Catch 61 | 62 | #endif // CATCH_SESSION_HPP_INCLUDED 63 | -------------------------------------------------------------------------------- /tests/fiber_abstraction/single_fiber_switch.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "ftl/fiber.h" 26 | 27 | #include "catch2/catch_test_macros.hpp" 28 | 29 | #include 30 | 31 | struct SingleFiberArg { 32 | std::atomic_long Counter{ 0 }; 33 | ftl::Fiber MainFiber; 34 | ftl::Fiber OtherFiber; 35 | }; 36 | 37 | void SingleFiberStart(void *arg) { 38 | auto *singleFiberArg = reinterpret_cast(arg); 39 | 40 | singleFiberArg->Counter.fetch_add(1); 41 | 42 | singleFiberArg->OtherFiber.SwitchToFiber(&singleFiberArg->MainFiber); 43 | 44 | // We should never get here 45 | FAIL(); 46 | } 47 | 48 | TEST_CASE("Single Fiber Switch", "[fiber]") { 49 | constexpr size_t kHalfMebibyte = 524288; 50 | 51 | SingleFiberArg singleFiberArg; 52 | singleFiberArg.Counter.store(0); 53 | singleFiberArg.OtherFiber = ftl::Fiber(kHalfMebibyte, SingleFiberStart, &singleFiberArg); 54 | 55 | singleFiberArg.MainFiber.SwitchToFiber(&singleFiberArg.OtherFiber); 56 | 57 | REQUIRE(singleFiberArg.Counter.load() == 1); 58 | } 59 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/matchers/catch_matchers_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_MATCHERS_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Matchers { 15 | 16 | class ExceptionMessageMatcher final : public MatcherBase { 17 | std::string m_message; 18 | public: 19 | 20 | ExceptionMessageMatcher(std::string const& message): 21 | m_message(message) 22 | {} 23 | 24 | bool match(std::exception const& ex) const override; 25 | 26 | std::string describe() const override; 27 | }; 28 | 29 | //! Creates a matcher that checks whether a std derived exception has the provided message 30 | ExceptionMessageMatcher Message(std::string const& message); 31 | 32 | template 33 | class ExceptionMessageMatchesMatcher final 34 | : public MatcherBase { 35 | StringMatcherType m_matcher; 36 | 37 | public: 38 | ExceptionMessageMatchesMatcher( StringMatcherType matcher ): 39 | m_matcher( CATCH_MOVE( matcher ) ) {} 40 | 41 | bool match( std::exception const& ex ) const override { 42 | return m_matcher.match( ex.what() ); 43 | } 44 | 45 | std::string describe() const override { 46 | return " matches \"" + m_matcher.describe() + '"'; 47 | } 48 | }; 49 | 50 | //! Creates a matcher that checks whether a message from an std derived 51 | //! exception matches a provided matcher 52 | template 53 | ExceptionMessageMatchesMatcher 54 | MessageMatches( StringMatcherType&& matcher ) { 55 | return { CATCH_FORWARD( matcher ) }; 56 | } 57 | 58 | } // namespace Matchers 59 | } // namespace Catch 60 | 61 | #endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 62 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_junit.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_REPORTER_JUNIT_HPP_INCLUDED 9 | #define CATCH_REPORTER_JUNIT_HPP_INCLUDED 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | class JunitReporter final : public CumulativeReporterBase { 19 | public: 20 | JunitReporter(ReporterConfig&& _config); 21 | 22 | ~JunitReporter() override = default; 23 | 24 | static std::string getDescription(); 25 | 26 | void testRunStarting(TestRunInfo const& runInfo) override; 27 | 28 | void testCaseStarting(TestCaseInfo const& testCaseInfo) override; 29 | void assertionEnded(AssertionStats const& assertionStats) override; 30 | 31 | void testCaseEnded(TestCaseStats const& testCaseStats) override; 32 | 33 | void testRunEndedCumulative() override; 34 | 35 | private: 36 | void writeRun(TestRunNode const& testRunNode, double suiteTime); 37 | 38 | void writeTestCase(TestCaseNode const& testCaseNode); 39 | 40 | void writeSection( std::string const& className, 41 | std::string const& rootName, 42 | SectionNode const& sectionNode, 43 | bool testOkToFail ); 44 | 45 | void writeAssertions(SectionNode const& sectionNode); 46 | void writeAssertion(AssertionStats const& stats); 47 | 48 | XmlWriter xml; 49 | Timer suiteTimer; 50 | std::string stdOutForSuite; 51 | std::string stdErrForSuite; 52 | unsigned int unexpectedExceptions = 0; 53 | bool m_okToFail = false; 54 | }; 55 | 56 | } // end namespace Catch 57 | 58 | #endif // CATCH_REPORTER_JUNIT_HPP_INCLUDED 59 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_assertion_result.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_RESULT_HPP_INCLUDED 9 | #define CATCH_ASSERTION_RESULT_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | namespace Catch { 20 | 21 | struct AssertionResultData 22 | { 23 | AssertionResultData() = delete; 24 | 25 | AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); 26 | 27 | std::string message; 28 | mutable std::string reconstructedExpression; 29 | LazyExpression lazyExpression; 30 | ResultWas::OfType resultType; 31 | 32 | std::string reconstructExpression() const; 33 | }; 34 | 35 | class AssertionResult { 36 | public: 37 | AssertionResult() = delete; 38 | AssertionResult( AssertionInfo const& info, AssertionResultData&& data ); 39 | 40 | bool isOk() const; 41 | bool succeeded() const; 42 | ResultWas::OfType getResultType() const; 43 | bool hasExpression() const; 44 | bool hasMessage() const; 45 | std::string getExpression() const; 46 | std::string getExpressionInMacro() const; 47 | bool hasExpandedExpression() const; 48 | std::string getExpandedExpression() const; 49 | StringRef getMessage() const; 50 | SourceLineInfo getSourceInfo() const; 51 | StringRef getTestMacroName() const; 52 | 53 | //protected: 54 | AssertionInfo m_info; 55 | AssertionResultData m_resultData; 56 | }; 57 | 58 | } // end namespace Catch 59 | 60 | #endif // CATCH_ASSERTION_RESULT_HPP_INCLUDED 61 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_event_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 | 11 | namespace Catch { 12 | 13 | void EventListenerBase::fatalErrorEncountered( StringRef ) {} 14 | 15 | void EventListenerBase::benchmarkPreparing( StringRef ) {} 16 | void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {} 17 | void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {} 18 | void EventListenerBase::benchmarkFailed( StringRef ) {} 19 | 20 | void EventListenerBase::assertionStarting( AssertionInfo const& ) {} 21 | 22 | void EventListenerBase::assertionEnded( AssertionStats const& ) {} 23 | void EventListenerBase::listReporters( 24 | std::vector const& ) {} 25 | void EventListenerBase::listListeners( 26 | std::vector const& ) {} 27 | void EventListenerBase::listTests( std::vector const& ) {} 28 | void EventListenerBase::listTags( std::vector const& ) {} 29 | void EventListenerBase::noMatchingTestCases( StringRef ) {} 30 | void EventListenerBase::reportInvalidTestSpec( StringRef ) {} 31 | void EventListenerBase::testRunStarting( TestRunInfo const& ) {} 32 | void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} 33 | void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {} 34 | void EventListenerBase::sectionStarting( SectionInfo const& ) {} 35 | void EventListenerBase::sectionEnded( SectionStats const& ) {} 36 | void EventListenerBase::testCasePartialEnded(TestCaseStats const&, uint64_t) {} 37 | void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} 38 | void EventListenerBase::testRunEnded( TestRunStats const& ) {} 39 | void EventListenerBase::skipTest( TestCaseInfo const& ) {} 40 | } // namespace Catch 41 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/matchers/catch_matchers_predicate.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_MATCHERS_PREDICATE_HPP_INCLUDED 9 | #define CATCH_MATCHERS_PREDICATE_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace Catch { 18 | namespace Matchers { 19 | 20 | namespace Detail { 21 | std::string finalizeDescription(const std::string& desc); 22 | } // namespace Detail 23 | 24 | template 25 | class PredicateMatcher final : public MatcherBase { 26 | Predicate m_predicate; 27 | std::string m_description; 28 | public: 29 | 30 | PredicateMatcher(Predicate&& elem, std::string const& descr) 31 | :m_predicate(CATCH_FORWARD(elem)), 32 | m_description(Detail::finalizeDescription(descr)) 33 | {} 34 | 35 | bool match( T const& item ) const override { 36 | return m_predicate(item); 37 | } 38 | 39 | std::string describe() const override { 40 | return m_description; 41 | } 42 | }; 43 | 44 | /** 45 | * Creates a matcher that calls delegates `match` to the provided predicate. 46 | * 47 | * The user has to explicitly specify the argument type to the matcher 48 | */ 49 | template 50 | PredicateMatcher Predicate(Pred&& predicate, std::string const& description = "") { 51 | static_assert(is_callable::value, "Predicate not callable with argument T"); 52 | static_assert(std::is_same>::value, "Predicate does not return bool"); 53 | return PredicateMatcher(CATCH_FORWARD(predicate), description); 54 | } 55 | 56 | } // namespace Matchers 57 | } // namespace Catch 58 | 59 | #endif // CATCH_MATCHERS_PREDICATE_HPP_INCLUDED 60 | -------------------------------------------------------------------------------- /benchmarks/empty/empty.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * FiberTaskingLib - A tasking library that uses fibers for efficient task switching 3 | * 4 | * This library was created as a proof of concept of the ideas presented by 5 | * Christian Gyrling in his 2015 GDC Talk 'Parallelizing the Naughty Dog Engine Using Fibers' 6 | * 7 | * http://gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine 8 | * 9 | * FiberTaskingLib is the legal property of Adrian Astley 10 | * Copyright Adrian Astley 2015 - 2018 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "ftl/task_scheduler.h" 26 | #include "ftl/wait_group.h" 27 | 28 | #include "catch2/benchmark/catch_benchmark.hpp" 29 | #include "catch2/catch_test_macros.hpp" 30 | 31 | // Constants 32 | constexpr static unsigned kNumTasks = 65000; 33 | constexpr static unsigned kNumIterations = 1; 34 | 35 | void EmptyBenchmarkTask(ftl::TaskScheduler * /*scheduler*/, void * /*arg*/) { 36 | // No-Op 37 | } 38 | 39 | TEST_CASE("Empty benchmark") { 40 | BENCHMARK_ADVANCED("Empty") 41 | (Catch::Benchmark::Chronometer meter) { 42 | ftl::TaskScheduler taskScheduler; 43 | taskScheduler.Init(); 44 | 45 | auto *tasks = new ftl::Task[kNumTasks]; 46 | for (unsigned i = 0; i < kNumTasks; ++i) { 47 | tasks[i] = { EmptyBenchmarkTask, nullptr }; 48 | } 49 | 50 | meter.measure([&taskScheduler, tasks] { 51 | for (unsigned i = 0; i < kNumIterations; ++i) { 52 | ftl::WaitGroup wg(&taskScheduler); 53 | taskScheduler.AddTasks(kNumTasks, tasks, ftl::TaskPriority::Normal); 54 | wg.Wait(); 55 | } 56 | }); 57 | 58 | // Cleanup 59 | delete[] tasks; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_stringref.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 | #include 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | StringRef::StringRef( char const* rawChars ) noexcept 17 | : StringRef( rawChars, std::strlen(rawChars) ) 18 | {} 19 | 20 | 21 | bool StringRef::operator<(StringRef rhs) const noexcept { 22 | if (m_size < rhs.m_size) { 23 | return strncmp(m_start, rhs.m_start, m_size) <= 0; 24 | } 25 | return strncmp(m_start, rhs.m_start, rhs.m_size) < 0; 26 | } 27 | 28 | int StringRef::compare( StringRef rhs ) const { 29 | auto cmpResult = 30 | strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) ); 31 | 32 | // This means that strncmp found a difference before the strings 33 | // ended, and we can return it directly 34 | if ( cmpResult != 0 ) { 35 | return cmpResult; 36 | } 37 | 38 | // If strings are equal up to length, then their comparison results on 39 | // their size 40 | if ( m_size < rhs.m_size ) { 41 | return -1; 42 | } else if ( m_size > rhs.m_size ) { 43 | return 1; 44 | } else { 45 | return 0; 46 | } 47 | } 48 | 49 | auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& { 50 | return os.write(str.data(), static_cast(str.size())); 51 | } 52 | 53 | std::string operator+(StringRef lhs, StringRef rhs) { 54 | std::string ret; 55 | ret.reserve(lhs.size() + rhs.size()); 56 | ret += lhs; 57 | ret += rhs; 58 | return ret; 59 | } 60 | 61 | auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& { 62 | lhs.append(rhs.data(), rhs.size()); 63 | return lhs; 64 | } 65 | 66 | } // namespace Catch 67 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/internal/catch_random_number_generator.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 | namespace { 13 | 14 | #if defined(_MSC_VER) 15 | #pragma warning(push) 16 | #pragma warning(disable:4146) // we negate uint32 during the rotate 17 | #endif 18 | // Safe rotr implementation thanks to John Regehr 19 | uint32_t rotate_right(uint32_t val, uint32_t count) { 20 | const uint32_t mask = 31; 21 | count &= mask; 22 | return (val >> count) | (val << (-count & mask)); 23 | } 24 | 25 | #if defined(_MSC_VER) 26 | #pragma warning(pop) 27 | #endif 28 | 29 | } 30 | 31 | 32 | SimplePcg32::SimplePcg32(result_type seed_) { 33 | seed(seed_); 34 | } 35 | 36 | 37 | void SimplePcg32::seed(result_type seed_) { 38 | m_state = 0; 39 | (*this)(); 40 | m_state += seed_; 41 | (*this)(); 42 | } 43 | 44 | void SimplePcg32::discard(uint64_t skip) { 45 | // We could implement this to run in O(log n) steps, but this 46 | // should suffice for our use case. 47 | for (uint64_t s = 0; s < skip; ++s) { 48 | static_cast((*this)()); 49 | } 50 | } 51 | 52 | SimplePcg32::result_type SimplePcg32::operator()() { 53 | // prepare the output value 54 | const uint32_t xorshifted = static_cast(((m_state >> 18u) ^ m_state) >> 27u); 55 | const auto output = rotate_right(xorshifted, m_state >> 59u); 56 | 57 | // advance state 58 | m_state = m_state * 6364136223846793005ULL + s_inc; 59 | 60 | return output; 61 | } 62 | 63 | bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { 64 | return lhs.m_state == rhs.m_state; 65 | } 66 | 67 | bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { 68 | return lhs.m_state != rhs.m_state; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/benchmark/detail/catch_benchmark_stats.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_HPP_INCLUDED 9 | #define CATCH_BENCHMARK_STATS_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | // The fwd decl & default specialization needs to be seen by VS2017 before 15 | // BenchmarkStats itself, or VS2017 will report compilation error. 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | namespace Catch { 22 | 23 | struct BenchmarkInfo { 24 | std::string name; 25 | double estimatedDuration; 26 | int iterations; 27 | unsigned int samples; 28 | unsigned int resamples; 29 | double clockResolution; 30 | double clockCost; 31 | }; 32 | 33 | template 34 | struct BenchmarkStats { 35 | BenchmarkInfo info; 36 | 37 | std::vector samples; 38 | Benchmark::Estimate mean; 39 | Benchmark::Estimate standardDeviation; 40 | Benchmark::OutlierClassification outliers; 41 | double outlierVariance; 42 | 43 | template 44 | operator BenchmarkStats() const { 45 | std::vector samples2; 46 | samples2.reserve(samples.size()); 47 | for (auto const& sample : samples) { 48 | samples2.push_back(Duration2(sample)); 49 | } 50 | return { 51 | info, 52 | CATCH_MOVE(samples2), 53 | mean, 54 | standardDeviation, 55 | outliers, 56 | outlierVariance, 57 | }; 58 | } 59 | }; 60 | 61 | 62 | } // end namespace Catch 63 | 64 | #endif // CATCH_BENCHMARK_STATS_HPP_INCLUDED 65 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/reporters/catch_reporter_teamcity.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_REPORTER_TEAMCITY_HPP_INCLUDED 9 | #define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #ifdef __clang__ 17 | # pragma clang diagnostic push 18 | # pragma clang diagnostic ignored "-Wpadded" 19 | #endif 20 | 21 | namespace Catch { 22 | 23 | class TeamCityReporter final : public StreamingReporterBase { 24 | public: 25 | TeamCityReporter( ReporterConfig&& _config ) 26 | : StreamingReporterBase( CATCH_MOVE(_config) ) 27 | { 28 | m_preferences.shouldRedirectStdOut = true; 29 | } 30 | 31 | ~TeamCityReporter() override; 32 | 33 | static std::string getDescription() { 34 | using namespace std::string_literals; 35 | return "Reports test results as TeamCity service messages"s; 36 | } 37 | 38 | void testRunStarting( TestRunInfo const& groupInfo ) override; 39 | void testRunEnded( TestRunStats const& testGroupStats ) override; 40 | 41 | 42 | void assertionEnded(AssertionStats const& assertionStats) override; 43 | 44 | void sectionStarting(SectionInfo const& sectionInfo) override { 45 | m_headerPrintedForThisSection = false; 46 | StreamingReporterBase::sectionStarting( sectionInfo ); 47 | } 48 | 49 | void testCaseStarting(TestCaseInfo const& testInfo) override; 50 | 51 | void testCaseEnded(TestCaseStats const& testCaseStats) override; 52 | 53 | private: 54 | void printSectionHeader(std::ostream& os); 55 | 56 | bool m_headerPrintedForThisSection = false; 57 | Timer m_testTimer; 58 | }; 59 | 60 | } // end namespace Catch 61 | 62 | #ifdef __clang__ 63 | # pragma clang diagnostic pop 64 | #endif 65 | 66 | #endif // CATCH_REPORTER_TEAMCITY_HPP_INCLUDED 67 | -------------------------------------------------------------------------------- /third_party/catch2/src/catch2/catch_totals.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 | Counts Counts::operator - ( Counts const& other ) const { 13 | Counts diff; 14 | diff.passed = passed - other.passed; 15 | diff.failed = failed - other.failed; 16 | diff.failedButOk = failedButOk - other.failedButOk; 17 | diff.skipped = skipped - other.skipped; 18 | return diff; 19 | } 20 | 21 | Counts& Counts::operator += ( Counts const& other ) { 22 | passed += other.passed; 23 | failed += other.failed; 24 | failedButOk += other.failedButOk; 25 | skipped += other.skipped; 26 | return *this; 27 | } 28 | 29 | std::uint64_t Counts::total() const { 30 | return passed + failed + failedButOk + skipped; 31 | } 32 | bool Counts::allPassed() const { 33 | return failed == 0 && failedButOk == 0 && skipped == 0; 34 | } 35 | bool Counts::allOk() const { 36 | return failed == 0; 37 | } 38 | 39 | Totals Totals::operator - ( Totals const& other ) const { 40 | Totals diff; 41 | diff.assertions = assertions - other.assertions; 42 | diff.testCases = testCases - other.testCases; 43 | return diff; 44 | } 45 | 46 | Totals& Totals::operator += ( Totals const& other ) { 47 | assertions += other.assertions; 48 | testCases += other.testCases; 49 | return *this; 50 | } 51 | 52 | Totals Totals::delta( Totals const& prevTotals ) const { 53 | Totals diff = *this - prevTotals; 54 | if( diff.assertions.failed > 0 ) 55 | ++diff.testCases.failed; 56 | else if( diff.assertions.failedButOk > 0 ) 57 | ++diff.testCases.failedButOk; 58 | else if ( diff.assertions.skipped > 0 ) 59 | ++ diff.testCases.skipped; 60 | else 61 | ++diff.testCases.passed; 62 | return diff; 63 | } 64 | 65 | } 66 | --------------------------------------------------------------------------------