├── .github └── workflows │ ├── ci.yml │ └── cla.yml ├── .gitignore ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── doc └── doxygen_header.html ├── doxygen.config ├── src ├── examples │ ├── demo │ │ ├── building7m │ │ │ ├── building7m.h │ │ │ ├── building7m.png │ │ │ ├── building_closed_system.h │ │ │ ├── building_dynamics_node.h │ │ │ ├── building_info_node.h │ │ │ ├── building_layout_codes.h │ │ │ ├── building_vis_node.h │ │ │ ├── initial_position_node.h │ │ │ ├── main.cpp │ │ │ ├── occupant_node.h │ │ │ ├── thermodynamics_node.h │ │ │ └── weather_node.h │ │ ├── queueing │ │ │ ├── job_generation_node.h │ │ │ ├── main.cpp │ │ │ ├── parallel_queueing_closed_system.h │ │ │ ├── parallel_queueing_node.h │ │ │ ├── plus_node.h │ │ │ ├── queueing.h │ │ │ ├── queueing_closed_system.h │ │ │ ├── queueing_node.h │ │ │ ├── two_stage_queueing_closed_system.h │ │ │ └── two_stage_queueing_node.h │ │ └── workers │ │ │ ├── main.cpp │ │ │ ├── worker_arrival_node.cpp │ │ │ ├── worker_arrival_node.h │ │ │ ├── worker_node.cpp │ │ │ ├── worker_node.h │ │ │ ├── workers.cpp │ │ │ ├── workers.h │ │ │ ├── workplace_closed_system.cpp │ │ │ ├── workplace_closed_system.h │ │ │ ├── workplace_csv_output_node.cpp │ │ │ ├── workplace_csv_output_node.h │ │ │ ├── workplace_node.cpp │ │ │ └── workplace_node.h │ ├── research │ │ ├── building7m_advanced │ │ │ ├── acoustics_node.h │ │ │ ├── building7m.h │ │ │ ├── building_closed_system.h │ │ │ ├── building_dynamics_node.h │ │ │ ├── building_info_node.h │ │ │ ├── building_layout_codes.h │ │ │ ├── building_occupant_ids.h │ │ │ ├── building_ui_node.h │ │ │ ├── building_vis_node.h │ │ │ ├── comfort_node.h │ │ │ ├── hearing_node.h │ │ │ ├── heat_source_node.h │ │ │ ├── initial_positions_node.h │ │ │ ├── main.cpp │ │ │ ├── occupant_planning_node.h │ │ │ ├── occupant_steering_node.h │ │ │ ├── sound_source_node.h │ │ │ ├── thermodynamics_node.h │ │ │ └── weather_node.h │ │ ├── customs │ │ │ ├── customs.h │ │ │ ├── customs_closed_system.h │ │ │ ├── main.cpp │ │ │ ├── robust_lane_node.h │ │ │ ├── robust_queue_array_node.h │ │ │ ├── robust_queue_node.h │ │ │ ├── robust_server_array_node.h │ │ │ ├── robust_server_node.h │ │ │ ├── robust_sink_node.h │ │ │ ├── robust_source_node.h │ │ │ └── robust_variable_lane_node.h │ │ ├── prediction │ │ │ ├── drift_node.h │ │ │ ├── feature_node.h │ │ │ ├── incident_node.h │ │ │ ├── main.cpp │ │ │ ├── noise_node.h │ │ │ ├── occurrence_node.h │ │ │ ├── prediction.h │ │ │ ├── prediction_closed_system.h │ │ │ ├── prediction_node.h │ │ │ ├── predictor_node.h │ │ │ ├── pulse_node.h │ │ │ └── waveform_node.h │ │ ├── realtime │ │ │ ├── bouncing_ball_interactive_system.h │ │ │ ├── bouncing_ball_node.h │ │ │ ├── main.cpp │ │ │ ├── motion_physics_types.h │ │ │ ├── realtime.cpp │ │ │ └── realtime.h │ │ └── subtyping │ │ │ ├── agent_base_node.h │ │ │ ├── agent_derived_A_node.h │ │ │ ├── agent_derived_B_node.h │ │ │ ├── main.cpp │ │ │ ├── subtyping.h │ │ │ └── subtyping_closed_system.h │ ├── test_performance │ │ └── multidimensional_arrays │ │ │ └── array_performance.cpp │ └── test_systems │ │ ├── agentbased │ │ ├── agentbased_systems.h │ │ ├── main.cpp │ │ ├── simple_agent_node.h │ │ ├── simple_agentbased_node.h │ │ └── simple_collection_node.h │ │ ├── basic │ │ ├── basic_double_processor_node.h │ │ ├── basic_generator_double_processor_node.h │ │ ├── basic_generator_node.h │ │ ├── basic_processor_node.h │ │ ├── basic_systems.h │ │ └── main.cpp │ │ ├── cellular │ │ ├── cell_function_node.h │ │ ├── cellular_systems.h │ │ ├── lower_cellular_node.h │ │ ├── main.cpp │ │ └── upper_cellular_node.h │ │ ├── data │ │ ├── data_arraynds_composite_node.h │ │ ├── data_arraynds_node.h │ │ ├── data_custom_composite_node.h │ │ ├── data_custom_node.h │ │ ├── data_primitives_composite_node.h │ │ ├── data_primitives_node.h │ │ ├── data_structures_composite_node.h │ │ ├── data_structures_node.h │ │ ├── data_systems.h │ │ ├── data_tuples_composite_node.h │ │ ├── data_tuples_node.h │ │ └── main.cpp │ │ ├── hello │ │ ├── hello_at_init_node.h │ │ ├── hello_at_planned_node.h │ │ ├── hello_count_node.h │ │ ├── hello_poisson_node.h │ │ ├── hello_systems.h │ │ └── main.cpp │ │ └── sorting │ │ ├── main.cpp │ │ ├── sorting_2_node.h │ │ ├── sorting_3_node.h │ │ ├── sorting_4_node.h │ │ ├── sorting_4_test_node.h │ │ └── sorting_systems.h └── sydevs │ ├── core │ ├── arraynd.h │ ├── arraynd_base.h │ ├── identity.h │ ├── number_types.h │ ├── pointer.h │ ├── qualified_type.h │ ├── quantity.h │ ├── range.h │ ├── scale.cpp │ ├── scale.h │ ├── string_builder.h │ ├── timer.h │ └── units.h │ ├── index.md │ ├── systems │ ├── atomic_node.cpp │ ├── atomic_node.h │ ├── collection_node.h │ ├── collection_node_base.h │ ├── composite_node.cpp │ ├── composite_node.h │ ├── data_goal.cpp │ ├── data_goal.h │ ├── data_mode.cpp │ ├── data_mode.h │ ├── discrete_event_time.h │ ├── function_node.h │ ├── interactive_system.h │ ├── node_context.cpp │ ├── node_context.h │ ├── node_interface.cpp │ ├── node_interface.h │ ├── node_structure.h │ ├── parameter_node.h │ ├── port.h │ ├── real_time_buffer.cpp │ ├── real_time_buffer.h │ ├── real_time_simulation.h │ ├── simulation.h │ ├── statistic_node.h │ ├── system_node.cpp │ └── system_node.h │ └── time │ ├── time_cache.cpp │ ├── time_cache.h │ ├── time_point.cpp │ ├── time_point.h │ ├── time_queue.cpp │ ├── time_queue.h │ ├── time_sequence.cpp │ └── time_sequence.h └── test ├── regression_tests ├── main.cpp ├── regression_test.cpp ├── regression_test.h └── regression_test_data │ ├── output_of_agentbased_systems.txt │ ├── output_of_basic_systems.txt │ ├── output_of_building7m.txt │ ├── output_of_cellular_systems.txt │ ├── output_of_customs.txt │ ├── output_of_data_systems.txt │ ├── output_of_hello_systems.txt │ ├── output_of_prediction.txt │ ├── output_of_queueing.txt │ ├── output_of_sorting_systems.txt │ ├── output_of_subtyping.txt │ └── output_of_workers.txt └── unit_tests ├── Catch2-2.13.9 ├── .clang-format ├── .conan │ ├── build.py │ └── test_package │ │ ├── CMakeLists.txt │ │ ├── conanfile.py │ │ └── test_package.cpp ├── .gitattributes ├── .github │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.md │ │ └── feature_request.md │ └── pull_request_template.md ├── .gitignore ├── .travis.yml ├── BUILD.bazel ├── CMake │ ├── Catch2Config.cmake.in │ ├── FindGcov.cmake │ ├── FindLcov.cmake │ ├── Findcodecov.cmake │ ├── MiscFunctions.cmake │ ├── catch2.pc.in │ └── llvm-cov-wrapper ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── README.md ├── WORKSPACE ├── appveyor.yml ├── artwork │ ├── catch2-c-logo.png │ ├── catch2-hand-logo.png │ └── catch2-logo-small.png ├── codecov.yml ├── conanfile.py ├── contrib │ ├── Catch.cmake │ ├── CatchAddTests.cmake │ ├── ParseAndAddCatchTests.cmake │ ├── gdbinit │ └── lldbinit ├── docs │ ├── Readme.md │ ├── assertions.md │ ├── benchmarks.md │ ├── ci-and-misc.md │ ├── cmake-integration.md │ ├── command-line.md │ ├── commercial-users.md │ ├── configuration.md │ ├── contributing.md │ ├── deprecations.md │ ├── event-listeners.md │ ├── generators.md │ ├── limitations.md │ ├── list-of-examples.md │ ├── logging.md │ ├── matchers.md │ ├── opensource-users.md │ ├── other-macros.md │ ├── own-main.md │ ├── release-notes.md │ ├── release-process.md │ ├── reporters.md │ ├── slow-compiles.md │ ├── test-cases-and-sections.md │ ├── test-fixtures.md │ ├── tostring.md │ ├── tutorial.md │ └── why-catch.md ├── examples │ ├── 000-CatchMain.cpp │ ├── 010-TestCase.cpp │ ├── 020-TestCase-1.cpp │ ├── 020-TestCase-2.cpp │ ├── 030-Asn-Require-Check.cpp │ ├── 100-Fix-Section.cpp │ ├── 110-Fix-ClassFixture.cpp │ ├── 120-Bdd-ScenarioGivenWhenThen.cpp │ ├── 200-Rpt-CatchMain.cpp │ ├── 207-Rpt-TeamCityReporter.cpp │ ├── 210-Evt-EventListeners.cpp │ ├── 231-Cfg-OutputStreams.cpp │ ├── 300-Gen-OwnGenerator.cpp │ ├── 301-Gen-MapTypeConversion.cpp │ ├── 302-Gen-Table.cpp │ ├── 310-Gen-VariablesInGenerators.cpp │ ├── 311-Gen-CustomCapture.cpp │ └── CMakeLists.txt ├── include │ ├── catch.hpp │ ├── catch_with_main.hpp │ ├── external │ │ └── clara.hpp │ ├── internal │ │ ├── benchmark │ │ │ ├── catch_benchmark.hpp │ │ │ ├── catch_benchmarking_all.hpp │ │ │ ├── catch_chronometer.hpp │ │ │ ├── catch_clock.hpp │ │ │ ├── catch_constructor.hpp │ │ │ ├── catch_environment.hpp │ │ │ ├── catch_estimate.hpp │ │ │ ├── catch_execution_plan.hpp │ │ │ ├── catch_optimizer.hpp │ │ │ ├── catch_outlier_classification.hpp │ │ │ ├── catch_sample_analysis.hpp │ │ │ └── detail │ │ │ │ ├── catch_analyse.hpp │ │ │ │ ├── catch_benchmark_function.hpp │ │ │ │ ├── catch_complete_invoke.hpp │ │ │ │ ├── catch_estimate_clock.hpp │ │ │ │ ├── catch_measure.hpp │ │ │ │ ├── catch_repeat.hpp │ │ │ │ ├── catch_run_for_at_least.hpp │ │ │ │ ├── catch_stats.cpp │ │ │ │ ├── catch_stats.hpp │ │ │ │ └── catch_timing.hpp │ │ ├── catch_approx.cpp │ │ ├── catch_approx.h │ │ ├── catch_assertionhandler.cpp │ │ ├── catch_assertionhandler.h │ │ ├── catch_assertioninfo.h │ │ ├── catch_assertionresult.cpp │ │ ├── catch_assertionresult.h │ │ ├── catch_capture.hpp │ │ ├── catch_capture_matchers.cpp │ │ ├── catch_capture_matchers.h │ │ ├── catch_clara.h │ │ ├── catch_commandline.cpp │ │ ├── catch_commandline.h │ │ ├── catch_common.cpp │ │ ├── catch_common.h │ │ ├── catch_compiler_capabilities.h │ │ ├── catch_config.cpp │ │ ├── catch_config.hpp │ │ ├── catch_config_uncaught_exceptions.hpp │ │ ├── catch_console_colour.cpp │ │ ├── catch_console_colour.h │ │ ├── catch_context.cpp │ │ ├── catch_context.h │ │ ├── catch_debug_console.cpp │ │ ├── catch_debug_console.h │ │ ├── catch_debugger.cpp │ │ ├── catch_debugger.h │ │ ├── catch_decomposer.cpp │ │ ├── catch_decomposer.h │ │ ├── catch_default_main.hpp │ │ ├── catch_enforce.cpp │ │ ├── catch_enforce.h │ │ ├── catch_enum_values_registry.cpp │ │ ├── catch_enum_values_registry.h │ │ ├── catch_errno_guard.cpp │ │ ├── catch_errno_guard.h │ │ ├── catch_exception_translator_registry.cpp │ │ ├── catch_exception_translator_registry.h │ │ ├── catch_external_interfaces.h │ │ ├── catch_fatal_condition.cpp │ │ ├── catch_fatal_condition.h │ │ ├── catch_generators.cpp │ │ ├── catch_generators.hpp │ │ ├── catch_generators_generic.hpp │ │ ├── catch_generators_specific.hpp │ │ ├── catch_impl.hpp │ │ ├── catch_interfaces_capture.cpp │ │ ├── catch_interfaces_capture.h │ │ ├── catch_interfaces_config.cpp │ │ ├── catch_interfaces_config.h │ │ ├── catch_interfaces_enum_values_registry.h │ │ ├── catch_interfaces_exception.cpp │ │ ├── catch_interfaces_exception.h │ │ ├── catch_interfaces_generatortracker.h │ │ ├── catch_interfaces_registry_hub.cpp │ │ ├── catch_interfaces_registry_hub.h │ │ ├── catch_interfaces_reporter.cpp │ │ ├── catch_interfaces_reporter.h │ │ ├── catch_interfaces_runner.cpp │ │ ├── catch_interfaces_runner.h │ │ ├── catch_interfaces_tag_alias_registry.h │ │ ├── catch_interfaces_testcase.cpp │ │ ├── catch_interfaces_testcase.h │ │ ├── catch_leak_detector.cpp │ │ ├── catch_leak_detector.h │ │ ├── catch_list.cpp │ │ ├── catch_list.h │ │ ├── catch_matchers.cpp │ │ ├── catch_matchers.h │ │ ├── catch_matchers_exception.cpp │ │ ├── catch_matchers_exception.hpp │ │ ├── catch_matchers_floating.cpp │ │ ├── catch_matchers_floating.h │ │ ├── catch_matchers_generic.cpp │ │ ├── catch_matchers_generic.hpp │ │ ├── catch_matchers_string.cpp │ │ ├── catch_matchers_string.h │ │ ├── catch_matchers_vector.h │ │ ├── catch_message.cpp │ │ ├── catch_message.h │ │ ├── catch_meta.hpp │ │ ├── catch_objc.hpp │ │ ├── catch_objc_arc.hpp │ │ ├── catch_option.hpp │ │ ├── catch_output_redirect.cpp │ │ ├── catch_output_redirect.h │ │ ├── catch_platform.h │ │ ├── catch_polyfills.cpp │ │ ├── catch_polyfills.hpp │ │ ├── catch_preprocessor.hpp │ │ ├── catch_random_number_generator.cpp │ │ ├── catch_random_number_generator.h │ │ ├── catch_reenable_warnings.h │ │ ├── catch_registry_hub.cpp │ │ ├── catch_reporter_registrars.hpp │ │ ├── catch_reporter_registry.cpp │ │ ├── catch_reporter_registry.h │ │ ├── catch_result_type.cpp │ │ ├── catch_result_type.h │ │ ├── catch_run_context.cpp │ │ ├── catch_run_context.h │ │ ├── catch_section.cpp │ │ ├── catch_section.h │ │ ├── catch_section_info.cpp │ │ ├── catch_section_info.h │ │ ├── catch_session.cpp │ │ ├── catch_session.h │ │ ├── catch_singletons.cpp │ │ ├── catch_singletons.hpp │ │ ├── catch_startup_exception_registry.cpp │ │ ├── catch_startup_exception_registry.h │ │ ├── catch_stream.cpp │ │ ├── catch_stream.h │ │ ├── catch_string_manip.cpp │ │ ├── catch_string_manip.h │ │ ├── catch_stringref.cpp │ │ ├── catch_stringref.h │ │ ├── catch_suppress_warnings.h │ │ ├── catch_tag_alias.cpp │ │ ├── catch_tag_alias.h │ │ ├── catch_tag_alias_autoregistrar.cpp │ │ ├── catch_tag_alias_autoregistrar.h │ │ ├── catch_tag_alias_registry.cpp │ │ ├── catch_tag_alias_registry.h │ │ ├── catch_test_case_info.cpp │ │ ├── catch_test_case_info.h │ │ ├── catch_test_case_registry_impl.cpp │ │ ├── catch_test_case_registry_impl.h │ │ ├── catch_test_case_tracker.cpp │ │ ├── catch_test_case_tracker.h │ │ ├── catch_test_registry.cpp │ │ ├── catch_test_registry.h │ │ ├── catch_test_spec.cpp │ │ ├── catch_test_spec.h │ │ ├── catch_test_spec_parser.cpp │ │ ├── catch_test_spec_parser.h │ │ ├── catch_text.h │ │ ├── catch_timer.cpp │ │ ├── catch_timer.h │ │ ├── catch_to_string.hpp │ │ ├── catch_tostring.cpp │ │ ├── catch_tostring.h │ │ ├── catch_totals.cpp │ │ ├── catch_totals.h │ │ ├── catch_uncaught_exceptions.cpp │ │ ├── catch_uncaught_exceptions.h │ │ ├── catch_user_interfaces.h │ │ ├── catch_version.cpp │ │ ├── catch_version.h │ │ ├── catch_wildcard_pattern.cpp │ │ ├── catch_wildcard_pattern.h │ │ ├── catch_windows_h_proxy.h │ │ ├── catch_xmlwriter.cpp │ │ └── catch_xmlwriter.h │ └── reporters │ │ ├── catch_reporter_automake.hpp │ │ ├── catch_reporter_bases.cpp │ │ ├── catch_reporter_bases.hpp │ │ ├── catch_reporter_compact.cpp │ │ ├── catch_reporter_compact.h │ │ ├── catch_reporter_console.cpp │ │ ├── catch_reporter_console.h │ │ ├── catch_reporter_junit.cpp │ │ ├── catch_reporter_junit.h │ │ ├── catch_reporter_listening.cpp │ │ ├── catch_reporter_listening.h │ │ ├── catch_reporter_sonarqube.hpp │ │ ├── catch_reporter_tap.hpp │ │ ├── catch_reporter_teamcity.hpp │ │ ├── catch_reporter_xml.cpp │ │ └── catch_reporter_xml.h ├── misc │ ├── CMakeLists.txt │ ├── appveyorBuildConfigurationScript.bat │ ├── appveyorMergeCoverageScript.py │ ├── appveyorTestRunScript.bat │ ├── coverage-helper.cpp │ └── installOpenCppCoverage.ps1 ├── projects │ ├── CMakeLists.txt │ ├── ExtraTests │ │ ├── CMakeLists.txt │ │ ├── ToDo.txt │ │ ├── X01-PrefixedMacros.cpp │ │ ├── X02-DisabledMacros.cpp │ │ ├── X03-DisabledExceptions-DefaultHandler.cpp │ │ ├── X04-DisabledExceptions-CustomHandler.cpp │ │ ├── X10-FallbackStringifier.cpp │ │ ├── X11-DisableStringification.cpp │ │ ├── X12-CustomDebugBreakMacro.cpp │ │ ├── X20-BenchmarkingMacros.cpp │ │ └── X90-WindowsHeaderInclusion.cpp │ ├── SelfTest │ │ ├── Baselines │ │ │ ├── automake.std.approved.txt │ │ │ ├── compact.sw.approved.txt │ │ │ ├── console.std.approved.txt │ │ │ ├── console.sw.approved.txt │ │ │ ├── console.swa4.approved.txt │ │ │ ├── junit.sw.approved.txt │ │ │ ├── sonarqube.sw.approved.txt │ │ │ └── xml.sw.approved.txt │ │ ├── CompileTimePerfTests │ │ │ ├── 10.tests.cpp │ │ │ ├── 100.tests.cpp │ │ │ └── All.tests.cpp │ │ ├── IntrospectiveTests │ │ │ ├── CmdLine.tests.cpp │ │ │ ├── Details.tests.cpp │ │ │ ├── GeneratorsImpl.tests.cpp │ │ │ ├── InternalBenchmark.tests.cpp │ │ │ ├── PartTracker.tests.cpp │ │ │ ├── RandomNumberGeneration.tests.cpp │ │ │ ├── String.tests.cpp │ │ │ ├── StringManip.tests.cpp │ │ │ ├── Tag.tests.cpp │ │ │ ├── ToString.tests.cpp │ │ │ └── Xml.tests.cpp │ │ ├── Misc │ │ │ ├── invalid-test-names.input │ │ │ ├── plain-old-tests.input │ │ │ └── special-characters-in-file.input │ │ ├── SurrogateCpps │ │ │ ├── catch_console_colour.cpp │ │ │ ├── catch_debugger.cpp │ │ │ ├── catch_interfaces_reporter.cpp │ │ │ ├── catch_option.cpp │ │ │ ├── catch_stream.cpp │ │ │ ├── catch_test_case_tracker.cpp │ │ │ ├── catch_test_spec.cpp │ │ │ └── catch_xmlwriter.cpp │ │ ├── TestMain.cpp │ │ ├── TimingTests │ │ │ └── Sleep.tests.cpp │ │ ├── UsageTests │ │ │ ├── Approx.tests.cpp │ │ │ ├── BDD.tests.cpp │ │ │ ├── Benchmark.tests.cpp │ │ │ ├── Class.tests.cpp │ │ │ ├── Compilation.tests.cpp │ │ │ ├── Condition.tests.cpp │ │ │ ├── Decomposition.tests.cpp │ │ │ ├── EnumToString.tests.cpp │ │ │ ├── Exception.tests.cpp │ │ │ ├── Generators.tests.cpp │ │ │ ├── Matchers.tests.cpp │ │ │ ├── Message.tests.cpp │ │ │ ├── Misc.tests.cpp │ │ │ ├── ToStringByte.tests.cpp │ │ │ ├── ToStringChrono.tests.cpp │ │ │ ├── ToStringGeneral.tests.cpp │ │ │ ├── ToStringOptional.tests.cpp │ │ │ ├── ToStringPair.tests.cpp │ │ │ ├── ToStringTuple.tests.cpp │ │ │ ├── ToStringVariant.tests.cpp │ │ │ ├── ToStringVector.tests.cpp │ │ │ ├── ToStringWhich.tests.cpp │ │ │ ├── Tricky.tests.cpp │ │ │ └── VariadicMacros.tests.cpp │ │ └── WarnAboutNoTests.cmake │ ├── TestScripts │ │ └── testRandomOrder.py │ └── XCode │ │ └── OCTest │ │ ├── OCTest │ │ ├── CatchOCTestCase.h │ │ ├── CatchOCTestCase.mm │ │ ├── Main.mm │ │ ├── OCTest.1 │ │ ├── OCTest.mm │ │ ├── TestObj.h │ │ └── TestObj.m │ │ └── catch_objc_impl.mm ├── scripts │ ├── approvalTests.py │ ├── approve.py │ ├── benchmarkCompile.py │ ├── benchmarkRunner.py │ ├── developBuild.py │ ├── embed.py │ ├── embedClara.py │ ├── extractFeaturesFromReleaseNotes.py │ ├── fixWhitespace.py │ ├── generateSingleHeader.py │ ├── majorRelease.py │ ├── minorRelease.py │ ├── patchRelease.py │ ├── releaseCommon.py │ ├── releaseNotes.py │ ├── scriptCommon.py │ ├── updateDocumentToC.py │ └── updateWandbox.py ├── single_include │ └── catch2 │ │ ├── catch.hpp │ │ ├── catch_reporter_automake.hpp │ │ ├── catch_reporter_sonarqube.hpp │ │ ├── catch_reporter_tap.hpp │ │ └── catch_reporter_teamcity.hpp ├── src │ └── catch_with_main.cpp └── third_party │ └── clara.hpp ├── main.cpp ├── test_arraynd.cpp ├── test_arraynd_operations.cpp ├── test_distance.cpp ├── test_duration.cpp ├── test_identity.cpp ├── test_quantity.cpp ├── test_real_time_buffer.cpp ├── test_scale.cpp ├── test_time_cache.cpp ├── test_time_point.cpp ├── test_time_queue.cpp └── test_time_sequence.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object Files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic Libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Compiled Static Libraries 13 | *.lai 14 | *.la 15 | *.a 16 | *.lib 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | 23 | # Environment Variables 24 | .env 25 | 26 | # OS Files 27 | .DS_Store 28 | 29 | # CMake Files 30 | CMakeCache.txt 31 | CMakeFiles 32 | CMakeScripts 33 | cmake_install.cmake 34 | install_manifest.txt 35 | 36 | # Xcode Files 37 | *.xcodeproj 38 | 39 | # Visual Studio Files 40 | *.sln 41 | *.vcxproj 42 | *.vcxproj.filters 43 | .vs/ 44 | .vscode/ 45 | 46 | # Visual C++ Cache Files 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opendb 51 | *.opensdf 52 | *.sdf 53 | *.cachefile 54 | 55 | # Visual Studio Profiler 56 | *.psess 57 | *.vsp 58 | *.vspx 59 | *.sap 60 | 61 | # Build Results 62 | [Dd]ebug/ 63 | [Dd]ebugPublic/ 64 | [Rr]elease/ 65 | [Rr]eleases/ 66 | x64/ 67 | x86/ 68 | bin/ 69 | build/ 70 | bld/ 71 | [Bb]in/ 72 | [Oo]bj/ 73 | 74 | # Generated Documentation 75 | doc/html/ 76 | 77 | # User-Specific Files 78 | *.suo 79 | *.user 80 | *.userosscache 81 | *.sln.docstates 82 | 83 | # MSTest Test Results 84 | [Tt]est[Rr]esult*/ 85 | [Bb]uild[Ll]og.* 86 | 87 | # ATL Project Build Results 88 | [Dd]ebugPS/ 89 | [Rr]eleasePS/ 90 | dlldata.c 91 | 92 | # NUNIT 93 | *.VisualState.xml 94 | TestResult.xml 95 | 96 | # DNX 97 | project.lock.json 98 | artifacts/ 99 | 100 | # Others 101 | ~$* 102 | *~ 103 | *_i.c 104 | *_p.c 105 | *_i.h 106 | *.ilk 107 | *.meta 108 | *.pch 109 | *.pdb 110 | *.pgc 111 | *.pgd 112 | *.rsp 113 | *.sbr 114 | *.tlb 115 | *.tli 116 | *.tlh 117 | *.tmp 118 | *.tmp_proj 119 | *.log 120 | *.vspscc 121 | *.vssscc 122 | .builds 123 | *.pidb 124 | *.svclog 125 | *.scc 126 | -------------------------------------------------------------------------------- /src/examples/demo/building7m/building7m.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_BUILDING7M_H_ 3 | #define SYDEVS_EXAMPLES_BUILDING7M_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace sydevs_examples { 10 | 11 | using namespace sydevs; 12 | using namespace sydevs::systems; 13 | 14 | 15 | void building7m() 16 | { 17 | std::cout << "building_closed_system" << std::endl; 18 | thermodynamic_temperature average_T = thermodynamic_temperature(); 19 | try { 20 | simulation sim(5_min, 0, std::cout); 21 | sim.top.initial_temperature.parameter.print_on_use(); 22 | sim.top.building_dynamics.weather.outdoor_temperature_output.print_on_use(); 23 | sim.process_remaining_events(); 24 | } 25 | catch (const system_node::error& e) { 26 | std::cout << "SYSTEM NODE ERROR: " << e.what() << std::endl; 27 | } 28 | catch (const std::exception& e) { 29 | std::cout << "OTHER ERROR: " << e.what() << std::endl; 30 | } 31 | } 32 | 33 | 34 | } // namespace 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/examples/demo/building7m/building7m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/sydevs/df68d706f26b25cd3a4869f3736b8504bac13cb8/src/examples/demo/building7m/building7m.png -------------------------------------------------------------------------------- /src/examples/demo/building7m/building_layout_codes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef BUILDING_LAYOUT_CODES_H_ 3 | #define BUILDING_LAYOUT_CODES_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | 11 | 12 | const int64 indoor_code = 0; // code for grid cells associated with indoor space 13 | const int64 wall_code = 1; // code for grid cells associated with walls 14 | const int64 outdoor_code = -1; // code for grid cells associated with outdoor space 15 | 16 | 17 | } // namespace 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/examples/demo/building7m/main.cpp: -------------------------------------------------------------------------------- 1 | // This "7-metre building" model integrates a simple thermodynamics model 2 | // with a single occupant moving randomly through an indoor space. It is 3 | // meant to be extended as part of the learning exercise described in the 4 | // document below: 5 | // 6 | // [project folder]/doc/SyDEVS_Tutorial.pptx 7 | 8 | #include 9 | 10 | int main(int argc, const char* argv[]) 11 | { 12 | sydevs_examples::building7m(); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/examples/demo/queueing/main.cpp: -------------------------------------------------------------------------------- 1 | // The "queueing" demonstration project provides a simple example of each of 2 | // the four types of nodes. 3 | // 4 | // Atomic node example: queueing_node.h 5 | // Function node example: plus_node.h 6 | // Composite node example: two_stage_queueing_node.h 7 | // Collection node example: parallel_queueing_node.h 8 | // 9 | // The atomic, composite, and collection node examples all have accompanying 10 | // closed systems (e.g. queueing_closed_system.h), which allow the nodes to be 11 | // tested. The function node example is tested indirectly through its inclusion 12 | // in the composite node example. 13 | 14 | #include 15 | 16 | int main(int argc, const char* argv[]) 17 | { 18 | sydevs_examples::queueing(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/examples/demo/queueing/plus_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_PLUS_NODE_H_ 3 | #define SYDEVS_EXAMPLES_PLUS_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | /** 14 | * This node adds flow inputs "a" and "b" to produce flow output "c". 15 | */ 16 | template 17 | class plus_node : public function_node 18 | { 19 | public: 20 | // Constructor/Destructor: 21 | plus_node(const std::string& node_name, const node_context& external_context); 22 | virtual ~plus_node() = default; 23 | 24 | // Ports: 25 | port a_input; 26 | port b_input; 27 | port c_output; 28 | 29 | private: 30 | // Event Handlers: 31 | virtual void flow_event(); 32 | }; 33 | 34 | 35 | template 36 | inline plus_node::plus_node(const std::string& node_name, const node_context& external_context) 37 | : function_node(node_name, external_context) 38 | , a_input("a_input", external_interface()) 39 | , b_input("b_input", external_interface()) 40 | , c_output("c_output", external_interface()) 41 | { 42 | } 43 | 44 | 45 | template 46 | inline void plus_node::flow_event() 47 | { 48 | // Get the two flow input values, add them together, and assign the result 49 | // to the flow output port. 50 | const T& a = a_input.value(); 51 | const T& b = b_input.value(); 52 | T c = a + b; 53 | c_output.assign(c); 54 | } 55 | 56 | 57 | } // namespace 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/examples/demo/workers/main.cpp: -------------------------------------------------------------------------------- 1 | // The "workers" demonstration project provides a simple example of 2 | // agent-based modeling 3 | 4 | #include 5 | 6 | int main(int argc, const char* argv[]) 7 | { 8 | sydevs_examples::workers(); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/examples/demo/workers/worker_arrival_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_WORKER_ARRIVAL_NODE_H_ 3 | #define SYDEVS_EXAMPLES_WORKER_ARRIVAL_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | /** 14 | * This node generates workers with incrementing IDs at a regular interval. 15 | */ 16 | class worker_arrival_node : public atomic_node 17 | { 18 | public: 19 | // Constructor/Destructor: 20 | worker_arrival_node(const std::string& node_name, const node_context& external_context); 21 | virtual ~worker_arrival_node() = default; 22 | 23 | // Attributes: 24 | virtual scale time_precision() const { return micro; } 25 | 26 | // Ports: 27 | port worker_count_input; // number of workers 28 | port arrival_dt_input; // worker arrival duration 29 | port worker_id_output; // worker ID 30 | 31 | protected: 32 | // State Variables: 33 | int64 worker_count; // number of workers (constant) 34 | duration arrival_dt; // worker arrival duration (constant) 35 | int64 worker_id; // worker ID (incrementing) 36 | 37 | // Event Handlers: 38 | virtual duration initialization_event(); 39 | virtual duration unplanned_event(duration elapsed_dt); 40 | virtual duration planned_event(duration elapsed_dt); 41 | virtual void finalization_event(duration elapsed_dt); 42 | }; 43 | 44 | 45 | } // namespace 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/examples/demo/workers/workers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_WORKERS_H_ 3 | #define SYDEVS_EXAMPLES_WORKERS_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace sydevs_examples { 11 | 12 | using namespace sydevs; 13 | using namespace sydevs::systems; 14 | 15 | 16 | void workers(); 17 | 18 | 19 | } // namespace 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/examples/demo/workers/workplace_closed_system.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace sydevs_examples { 4 | 5 | 6 | workplace_closed_system::workplace_closed_system(const std::string& node_name, const node_context& external_context) 7 | : composite_node(node_name, external_context) 8 | , worker_count("worker_count", internal_context()) 9 | , arrival_dt("arrival_dt", internal_context()) 10 | , work_dt("work_dt", internal_context()) 11 | , break_dt("break_dt", internal_context()) 12 | , frame_dt("frame_dt", internal_context()) 13 | , ostream_ptr("ostream_ptr", internal_context()) 14 | , worker_arrival("worker_arrival", internal_context()) 15 | , workplace("workplace", internal_context()) 16 | , workplace_csv_output("workplace_csv_output", internal_context()) 17 | { 18 | // Flow Input Links: 19 | 20 | // Flow Micro Links: 21 | inner_link(worker_count.parameter, worker_arrival.worker_count_input); 22 | inner_link(arrival_dt.parameter, worker_arrival.arrival_dt_input); 23 | inner_link(work_dt.parameter, workplace.work_dt_input); 24 | inner_link(break_dt.parameter, workplace.break_dt_input); 25 | inner_link(worker_count.parameter, workplace_csv_output.worker_count_input); 26 | inner_link(frame_dt.parameter, workplace_csv_output.frame_dt_input); 27 | inner_link(ostream_ptr.parameter, workplace_csv_output.ostream_ptr_input); 28 | 29 | // Flow Output Links: 30 | 31 | // Message Input Links: 32 | 33 | // Message Micro Links: 34 | inner_link(worker_arrival.worker_id_output, workplace.arrival_input); 35 | inner_link(workplace.change_output, workplace_csv_output.change_input); 36 | 37 | // Message Output Links: 38 | } 39 | 40 | 41 | } // namespace 42 | -------------------------------------------------------------------------------- /src/examples/research/building7m_advanced/building_layout_codes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_ADVANCED_BUILDING_LAYOUT_CODES_H_ 3 | #define SYDEVS_EXAMPLES_ADVANCED_BUILDING_LAYOUT_CODES_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | 11 | 12 | const int64 indoor_code = 0; // code for grid cells associated with indoor space 13 | const int64 wall_code = 1; // code for grid cells associated with walls 14 | const int64 outdoor_code = -1; // code for grid cells associated with outdoor space 15 | 16 | 17 | } // namespace 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/examples/research/building7m_advanced/building_occupant_ids.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_ADVANCED_BUILDING_OCCUPANT_IDS_H_ 3 | #define SYDEVS_EXAMPLES_ADVANCED_BUILDING_OCCUPANT_IDS_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | 11 | 12 | class occupant_unit; 13 | 14 | using occupant_id = identity; 15 | 16 | 17 | } // namespace 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/examples/research/building7m_advanced/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::building7m(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/research/customs/customs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_CUSTOMS_H_ 3 | #define SYDEVS_EXAMPLES_CUSTOMS_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace sydevs_examples { 10 | 11 | using namespace sydevs; 12 | using namespace sydevs::systems; 13 | 14 | 15 | void customs() 16 | { 17 | try { 18 | simulation sim(12_hr, 0, std::cout); 19 | 20 | sim.top.source.item_output.print_on_use(); 21 | sim.top.kiosk_queue.item_output.print_on_use(); 22 | sim.top.kiosk_array.prototype.item_output.print_on_use(); 23 | sim.top.central_queue.prototype.item_output.print_on_use(); 24 | sim.top.booths.prototype.queue.item_output.print_on_use(); 25 | sim.top.booths.prototype.server.item_output.print_on_use(); 26 | sim.top.sink.item_output.print_on_use(); 27 | 28 | sim.top.booths.lane_creation_output.print_on_use(); 29 | sim.top.booths.lane_removal_output.print_on_use(); 30 | 31 | sim.process_remaining_events(); 32 | } 33 | catch (const system_node::error& e) { 34 | std::cout << "SYSTEM NODE ERROR: " << e.what() << std::endl; 35 | } 36 | catch (const std::exception& e) { 37 | std::cout << "OTHER ERROR: " << e.what() << std::endl; 38 | } 39 | } 40 | 41 | 42 | } // namespace 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/examples/research/customs/main.cpp: -------------------------------------------------------------------------------- 1 | // This example simulates a network of queues at a customs area 2 | // using components (sources, queues, servers, sinks) that are 3 | // robust with respect to tie-breaking. That is, if a queue feeds 4 | // into a server, and if both components undergo an event at the 5 | // same time, the simulation should progress error-free regardless 6 | // of which component's event is processed first. 7 | 8 | #include 9 | 10 | int main(int argc, const char* argv[]) 11 | { 12 | sydevs_examples::customs(); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/examples/research/prediction/main.cpp: -------------------------------------------------------------------------------- 1 | // This is the multiscale implementation of the example from the following publication: 2 | // Goldstein, Khan, Dalle, and Wainer (2017). Multiscale Representation of Simulated Time 3 | // 4 | // https://www.autodeskresearch.com/publications/multiscale-representation-simulated-time 5 | 6 | #include 7 | 8 | int main(int argc, const char* argv[]) 9 | { 10 | if (argc == 1) { 11 | sydevs_examples::prediction_system(); 12 | } 13 | else if (argc == 5) { 14 | std::string task = argv[1]; 15 | sydevs::int64 upper_scale = std::stoi(argv[2]); 16 | sydevs::int64 lower_scale = std::stoi(argv[3]); 17 | sydevs::int64 repetitions = std::stoi(argv[4]); 18 | sydevs_examples::prediction_systems(task, upper_scale, lower_scale, repetitions); 19 | } 20 | else { 21 | std::cout << "Command-line options: task upper_scale lower_scale repetitions" << std::endl; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /src/examples/research/realtime/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::realtime rt; 6 | rt.mainloop(); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/examples/research/realtime/motion_physics_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_MOTION_PHYSICS_TYPES_H_ 3 | #define SYDEVS_EXAMPLES_MOTION_PHYSICS_TYPES_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | 11 | 12 | using velocity = quantity; 13 | using acceleration = quantity; 14 | using trajectory = std::tuple; 15 | 16 | 17 | } // namespace 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/examples/research/realtime/realtime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_REALTIME_H_ 3 | #define SYDEVS_EXAMPLES_REALTIME_H_ 4 | 5 | #include 6 | #include 7 | 8 | namespace sydevs_examples { 9 | 10 | using namespace sydevs; 11 | using namespace sydevs::systems; 12 | 13 | 14 | class realtime 15 | { 16 | public: 17 | realtime(); 18 | 19 | void mainloop(); 20 | 21 | private: 22 | void observation_phase(); 23 | void interaction_phase(); 24 | 25 | void print_header(); 26 | void print_footer(); 27 | void print_frame(distance x); 28 | void print_menu(); 29 | 30 | std::unique_ptr> sim_ptr_; 31 | 32 | clock_time clock_t0_; 33 | duration t_; 34 | bool high_g_; 35 | bool fast_as_possible_; 36 | float64 t_syn_rate_; 37 | }; 38 | 39 | 40 | } // namespace 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/examples/research/subtyping/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::subtyping(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/research/subtyping/subtyping.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_SUBTYPING_H_ 3 | #define SYDEVS_EXAMPLES_SUBTYPING_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace sydevs_examples { 10 | 11 | using namespace sydevs; 12 | using namespace sydevs::systems; 13 | 14 | 15 | void subtyping() 16 | { 17 | simulation sim(30_s, 0, std::cout); 18 | sim.top.prototype.y0_input.print_on_use(); 19 | sim.top.prototype.x_input.print_on_use(); 20 | sim.top.prototype.y_output.print_on_use(); 21 | sim.top.prototype.y_final_output.print_on_use(); 22 | try { 23 | sim.process_remaining_events(); 24 | } 25 | catch (const system_node::error& e) { 26 | std::cout << "SYSTEM NODE ERROR: " << e.what() << std::endl; 27 | } 28 | catch (const std::exception& e) { 29 | std::cout << "OTHER ERROR: " << e.what() << std::endl; 30 | } 31 | } 32 | 33 | 34 | } // namespace 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/examples/test_systems/agentbased/agentbased_systems.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_AGENTBASED_SYSTEMS_H_ 3 | #define SYDEVS_EXAMPLES_AGENTBASED_SYSTEMS_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace sydevs_examples { 12 | 13 | using namespace sydevs; 14 | using namespace sydevs::systems; 15 | 16 | 17 | void agentbased_systems() 18 | { 19 | try { 20 | simulation sim(600_s, 0, std::cout); 21 | sim.top.grid_extent.print_on_event(); 22 | sim.top.grid_extent.parameter.print_on_use(); 23 | sim.top.avg_delay_dt.print_on_event(); 24 | sim.top.avg_delay_dt.parameter.print_on_use(); 25 | sim.top.invite_prob.print_on_event(); 26 | sim.top.invite_prob.parameter.print_on_use(); 27 | sim.top.print_on_event(); 28 | sim.top.agents.print_on_event(); 29 | sim.top.agents.avg_acquaintances_output.print_on_use(); 30 | sim.top.avg_acquaintances.print_on_event(); 31 | sim.process_remaining_events(); 32 | } 33 | catch (const system_node::error& e) { 34 | std::cout << "SYSTEM NODE ERROR: " << e.what() << std::endl; 35 | } 36 | catch (const std::exception& e) { 37 | std::cout << "OTHER ERROR: " << e.what() << std::endl; 38 | } 39 | } 40 | 41 | 42 | } // namespace 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/examples/test_systems/agentbased/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::agentbased_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/basic/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::basic_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/cellular/cell_function_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_CELL_FUNCTION_NODE_H_ 3 | #define SYDEVS_EXAMPLES_CELL_FUNCTION_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class cell_function_node : public function_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | cell_function_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~cell_function_node() = default; 19 | 20 | // Ports: 21 | port> coords_input; 22 | port flow_output; 23 | 24 | protected: 25 | // Event Handlers: 26 | virtual void flow_event(); 27 | }; 28 | 29 | 30 | inline cell_function_node::cell_function_node(const std::string& node_name, const node_context& external_context) 31 | : function_node(node_name, external_context) 32 | , coords_input("coords_input", external_interface()) 33 | , flow_output("flow_output", external_interface()) 34 | { 35 | } 36 | 37 | 38 | inline void cell_function_node::flow_event() 39 | { 40 | const array1d& coords = coords_input.value(); 41 | flow_output.assign(coords({0})*(coords({0}) + 1) + coords({1})*(coords({1}) + 1) + 10); 42 | } 43 | 44 | 45 | } // namespace 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/examples/test_systems/cellular/cellular_systems.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_CELLULAR_SYSTEMS_H_ 3 | #define SYDEVS_EXAMPLES_CELLULAR_SYSTEMS_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace sydevs_examples { 10 | 11 | using namespace sydevs; 12 | using namespace sydevs::systems; 13 | 14 | 15 | void cellular_systems() 16 | { 17 | try { 18 | simulation sim(1_s, 0, std::cout); 19 | sim.top.prototype.print_on_event(); 20 | sim.top.prototype.coords_input.print_on_use(); 21 | sim.top.prototype.cellspace.print_on_use(); 22 | sim.top.prototype.prototype.print_on_event(); 23 | sim.top.prototype.prototype.coords_input.print_on_use(); 24 | sim.top.prototype.prototype.flow_output.print_on_use(); 25 | sim.process_remaining_events(); 26 | } 27 | catch (const system_node::error& e) { 28 | std::cout << "SYSTEM NODE ERROR: " << e.what() << std::endl; 29 | } 30 | catch (const std::exception& e) { 31 | std::cout << "OTHER ERROR: " << e.what() << std::endl; 32 | } 33 | } 34 | 35 | 36 | } // namespace 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/examples/test_systems/cellular/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::cellular_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/data/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::data_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/hello/hello_at_init_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_HELLO_AT_INIT_NODE_H_ 3 | #define SYDEVS_EXAMPLES_HELLO_AT_INIT_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class hello_at_init_node : public atomic_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | hello_at_init_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~hello_at_init_node() = default; 19 | 20 | // Attributes: 21 | virtual scale time_precision() const { return no_scale; } 22 | 23 | // Ports: 24 | 25 | protected: 26 | // State Variables: 27 | 28 | // Event Handlers: 29 | virtual duration initialization_event(); 30 | virtual duration unplanned_event(duration elapsed_dt); 31 | virtual duration planned_event(duration elapsed_dt); 32 | virtual void finalization_event(duration elapsed_dt); 33 | }; 34 | 35 | 36 | inline hello_at_init_node::hello_at_init_node(const std::string& node_name, const node_context& external_context) 37 | : atomic_node(node_name, external_context) 38 | { 39 | } 40 | 41 | 42 | inline duration hello_at_init_node::initialization_event() 43 | { 44 | print("Hello"); 45 | 46 | return duration::inf(); 47 | } 48 | 49 | 50 | inline duration hello_at_init_node::unplanned_event(duration elapsed_dt) 51 | { 52 | return duration(); 53 | } 54 | 55 | 56 | inline duration hello_at_init_node::planned_event(duration elapsed_dt) 57 | { 58 | return duration(); 59 | } 60 | 61 | 62 | inline void hello_at_init_node::finalization_event(duration elapsed_dt) 63 | { 64 | } 65 | 66 | 67 | } // namespace 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/examples/test_systems/hello/hello_at_planned_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_HELLO_AT_PLANNED_NODE_H_ 3 | #define SYDEVS_EXAMPLES_HELLO_AT_PLANNED_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class hello_at_planned_node : public atomic_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | hello_at_planned_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~hello_at_planned_node() = default; 19 | 20 | // Attributes: 21 | virtual scale time_precision() const { return micro; } 22 | 23 | // Ports: 24 | 25 | protected: 26 | // State Variables: 27 | 28 | // Event Handlers: 29 | virtual duration initialization_event(); 30 | virtual duration unplanned_event(duration elapsed_dt); 31 | virtual duration planned_event(duration elapsed_dt); 32 | virtual void finalization_event(duration elapsed_dt); 33 | }; 34 | 35 | 36 | inline hello_at_planned_node::hello_at_planned_node(const std::string& node_name, const node_context& external_context) 37 | : atomic_node(node_name, external_context) 38 | { 39 | } 40 | 41 | 42 | inline duration hello_at_planned_node::initialization_event() 43 | { 44 | return 0_s; 45 | } 46 | 47 | 48 | inline duration hello_at_planned_node::unplanned_event(duration elapsed_dt) 49 | { 50 | return duration(); 51 | } 52 | 53 | 54 | inline duration hello_at_planned_node::planned_event(duration elapsed_dt) 55 | { 56 | print("Hello"); 57 | 58 | return 1_s; 59 | } 60 | 61 | 62 | inline void hello_at_planned_node::finalization_event(duration elapsed_dt) 63 | { 64 | } 65 | 66 | 67 | } // namespace 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/examples/test_systems/hello/hello_count_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_HELLO_COUNT_NODE_H_ 3 | #define SYDEVS_EXAMPLES_HELLO_COUNT_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class hello_count_node : public atomic_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | hello_count_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~hello_count_node() = default; 19 | 20 | // Attributes: 21 | virtual scale time_precision() const { return micro; } 22 | 23 | // Ports: 24 | 25 | protected: 26 | // State Variables: 27 | int64 count; 28 | 29 | // Event Handlers: 30 | virtual duration initialization_event(); 31 | virtual duration unplanned_event(duration elapsed_dt); 32 | virtual duration planned_event(duration elapsed_dt); 33 | virtual void finalization_event(duration elapsed_dt); 34 | }; 35 | 36 | 37 | inline hello_count_node::hello_count_node(const std::string& node_name, const node_context& external_context) 38 | : atomic_node(node_name, external_context) 39 | { 40 | } 41 | 42 | 43 | inline duration hello_count_node::initialization_event() 44 | { 45 | count = 0; 46 | return 0_s; 47 | } 48 | 49 | 50 | inline duration hello_count_node::unplanned_event(duration elapsed_dt) 51 | { 52 | return duration(); 53 | } 54 | 55 | 56 | inline duration hello_count_node::planned_event(duration elapsed_dt) 57 | { 58 | ++count; 59 | print("Hello " + tostring(count)); 60 | 61 | return 1_s; 62 | } 63 | 64 | 65 | inline void hello_count_node::finalization_event(duration elapsed_dt) 66 | { 67 | } 68 | 69 | 70 | } // namespace 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/examples/test_systems/hello/hello_poisson_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_HELLO_POISSON_NODE_H_ 3 | #define SYDEVS_EXAMPLES_HELLO_POISSON_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class hello_poisson_node : public atomic_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | hello_poisson_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~hello_poisson_node() = default; 19 | 20 | // Attributes: 21 | virtual scale time_precision() const { return micro; } 22 | 23 | // Ports: 24 | 25 | protected: 26 | // State Variables: 27 | int64 count; 28 | 29 | // Event Handlers: 30 | virtual duration initialization_event(); 31 | virtual duration unplanned_event(duration elapsed_dt); 32 | virtual duration planned_event(duration elapsed_dt); 33 | virtual void finalization_event(duration elapsed_dt); 34 | }; 35 | 36 | 37 | inline hello_poisson_node::hello_poisson_node(const std::string& node_name, const node_context& external_context) 38 | : atomic_node(node_name, external_context) 39 | { 40 | } 41 | 42 | 43 | inline duration hello_poisson_node::initialization_event() 44 | { 45 | count = 0; 46 | return 0_s; 47 | } 48 | 49 | 50 | inline duration hello_poisson_node::unplanned_event(duration elapsed_dt) 51 | { 52 | return duration(); 53 | } 54 | 55 | 56 | inline duration hello_poisson_node::planned_event(duration elapsed_dt) 57 | { 58 | static auto dist = std::exponential_distribution(1.0); 59 | 60 | ++count; 61 | print("Hello " + tostring(count)); 62 | 63 | return (dist(rng)*1_s).fixed_at(time_precision()); 64 | } 65 | 66 | 67 | inline void hello_poisson_node::finalization_event(duration elapsed_dt) 68 | { 69 | } 70 | 71 | 72 | } // namespace 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/examples/test_systems/hello/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::hello_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/sorting/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) 4 | { 5 | sydevs_examples::sorting_systems(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/examples/test_systems/sorting/sorting_2_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_SORTING_2_NODE_H_ 3 | #define SYDEVS_EXAMPLES_SORTING_2_NODE_H_ 4 | 5 | #include 6 | 7 | namespace sydevs_examples { 8 | 9 | using namespace sydevs; 10 | using namespace sydevs::systems; 11 | 12 | 13 | class sorting_2_node : public function_node 14 | { 15 | public: 16 | // Constructor/Destructor: 17 | sorting_2_node(const std::string& node_name, const node_context& external_context); 18 | virtual ~sorting_2_node() = default; 19 | 20 | // Ports: 21 | port a_input; 22 | port b_input; 23 | port a_output; 24 | port b_output; 25 | 26 | protected: 27 | // Event Handlers: 28 | virtual void flow_event(); 29 | }; 30 | 31 | 32 | inline sorting_2_node::sorting_2_node(const std::string& node_name, const node_context& external_context) 33 | : function_node(node_name, external_context) 34 | , a_input("a_input", external_interface()) 35 | , b_input("b_input", external_interface()) 36 | , a_output("a_output", external_interface()) 37 | , b_output("b_output", external_interface()) 38 | { 39 | } 40 | 41 | 42 | inline void sorting_2_node::flow_event() 43 | { 44 | int64 a = a_input.value(); 45 | int64 b = b_input.value(); 46 | if (a <= b) { 47 | a_output.assign(a); 48 | b_output.assign(b); 49 | } 50 | else { 51 | a_output.assign(b); 52 | b_output.assign(a); 53 | } 54 | } 55 | 56 | 57 | } // namespace 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/examples/test_systems/sorting/sorting_4_test_node.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_EXAMPLES_SORTING_4_TEST_NODE_H_ 3 | #define SYDEVS_EXAMPLES_SORTING_4_TEST_NODE_H_ 4 | 5 | #include 6 | #include 7 | 8 | namespace sydevs_examples { 9 | 10 | using namespace sydevs; 11 | using namespace sydevs::systems; 12 | 13 | 14 | class sorting_4_test_node : public composite_node 15 | { 16 | public: 17 | // Constructor/Destructor: 18 | sorting_4_test_node(const std::string& node_name, const node_context& external_context); 19 | virtual ~sorting_4_test_node() = default; 20 | 21 | // Ports: 22 | 23 | // Components: 24 | parameter_node a_parameter; 25 | parameter_node b_parameter; 26 | parameter_node c_parameter; 27 | parameter_node d_parameter; 28 | sorting_4_node sorter; 29 | }; 30 | 31 | 32 | sorting_4_test_node::sorting_4_test_node(const std::string& node_name, const node_context& external_context) 33 | : composite_node(node_name, external_context) 34 | , a_parameter("a_parameter", internal_context(), 3) 35 | , b_parameter("b_parameter", internal_context(), 2) 36 | , c_parameter("c_parameter", internal_context(), 4) 37 | , d_parameter("d_parameter", internal_context(), 1) 38 | , sorter("sorter", internal_context()) 39 | { 40 | // Flow Links 41 | inner_link(a_parameter.parameter, sorter.a_input); 42 | inner_link(b_parameter.parameter, sorter.b_input); 43 | inner_link(c_parameter.parameter, sorter.c_input); 44 | inner_link(d_parameter.parameter, sorter.d_input); 45 | } 46 | 47 | 48 | } // namespace 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/sydevs/core/number_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_NUMBER_TYPES_H_ 3 | #define SYDEVS_NUMBER_TYPES_H_ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace sydevs { 10 | 11 | 12 | using int8 = int8_t; 13 | using int16 = int16_t; 14 | using int32 = int32_t; 15 | using int64 = int64_t; 16 | 17 | using uint8 = uint8_t; 18 | using uint16 = uint16_t; 19 | using uint32 = uint32_t; 20 | using uint64 = uint64_t; 21 | 22 | using float32 = float; 23 | using float64 = double; 24 | 25 | const float64 pi = 3.14159265358979323846; 26 | 27 | 28 | } // namespace 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/sydevs/systems/atomic_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace sydevs { 4 | namespace systems { 5 | 6 | 7 | duration atomic_node::handle_initialization_event() 8 | { 9 | if (initialized_) throw std::logic_error("Attempt to initialize atomic node (" + full_name() + ") more than once"); 10 | ET().start(); 11 | auto dt = initialization_event(); 12 | ET().stop(); 13 | auto planned_dt = scale_planned_dt(dt); 14 | external_IO().print_planned_duration(planned_dt); 15 | initialized_ = true; 16 | return planned_dt; 17 | } 18 | 19 | 20 | duration atomic_node::handle_unplanned_event(duration elapsed_dt) 21 | { 22 | external_IO().print_elapsed_duration(elapsed_dt); 23 | ET().start(); 24 | auto dt = unplanned_event(elapsed_dt); 25 | ET().stop(); 26 | auto planned_dt = scale_planned_dt(dt); 27 | external_IO().print_planned_duration(planned_dt); 28 | return planned_dt; 29 | } 30 | 31 | 32 | duration atomic_node::handle_planned_event(duration elapsed_dt) 33 | { 34 | external_IO().print_elapsed_duration(elapsed_dt); 35 | ET().start(); 36 | auto dt = planned_event(elapsed_dt); 37 | ET().stop(); 38 | auto planned_dt = scale_planned_dt(dt); 39 | external_IO().print_planned_duration(planned_dt); 40 | return planned_dt; 41 | } 42 | 43 | 44 | void atomic_node::handle_finalization_event(duration elapsed_dt) 45 | { 46 | if (finalized_) throw std::logic_error("Attempt to finalize atomic node (" + full_name() + ") more than once"); 47 | external_IO().print_elapsed_duration(elapsed_dt); 48 | ET().start(); 49 | finalization_event(elapsed_dt); 50 | ET().stop(); 51 | finalized_ = true; 52 | } 53 | 54 | 55 | } // namespace 56 | } // namespace 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/sydevs/systems/data_goal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace sydevs { 6 | namespace systems { 7 | 8 | 9 | const std::array data_goals = { 10 | data_goal::input, 11 | data_goal::output, 12 | }; 13 | 14 | 15 | const std::array data_goal_strings = { 16 | "input", 17 | "output", 18 | }; 19 | 20 | 21 | const std::string& string_from_data_goal(data_goal dgoal) 22 | { 23 | return data_goal_strings[int64_from_data_goal(dgoal)]; 24 | } 25 | 26 | 27 | data_goal data_goal_from_string(const std::string& dgoal_string) 28 | { 29 | auto iter = std::find(std::begin(data_goal_strings), std::end(data_goal_strings), dgoal_string); 30 | if (iter == std::end(data_goal_strings)) throw std::out_of_range("Unrecognized data goal string: " + dgoal_string); 31 | return data_goals[iter - std::begin(data_goal_strings)]; 32 | } 33 | 34 | 35 | } // namespace 36 | } // namespace 37 | -------------------------------------------------------------------------------- /src/sydevs/systems/data_goal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_SYSTEMS_DATA_GOAL_H_ 3 | #define SYDEVS_SYSTEMS_DATA_GOAL_H_ 4 | 5 | #include 6 | #include 7 | 8 | namespace sydevs { 9 | namespace systems { 10 | 11 | 12 | /** 13 | * @brief Indicates whether data is meant to serve as `input` or `output`. 14 | */ 15 | enum class data_goal : int8 { 16 | input, ///< Indicates input data. 17 | output, ///< Indicates output data. 18 | }; 19 | 20 | 21 | const auto input = data_goal::input; ///< Equivalent to `data_goal::input`. 22 | const auto output = data_goal::output; ///< Equivalent to `data_goal::output`. 23 | 24 | 25 | const std::string& string_from_data_goal(data_goal dgoal); ///< Returns the `std::string` representation of the `dgoal` value. 26 | 27 | data_goal data_goal_from_string(const std::string& dgoal_string); ///< Returns the `data_goal` value indicated by `dmode_string`. 28 | 29 | 30 | /** 31 | * @brief Returns the integer representation of the `dgoal` value. 32 | */ 33 | inline constexpr int64 int64_from_data_goal(data_goal dgoal) 34 | { 35 | return static_cast::type>(dgoal); 36 | } 37 | 38 | 39 | } // namespace 40 | } // namespace 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/sydevs/systems/data_mode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace sydevs { 6 | namespace systems { 7 | 8 | 9 | const std::array data_modes = { 10 | data_mode::flow, 11 | data_mode::message, 12 | }; 13 | 14 | 15 | const std::array data_mode_strings = { 16 | "flow", 17 | "message", 18 | }; 19 | 20 | 21 | const std::string& string_from_data_mode(data_mode dmode) 22 | { 23 | return data_mode_strings[int64_from_data_mode(dmode)]; 24 | } 25 | 26 | 27 | data_mode data_mode_from_string(const std::string& dmode_string) 28 | { 29 | auto iter = std::find(std::begin(data_mode_strings), std::end(data_mode_strings), dmode_string); 30 | if (iter == std::end(data_mode_strings)) throw std::out_of_range("Unrecognized data mode string: " + dmode_string); 31 | return data_modes[iter - std::begin(data_mode_strings)]; 32 | } 33 | 34 | 35 | } // namespace 36 | } // namespace 37 | -------------------------------------------------------------------------------- /src/sydevs/systems/data_mode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SYDEVS_SYSTEMS_DATA_MODE_H_ 3 | #define SYDEVS_SYSTEMS_DATA_MODE_H_ 4 | 5 | #include 6 | #include 7 | 8 | namespace sydevs { 9 | namespace systems { 10 | 11 | 12 | /** 13 | * @brief Indicates the relevant data communication paradigm: dataflow (`flow`) 14 | * or message-passing (`message`). 15 | */ 16 | enum class data_mode : int8 { 17 | flow, ///< Indicates dataflow. 18 | message, ///< Indicates message-passing. 19 | }; 20 | 21 | 22 | const auto flow = data_mode::flow; ///< Equivalent to `data_mode::flow`. 23 | const auto message = data_mode::message; ///< Equivalent to `data_mode::message`. 24 | 25 | 26 | const std::string& string_from_data_mode(data_mode dmode); ///< Returns the `std::string` representation of the `dmode` value. 27 | 28 | data_mode data_mode_from_string(const std::string& dmode_string); ///< Returns the `data_mode` value indicated by `dmode_string`. 29 | 30 | 31 | /** 32 | * @brief Returns the integer representation of the `dmode` value. 33 | */ 34 | inline constexpr int64 int64_from_data_mode(data_mode dmode) 35 | { 36 | return static_cast::type>(dmode); 37 | } 38 | 39 | 40 | } // namespace 41 | } // namespace 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /test/regression_tests/regression_test.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef REGRESSION_TEST_H_ 3 | #define REGRESSION_TEST_H_ 4 | 5 | #include 6 | #include 7 | 8 | 9 | int perform_regression_test(const std::string& filename, std::function test_function); 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /test/regression_tests/regression_test_data/output_of_sorting_systems.txt: -------------------------------------------------------------------------------- 1 | sorting_4_test_node 2 | 0|0|$time:time_point() 3 | 0|1|top.a_parameter#parameter:3 4 | 0|2|top.b_parameter#parameter:2 5 | 0|3|top.c_parameter#parameter:4 6 | 0|4|top.d_parameter#parameter:1 7 | 0|7|top.sorter.A.A#a_output:2 8 | 0|7|top.sorter.A.A#b_output:3 9 | 0|8|top.sorter.A.B#a_output:3 10 | 0|8|top.sorter.A.B#b_output:4 11 | 0|9|top.sorter.A.C#a_output:2 12 | 0|9|top.sorter.A.C#b_output:3 13 | 0|10|top.sorter.A#a_output:2 14 | 0|10|top.sorter.A#b_output:3 15 | 0|10|top.sorter.A#c_output:4 16 | 0|11|top.sorter.B#a_output:1 17 | 0|11|top.sorter.B#b_output:4 18 | 0|12|top.sorter.C#a_output:1 19 | 0|12|top.sorter.C#b_output:3 20 | 0|13|top.sorter.D#a_output:1 21 | 0|13|top.sorter.D#b_output:2 22 | 0|14|top.sorter#a_output:1 23 | 0|14|top.sorter#b_output:2 24 | 0|14|top.sorter#c_output:3 25 | 0|14|top.sorter#d_output:4 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AccessModifierOffset: '-4' 3 | AlignEscapedNewlines: Left 4 | AllowAllConstructorInitializersOnNextLine: 'true' 5 | BinPackArguments: 'false' 6 | BinPackParameters: 'false' 7 | BreakConstructorInitializers: AfterColon 8 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' 9 | DerivePointerAlignment: 'false' 10 | FixNamespaceComments: 'true' 11 | IncludeBlocks: Regroup 12 | IndentCaseLabels: 'false' 13 | IndentPPDirectives: AfterHash 14 | IndentWidth: '4' 15 | Language: Cpp 16 | NamespaceIndentation: All 17 | PointerAlignment: Left 18 | SpaceBeforeCtorInitializerColon: 'false' 19 | SpaceInEmptyParentheses: 'false' 20 | SpacesInParentheses: 'true' 21 | Standard: Cpp11 22 | TabWidth: '4' 23 | UseTab: Never 24 | 25 | ... 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.conan/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2.0) 2 | project(test_package CXX) 3 | 4 | include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) 5 | conan_basic_setup(TARGETS) 6 | 7 | find_package(Catch2 REQUIRED CONFIG) 8 | 9 | add_executable(${PROJECT_NAME} test_package.cpp) 10 | target_link_libraries(${PROJECT_NAME} CONAN_PKG::Catch2) 11 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) 12 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.conan/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from conans import ConanFile, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "compiler", "build_type", "arch" 9 | generators = "cmake" 10 | 11 | def build(self): 12 | cmake = CMake(self) 13 | cmake.configure() 14 | cmake.build() 15 | 16 | def test(self): 17 | assert os.path.isfile(os.path.join(self.deps_cpp_info["Catch2"].rootpath, "licenses", "LICENSE.txt")) 18 | bin_path = os.path.join("bin", "test_package") 19 | self.run("%s -s" % bin_path, run_environment=True) 20 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.conan/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | 3 | #include 4 | 5 | int Factorial( int number ) { 6 | return number <= 1 ? 1 : Factorial( number - 1 ) * number; 7 | } 8 | 9 | TEST_CASE( "Factorial Tests", "[single-file]" ) { 10 | REQUIRE( Factorial(0) == 1 ); 11 | REQUIRE( Factorial(1) == 1 ); 12 | REQUIRE( Factorial(2) == 2 ); 13 | REQUIRE( Factorial(3) == 6 ); 14 | REQUIRE( Factorial(10) == 3628800 ); 15 | } -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.gitattributes: -------------------------------------------------------------------------------- 1 | # This sets the default behaviour, overriding core.autocrlf 2 | * text=auto 3 | 4 | # All source files should have unix line-endings in the repository, 5 | # but convert to native line-endings on checkout 6 | *.cpp text 7 | *.h text 8 | *.hpp text 9 | 10 | # Windows specific files should retain windows line-endings 11 | *.sln text eol=crlf 12 | 13 | # Keep executable scripts with LFs so they can be run after being 14 | # checked out on Windows 15 | *.py text eol=lf 16 | 17 | 18 | # Keep the single include header with LFs to make sure it is uploaded, 19 | # hashed etc with LF 20 | single_include/**/*.hpp eol=lf 21 | # Also keep the LICENCE file with LFs for the same reason 22 | LICENCE.txt eol=lf 23 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: "https://www.paypal.me/horenmar" 2 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create an issue that documents a bug 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Expected behavior** 14 | A clear and concise description of what you expected to happen. 15 | 16 | **Reproduction steps** 17 | Steps to reproduce the bug. 18 | 19 | 20 | 21 | **Platform information:** 22 | 23 | - OS: **Windows NT** 24 | - Compiler+version: **GCC v2.9.5** 25 | - Catch version: **v1.2.3** 26 | 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Create an issue that requests a feature or other improvement 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Description** 11 | Describe the feature/change you request and why do you want it. 12 | 13 | **Additional context** 14 | Add any other context or screenshots about the feature request here. 15 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ## Description 12 | 18 | 19 | ## GitHub Issues 20 | 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/.gitignore: -------------------------------------------------------------------------------- 1 | *.build 2 | *.pbxuser 3 | *.mode1v3 4 | *.ncb 5 | *.suo 6 | Debug 7 | Release 8 | *.user 9 | *.xcuserstate 10 | .DS_Store 11 | xcuserdata 12 | CatchSelfTest.xcscheme 13 | Breakpoints.xcbkptlist 14 | projects/VS2010/TestCatch/_UpgradeReport_Files/ 15 | projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters 16 | projects/VisualStudio/TestCatch/UpgradeLog.XML 17 | projects/CMake/.idea 18 | projects/CMake/cmake-build-debug 19 | UpgradeLog.XML 20 | Resources/DWARF 21 | projects/Generated 22 | *.pyc 23 | DerivedData 24 | *.xccheckout 25 | Build 26 | .idea 27 | .vs 28 | cmake-build-* 29 | benchmark-dir 30 | .conan/test_package/build 31 | bazel-* 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # Load the cc_library rule. 2 | load("@rules_cc//cc:defs.bzl", "cc_library") 3 | 4 | # Header-only rule to export catch2/catch.hpp. 5 | cc_library( 6 | name = "catch2", 7 | hdrs = ["single_include/catch2/catch.hpp"], 8 | includes = ["single_include/"], 9 | visibility = ["//visibility:public"], 10 | ) 11 | 12 | cc_library( 13 | name = "catch2_with_main", 14 | srcs = ["src/catch_with_main.cpp"], 15 | visibility = ["//visibility:public"], 16 | deps = ["//:catch2"], 17 | ) 18 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/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 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/CMake/MiscFunctions.cmake: -------------------------------------------------------------------------------- 1 | #checks that the given hard-coded list contains all headers + sources in the given folder 2 | function(CheckFileList LIST_VAR FOLDER) 3 | set(MESSAGE " should be added to the variable ${LIST_VAR}") 4 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") 5 | file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp" 6 | "${FOLDER}/*.hpp" 7 | "${FOLDER}/*.h") 8 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) 9 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) 10 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") 11 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") 12 | endforeach() 13 | endfunction() 14 | 15 | function(CheckFileListRec LIST_VAR FOLDER) 16 | set(MESSAGE " should be added to the variable ${LIST_VAR}") 17 | set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") 18 | file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp" 19 | "${FOLDER}/*.hpp" 20 | "${FOLDER}/*.h") 21 | list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) 22 | foreach(EXTRA_ITEM ${GLOBBED_LIST}) 23 | string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") 24 | message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") 25 | endforeach() 26 | endfunction() 27 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/CMake/catch2.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: Catch2 7 | Description: A modern, C++-native, header-only, test framework for C++11 8 | URL: https://github.com/catchorg/Catch2 9 | Version: @Catch2_VERSION@ 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/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 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/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 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/WORKSPACE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/sydevs/df68d706f26b25cd3a4869f3736b8504bac13cb8/test/unit_tests/Catch2-2.13.9/WORKSPACE -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/artwork/catch2-c-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/sydevs/df68d706f26b25cd3a4869f3736b8504bac13cb8/test/unit_tests/Catch2-2.13.9/artwork/catch2-c-logo.png -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/artwork/catch2-hand-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/sydevs/df68d706f26b25cd3a4869f3736b8504bac13cb8/test/unit_tests/Catch2-2.13.9/artwork/catch2-hand-logo.png -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/artwork/catch2-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Autodesk/sydevs/df68d706f26b25cd3a4869f3736b8504bac13cb8/test/unit_tests/Catch2-2.13.9/artwork/catch2-logo-small.png -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: nearest 4 | range: "60...90" 5 | status: 6 | project: 7 | default: 8 | threshold: 2% 9 | patch: 10 | default: 11 | target: 80% 12 | ignore: 13 | - "projects/SelfTest" 14 | - "**/catch_reporter_tap.hpp" 15 | - "**/catch_reporter_automake.hpp" 16 | - "**/catch_reporter_teamcity.hpp" 17 | - "**/catch_reporter_sonarqube.hpp" 18 | - "**/external/clara.hpp" 19 | 20 | 21 | codecov: 22 | branch: v2.x 23 | 24 | comment: 25 | layout: "diff" 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/conanfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from conans import ConanFile, CMake 3 | 4 | 5 | class CatchConan(ConanFile): 6 | name = "Catch2" 7 | description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" 8 | topics = ("conan", "catch2", "header-only", "unit-test", "tdd", "bdd") 9 | url = "https://github.com/catchorg/Catch2" 10 | homepage = url 11 | license = "BSL-1.0" 12 | exports = "LICENSE.txt" 13 | exports_sources = ("single_include/*", "CMakeLists.txt", "CMake/*", "contrib/*", "src/*") 14 | generators = "cmake" 15 | 16 | def package(self): 17 | cmake = CMake(self) 18 | cmake.definitions["BUILD_TESTING"] = "OFF" 19 | cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF" 20 | cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON" 21 | cmake.configure(build_folder='build') 22 | cmake.install() 23 | 24 | self.copy(pattern="LICENSE.txt", dst="licenses") 25 | 26 | def package_id(self): 27 | self.info.header_only() 28 | 29 | def package_info(self): 30 | self.cpp_info.builddirs.append("lib/cmake/Catch2") 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/contrib/gdbinit: -------------------------------------------------------------------------------- 1 | # 2 | # This file provides a way to skip stepping into Catch code when debugging with gdb. 3 | # 4 | # With the gdb "skip" command you can tell gdb to skip files or functions during debugging. 5 | # see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example 6 | # 7 | # Basically the following line tells gdb to skip all functions containing the 8 | # regexp "Catch", which matches the complete Catch namespace. 9 | # If you want to skip just some parts of the Catch code you can modify the 10 | # regexp accordingly. 11 | # 12 | # If you want to permanently skip stepping into Catch code copy the following 13 | # line into your ~/.gdbinit file 14 | # 15 | 16 | skip -rfu Catch 17 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/contrib/lldbinit: -------------------------------------------------------------------------------- 1 | # 2 | # This file provides a way to skip stepping into Catch code when debugging with lldb. 3 | # 4 | # With the setting "target.process.thread.step-avoid-regexp" you can tell lldb 5 | # to skip functions matching the regexp 6 | # 7 | # Basically the following line tells lldb to skip all functions containing the 8 | # regexp "Catch", which matches the complete Catch namespace. 9 | # If you want to skip just some parts of the Catch code you can modify the 10 | # regexp accordingly. 11 | # 12 | # If you want to permanently skip stepping into Catch code copy the following 13 | # line into your ~/.lldbinit file 14 | # 15 | 16 | settings set target.process.thread.step-avoid-regexp Catch -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/docs/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Reference 3 | 4 | To get the most out of Catch2, start with the [tutorial](tutorial.md#top). 5 | Once you're up and running consider the following reference material. 6 | 7 | Writing tests: 8 | * [Assertion macros](assertions.md#top) 9 | * [Matchers](matchers.md#top) 10 | * [Logging macros](logging.md#top) 11 | * [Test cases and sections](test-cases-and-sections.md#top) 12 | * [Test fixtures](test-fixtures.md#top) 13 | * [Reporters](reporters.md#top) 14 | * [Event Listeners](event-listeners.md#top) 15 | * [Data Generators](generators.md#top) 16 | * [Other macros](other-macros.md#top) 17 | * [Micro benchmarking](benchmarks.md#top) 18 | 19 | Fine tuning: 20 | * [Supplying your own main()](own-main.md#top) 21 | * [Compile-time configuration](configuration.md#top) 22 | * [String Conversions](tostring.md#top) 23 | 24 | Running: 25 | * [Command line](command-line.md#top) 26 | 27 | Odds and ends: 28 | * [CMake integration](cmake-integration.md#top) 29 | * [CI and other miscellaneous pieces](ci-and-misc.md#top) 30 | 31 | FAQ: 32 | * [Why are my tests slow to compile?](slow-compiles.md#top) 33 | * [Known limitations](limitations.md#top) 34 | 35 | Other: 36 | * [Why Catch?](why-catch.md#top) 37 | * [Open Source Projects using Catch](opensource-users.md#top) 38 | * [Commercial Projects using Catch](commercial-users.md#top) 39 | * [Contributing](contributing.md#top) 40 | * [Release Notes](release-notes.md#top) 41 | * [Deprecations and incoming changes](deprecations.md#top) 42 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/docs/commercial-users.md: -------------------------------------------------------------------------------- 1 | 2 | # Commercial users of Catch 3 | 4 | As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too. 5 | Many organisations like to keep this information internal, and that's fine, 6 | but if you're more open it would be great if we could list the names of as 7 | many organisations as possible that use Catch somewhere in their codebase. 8 | Enterprise environments often tend to be far more conservative in their tool adoption - 9 | and being aware that other companies are using Catch can ease the path in. 10 | 11 | So if you are aware of Catch usage in your organisation, and are fairly confident there is no issue with sharing this 12 | fact then please let us know - either directly, via a PR or 13 | [issue](https://github.com/philsquared/Catch/issues), or on the [forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum). 14 | 15 | - Bloomberg 16 | - [Bloomlife](https://bloomlife.com) 17 | - NASA 18 | - [Inscopix Inc.](https://www.inscopix.com/) 19 | - [Makimo](https://makimo.pl/) 20 | - [UX3D](https://ux3d.io) 21 | - [King](https://king.com) 22 | 23 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/000-CatchMain.cpp: -------------------------------------------------------------------------------- 1 | // 000-CatchMain.cpp 2 | 3 | // In a Catch project with multiple files, dedicate one file to compile the 4 | // source code of Catch itself and reuse the resulting object file for linking. 5 | 6 | // Let Catch provide main(): 7 | #define CATCH_CONFIG_MAIN 8 | 9 | #include 10 | 11 | // That's it 12 | 13 | // Compile implementation of Catch for use with files that do contain tests: 14 | // - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 000-CatchMain.cpp 15 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 000-CatchMain.cpp 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/010-TestCase.cpp: -------------------------------------------------------------------------------- 1 | // 010-TestCase.cpp 2 | 3 | // Let Catch provide main(): 4 | #define CATCH_CONFIG_MAIN 5 | 6 | #include 7 | 8 | int Factorial( int number ) { 9 | return number <= 1 ? number : Factorial( number - 1 ) * number; // fail 10 | // return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass 11 | } 12 | 13 | TEST_CASE( "Factorial of 0 is 1 (fail)", "[single-file]" ) { 14 | REQUIRE( Factorial(0) == 1 ); 15 | } 16 | 17 | TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) { 18 | REQUIRE( Factorial(1) == 1 ); 19 | REQUIRE( Factorial(2) == 2 ); 20 | REQUIRE( Factorial(3) == 6 ); 21 | REQUIRE( Factorial(10) == 3628800 ); 22 | } 23 | 24 | // Compile & run: 25 | // - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success 26 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 010-TestCase.cpp && 010-TestCase --success 27 | 28 | // Expected compact output (all assertions): 29 | // 30 | // prompt> 010-TestCase --reporter compact --success 31 | // 010-TestCase.cpp:14: failed: Factorial(0) == 1 for: 0 == 1 32 | // 010-TestCase.cpp:18: passed: Factorial(1) == 1 for: 1 == 1 33 | // 010-TestCase.cpp:19: passed: Factorial(2) == 2 for: 2 == 2 34 | // 010-TestCase.cpp:20: passed: Factorial(3) == 6 for: 6 == 6 35 | // 010-TestCase.cpp:21: passed: Factorial(10) == 3628800 for: 3628800 (0x375f00) == 3628800 (0x375f00) 36 | // Failed 1 test case, failed 1 assertion. 37 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/020-TestCase-1.cpp: -------------------------------------------------------------------------------- 1 | // 020-TestCase-1.cpp 2 | 3 | // In a Catch project with multiple files, dedicate one file to compile the 4 | // source code of Catch itself and reuse the resulting object file for linking. 5 | 6 | // Let Catch provide main(): 7 | #define CATCH_CONFIG_MAIN 8 | 9 | #include 10 | 11 | TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) { 12 | } 13 | 14 | // ^^^ 15 | // Normally no TEST_CASEs in this file. 16 | // Here just to show there are two source files via option --list-tests. 17 | 18 | // Compile & run: 19 | // - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp 20 | // - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success 21 | // 22 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp 23 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success 24 | 25 | // Expected test case listing: 26 | // 27 | // prompt> 020-TestCase --list-tests * 28 | // Matching test cases: 29 | // 1: All test cases reside in other .cpp files (empty) 30 | // [multi-file:1] 31 | // 2: Factorial of 0 is computed (fail) 32 | // [multi-file:2] 33 | // 2: Factorials of 1 and higher are computed (pass) 34 | // [multi-file:2] 35 | // 3 matching test cases 36 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/020-TestCase-2.cpp: -------------------------------------------------------------------------------- 1 | // 020-TestCase-2.cpp 2 | 3 | // main() provided by Catch in file 020-TestCase-1.cpp. 4 | 5 | #include 6 | 7 | int Factorial( int number ) { 8 | return number <= 1 ? number : Factorial( number - 1 ) * number; // fail 9 | // return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass 10 | } 11 | 12 | TEST_CASE( "2: Factorial of 0 is 1 (fail)", "[multi-file:2]" ) { 13 | REQUIRE( Factorial(0) == 1 ); 14 | } 15 | 16 | TEST_CASE( "2: Factorials of 1 and higher are computed (pass)", "[multi-file:2]" ) { 17 | REQUIRE( Factorial(1) == 1 ); 18 | REQUIRE( Factorial(2) == 2 ); 19 | REQUIRE( Factorial(3) == 6 ); 20 | REQUIRE( Factorial(10) == 3628800 ); 21 | } 22 | 23 | // Compile: see 020-TestCase-1.cpp 24 | 25 | // Expected compact output (all assertions): 26 | // 27 | // prompt> 020-TestCase --reporter compact --success 28 | // 020-TestCase-2.cpp:13: failed: Factorial(0) == 1 for: 0 == 1 29 | // 020-TestCase-2.cpp:17: passed: Factorial(1) == 1 for: 1 == 1 30 | // 020-TestCase-2.cpp:18: passed: Factorial(2) == 2 for: 2 == 2 31 | // 020-TestCase-2.cpp:19: passed: Factorial(3) == 6 for: 6 == 6 32 | // 020-TestCase-2.cpp:20: passed: Factorial(10) == 3628800 for: 3628800 (0x375f00) == 3628800 (0x375f00) 33 | // Failed 1 test case, failed 1 assertion. 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/200-Rpt-CatchMain.cpp: -------------------------------------------------------------------------------- 1 | // 200-Rpt-CatchMain.cpp 2 | 3 | // In a Catch project with multiple files, dedicate one file to compile the 4 | // source code of Catch itself and reuse the resulting object file for linking. 5 | 6 | // Let Catch provide main(): 7 | #define CATCH_CONFIG_MAIN 8 | 9 | #include 10 | 11 | #ifdef CATCH_EXAMPLE_RPT_1 12 | #include CATCH_EXAMPLE_RPT_1 13 | #endif 14 | 15 | #ifdef CATCH_EXAMPLE_RPT_2 16 | #include CATCH_EXAMPLE_RPT_2 17 | #endif 18 | 19 | #ifdef CATCH_EXAMPLE_RPT_3 20 | #include CATCH_EXAMPLE_RPT_3 21 | #endif 22 | 23 | // That's it 24 | 25 | // Compile implementation of Catch for use with files that do contain tests: 26 | // - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -o 200-Rpt-CatchMainTeamCity.o -c 200-Rpt-CatchMain.cpp 27 | // cl -EHsc -I%CATCH_ROOT% -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -Fo200-Rpt-CatchMainTeamCity.obj -c 200-Rpt-CatchMain.cpp 28 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/231-Cfg-OutputStreams.cpp: -------------------------------------------------------------------------------- 1 | // 231-Cfg-OutputStreams.cpp 2 | // Show how to replace the streams with a simple custom made streambuf. 3 | 4 | // Note that this reimplementation _does not_ follow `std::cerr` 5 | // semantic, because it buffers the output. For most uses however, 6 | // there is no important difference between having `std::cerr` buffered 7 | // or unbuffered. 8 | 9 | #define CATCH_CONFIG_NOSTDOUT 10 | #define CATCH_CONFIG_MAIN 11 | #include 12 | 13 | 14 | class out_buff : public std::stringbuf { 15 | std::FILE* m_stream; 16 | public: 17 | out_buff(std::FILE* stream):m_stream(stream) {} 18 | ~out_buff(); 19 | int sync() override { 20 | int ret = 0; 21 | for (unsigned char c : str()) { 22 | if (putc(c, m_stream) == EOF) { 23 | ret = -1; 24 | break; 25 | } 26 | } 27 | // Reset the buffer to avoid printing it multiple times 28 | str(""); 29 | return ret; 30 | } 31 | }; 32 | 33 | out_buff::~out_buff() { pubsync(); } 34 | 35 | #if defined(__clang__) 36 | #pragma clang diagnostic ignored "-Wexit-time-destructors" // static variables in cout/cerr/clog 37 | #endif 38 | 39 | namespace Catch { 40 | std::ostream& cout() { 41 | static std::ostream ret(new out_buff(stdout)); 42 | return ret; 43 | } 44 | std::ostream& clog() { 45 | static std::ostream ret(new out_buff(stderr)); 46 | return ret; 47 | } 48 | std::ostream& cerr() { 49 | return clog(); 50 | } 51 | } 52 | 53 | 54 | TEST_CASE("This binary uses putc to write out output", "[compilation-only]") { 55 | SUCCEED("Nothing to test."); 56 | } 57 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/310-Gen-VariablesInGenerators.cpp: -------------------------------------------------------------------------------- 1 | // 310-Gen-VariablesInGenerator.cpp 2 | // Shows how to use variables when creating generators. 3 | 4 | // Note that using variables inside generators is dangerous and should 5 | // be done only if you know what you are doing, because the generators 6 | // _WILL_ outlive the variables -- thus they should be either captured 7 | // by value directly, or copied by the generators during construction. 8 | 9 | #include 10 | 11 | TEST_CASE("Generate random doubles across different ranges", 12 | "[generator][example][advanced]") { 13 | // Workaround for old libstdc++ 14 | using record = std::tuple; 15 | // Set up 3 ranges to generate numbers from 16 | auto r = GENERATE(table({ 17 | record{3, 4}, 18 | record{-4, -3}, 19 | record{10, 1000} 20 | })); 21 | 22 | // This will not compile (intentionally), because it accesses a variable 23 | // auto number = GENERATE(take(50, random(std::get<0>(r), std::get<1>(r)))); 24 | 25 | // GENERATE_COPY copies all variables mentioned inside the expression 26 | // thus this will work. 27 | auto number = GENERATE_COPY(take(50, random(std::get<0>(r), std::get<1>(r)))); 28 | 29 | REQUIRE(std::abs(number) > 0); 30 | } 31 | 32 | // Compiling and running this file will result in 150 successful assertions 33 | 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/examples/311-Gen-CustomCapture.cpp: -------------------------------------------------------------------------------- 1 | // 311-Gen-CustomCapture.cpp 2 | // Shows how to provide custom capture list to the generator expression 3 | 4 | // Note that using variables inside generators is dangerous and should 5 | // be done only if you know what you are doing, because the generators 6 | // _WILL_ outlive the variables. Also, even if you know what you are 7 | // doing, you should probably use GENERATE_COPY or GENERATE_REF macros 8 | // instead. However, if your use case requires having a 9 | // per-variable custom capture list, this example shows how to achieve 10 | // that. 11 | 12 | #include 13 | 14 | TEST_CASE("Generate random doubles across different ranges", 15 | "[generator][example][advanced]") { 16 | // Workaround for old libstdc++ 17 | using record = std::tuple; 18 | // Set up 3 ranges to generate numbers from 19 | auto r1 = GENERATE(table({ 20 | record{3, 4}, 21 | record{-4, -3}, 22 | record{10, 1000} 23 | })); 24 | 25 | auto r2(r1); 26 | 27 | // This will take r1 by reference and r2 by value. 28 | // Note that there are no advantages for doing so in this example, 29 | // it is done only for expository purposes. 30 | auto number = Catch::Generators::generate( "custom capture generator", CATCH_INTERNAL_LINEINFO, 31 | [&r1, r2]{ 32 | using namespace Catch::Generators; 33 | return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2)))); 34 | } 35 | ); 36 | 37 | REQUIRE(std::abs(number) > 0); 38 | } 39 | 40 | // Compiling and running this file will result in 150 successful assertions 41 | 42 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/catch_with_main.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 01/11/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED 10 | 11 | #define CATCH_CONFIG_MAIN 12 | #include "catch.hpp" 13 | 14 | #endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED 15 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_benchmarking_all.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 3 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | */ 5 | 6 | 7 | // A proxy header that includes all of the benchmarking headers to allow 8 | // concise include of the benchmarking features. You should prefer the 9 | // individual includes in standard use. 10 | 11 | #include "catch_benchmark.hpp" 12 | #include "catch_chronometer.hpp" 13 | #include "catch_clock.hpp" 14 | #include "catch_constructor.hpp" 15 | #include "catch_environment.hpp" 16 | #include "catch_estimate.hpp" 17 | #include "catch_execution_plan.hpp" 18 | #include "catch_optimizer.hpp" 19 | #include "catch_outlier_classification.hpp" 20 | #include "catch_sample_analysis.hpp" 21 | #include "detail/catch_analyse.hpp" 22 | #include "detail/catch_benchmark_function.hpp" 23 | #include "detail/catch_complete_invoke.hpp" 24 | #include "detail/catch_estimate_clock.hpp" 25 | #include "detail/catch_measure.hpp" 26 | #include "detail/catch_repeat.hpp" 27 | #include "detail/catch_run_for_at_least.hpp" 28 | #include "detail/catch_stats.hpp" 29 | #include "detail/catch_timing.hpp" 30 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_clock.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Clocks 10 | 11 | #ifndef TWOBLUECUBES_CATCH_CLOCK_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_CLOCK_HPP_INCLUDED 13 | 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | namespace Benchmark { 19 | template 20 | using ClockDuration = typename Clock::duration; 21 | template 22 | using FloatDuration = std::chrono::duration; 23 | 24 | template 25 | using TimePoint = typename Clock::time_point; 26 | 27 | using default_clock = std::chrono::steady_clock; 28 | 29 | template 30 | struct now { 31 | TimePoint operator()() const { 32 | return Clock::now(); 33 | } 34 | }; 35 | 36 | using fp_seconds = std::chrono::duration>; 37 | } // namespace Benchmark 38 | } // namespace Catch 39 | 40 | #endif // TWOBLUECUBES_CATCH_CLOCK_HPP_INCLUDED 41 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_environment.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Environment information 10 | 11 | #ifndef TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED 13 | 14 | #include "catch_clock.hpp" 15 | #include "catch_outlier_classification.hpp" 16 | 17 | namespace Catch { 18 | namespace Benchmark { 19 | template 20 | struct EnvironmentEstimate { 21 | Duration mean; 22 | OutlierClassification outliers; 23 | 24 | template 25 | operator EnvironmentEstimate() const { 26 | return { mean, outliers }; 27 | } 28 | }; 29 | template 30 | struct Environment { 31 | using clock_type = Clock; 32 | EnvironmentEstimate> clock_resolution; 33 | EnvironmentEstimate> clock_cost; 34 | }; 35 | } // namespace Benchmark 36 | } // namespace Catch 37 | 38 | #endif // TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_estimate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Statistics estimates 10 | 11 | #ifndef TWOBLUECUBES_CATCH_ESTIMATE_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_ESTIMATE_HPP_INCLUDED 13 | 14 | namespace Catch { 15 | namespace Benchmark { 16 | template 17 | struct Estimate { 18 | Duration point; 19 | Duration lower_bound; 20 | Duration upper_bound; 21 | double confidence_interval; 22 | 23 | template 24 | operator Estimate() const { 25 | return { point, lower_bound, upper_bound, confidence_interval }; 26 | } 27 | }; 28 | } // namespace Benchmark 29 | } // namespace Catch 30 | 31 | #endif // TWOBLUECUBES_CATCH_ESTIMATE_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_outlier_classification.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Outlier information 10 | #ifndef TWOBLUECUBES_CATCH_OUTLIERS_HPP_INCLUDED 11 | #define TWOBLUECUBES_CATCH_OUTLIERS_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 // TWOBLUECUBES_CATCH_OUTLIERS_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/catch_sample_analysis.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Benchmark results 10 | 11 | #ifndef TWOBLUECUBES_CATCH_BENCHMARK_RESULTS_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_BENCHMARK_RESULTS_HPP_INCLUDED 13 | 14 | #include "catch_clock.hpp" 15 | #include "catch_estimate.hpp" 16 | #include "catch_outlier_classification.hpp" 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace Catch { 24 | namespace Benchmark { 25 | template 26 | struct SampleAnalysis { 27 | std::vector samples; 28 | Estimate mean; 29 | Estimate standard_deviation; 30 | OutlierClassification outliers; 31 | double outlier_variance; 32 | 33 | template 34 | operator SampleAnalysis() const { 35 | std::vector samples2; 36 | samples2.reserve(samples.size()); 37 | std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); 38 | return { 39 | std::move(samples2), 40 | mean, 41 | standard_deviation, 42 | outliers, 43 | outlier_variance, 44 | }; 45 | } 46 | }; 47 | } // namespace Benchmark 48 | } // namespace Catch 49 | 50 | #endif // TWOBLUECUBES_CATCH_BENCHMARK_RESULTS_HPP_INCLUDED 51 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/detail/catch_measure.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Measure 10 | 11 | #ifndef TWOBLUECUBES_CATCH_DETAIL_MEASURE_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_DETAIL_MEASURE_HPP_INCLUDED 13 | 14 | #include "../catch_clock.hpp" 15 | #include "catch_complete_invoke.hpp" 16 | #include "catch_timing.hpp" 17 | 18 | #include 19 | 20 | namespace Catch { 21 | namespace Benchmark { 22 | namespace Detail { 23 | template 24 | TimingOf measure(Fun&& fun, Args&&... args) { 25 | auto start = Clock::now(); 26 | auto&& r = Detail::complete_invoke(fun, std::forward(args)...); 27 | auto end = Clock::now(); 28 | auto delta = end - start; 29 | return { delta, std::forward(r), 1 }; 30 | } 31 | } // namespace Detail 32 | } // namespace Benchmark 33 | } // namespace Catch 34 | 35 | #endif // TWOBLUECUBES_CATCH_DETAIL_MEASURE_HPP_INCLUDED 36 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/detail/catch_repeat.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // repeat algorithm 10 | 11 | #ifndef TWOBLUECUBES_CATCH_DETAIL_REPEAT_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_DETAIL_REPEAT_HPP_INCLUDED 13 | 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | namespace Benchmark { 19 | namespace Detail { 20 | template 21 | struct repeater { 22 | void operator()(int k) const { 23 | for (int i = 0; i < k; ++i) { 24 | fun(); 25 | } 26 | } 27 | Fun fun; 28 | }; 29 | template 30 | repeater::type> repeat(Fun&& fun) { 31 | return { std::forward(fun) }; 32 | } 33 | } // namespace Detail 34 | } // namespace Benchmark 35 | } // namespace Catch 36 | 37 | #endif // TWOBLUECUBES_CATCH_DETAIL_REPEAT_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/benchmark/detail/catch_timing.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Joachim on 16/04/2019. 3 | * Adapted from donated nonius code. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | // Timing 10 | 11 | #ifndef TWOBLUECUBES_CATCH_DETAIL_TIMING_HPP_INCLUDED 12 | #define TWOBLUECUBES_CATCH_DETAIL_TIMING_HPP_INCLUDED 13 | 14 | #include "../catch_clock.hpp" 15 | #include "catch_complete_invoke.hpp" 16 | 17 | #include 18 | #include 19 | 20 | namespace Catch { 21 | namespace Benchmark { 22 | template 23 | struct Timing { 24 | Duration elapsed; 25 | Result result; 26 | int iterations; 27 | }; 28 | template 29 | using TimingOf = Timing, Detail::CompleteType_t>>; 30 | } // namespace Benchmark 31 | } // namespace Catch 32 | 33 | #endif // TWOBLUECUBES_CATCH_DETAIL_TIMING_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_assertioninfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 8/8/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED 10 | 11 | #include "catch_result_type.h" 12 | #include "catch_common.h" 13 | #include "catch_stringref.h" 14 | 15 | namespace Catch { 16 | 17 | struct AssertionInfo 18 | { 19 | StringRef macroName; 20 | SourceLineInfo lineInfo; 21 | StringRef capturedExpression; 22 | ResultDisposition::Flags resultDisposition; 23 | 24 | // We want to delete this constructor but a compiler bug in 4.8 means 25 | // the struct is then treated as non-aggregate 26 | //AssertionInfo() = delete; 27 | }; 28 | 29 | } // end namespace Catch 30 | 31 | #endif // TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_capture_matchers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 9/8/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #include "catch_capture_matchers.h" 9 | #include "catch_interfaces_registry_hub.h" 10 | 11 | namespace Catch { 12 | 13 | using StringMatcher = Matchers::Impl::MatcherBase; 14 | 15 | // This is the general overload that takes a any string matcher 16 | // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers 17 | // the Equals matcher (so the header does not mention matchers) 18 | void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { 19 | std::string exceptionMessage = Catch::translateActiveException(); 20 | MatchExpr expr( exceptionMessage, matcher, matcherString ); 21 | handler.handleExpr( expr ); 22 | } 23 | 24 | } // namespace Catch 25 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_clara.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 10/2/2014. 3 | * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | * 8 | */ 9 | #ifndef TWOBLUECUBES_CATCH_CLARA_H_INCLUDED 10 | #define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED 11 | 12 | // Use Catch's value for console width (store Clara's off to the side, if present) 13 | #ifdef CLARA_CONFIG_CONSOLE_WIDTH 14 | #define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 15 | #undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 16 | #endif 17 | #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 18 | 19 | #ifdef __clang__ 20 | #pragma clang diagnostic push 21 | #pragma clang diagnostic ignored "-Wweak-vtables" 22 | #pragma clang diagnostic ignored "-Wexit-time-destructors" 23 | #pragma clang diagnostic ignored "-Wshadow" 24 | #endif 25 | 26 | #include "../external/clara.hpp" 27 | 28 | #ifdef __clang__ 29 | #pragma clang diagnostic pop 30 | #endif 31 | 32 | // Restore Clara's value for console width, if present 33 | #ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH 34 | #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH 35 | #undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH 36 | #endif 37 | 38 | #endif // TWOBLUECUBES_CATCH_CLARA_H_INCLUDED 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_commandline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 02/11/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED 10 | 11 | #include "catch_config.hpp" 12 | #include "catch_clara.h" 13 | 14 | namespace Catch { 15 | 16 | clara::Parser makeCommandLineParser( ConfigData& config ); 17 | 18 | } // end namespace Catch 19 | 20 | #endif // TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED 21 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 27/11/2013. 3 | * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_common.h" 10 | #include "catch_context.h" 11 | #include "catch_interfaces_config.h" 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { 19 | return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); 20 | } 21 | bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { 22 | // We can assume that the same file will usually have the same pointer. 23 | // Thus, if the pointers are the same, there is no point in calling the strcmp 24 | return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); 25 | } 26 | 27 | std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { 28 | #ifndef __GNUG__ 29 | os << info.file << '(' << info.line << ')'; 30 | #else 31 | os << info.file << ':' << info.line; 32 | #endif 33 | return os; 34 | } 35 | 36 | std::string StreamEndStop::operator+() const { 37 | return std::string(); 38 | } 39 | 40 | NonCopyable::NonCopyable() = default; 41 | NonCopyable::~NonCopyable() = default; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/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_1_0.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 18 | #define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP 19 | 20 | #if defined(_MSC_VER) 21 | # if _MSC_VER >= 1900 // Visual Studio 2015 or newer 22 | # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 23 | # endif 24 | #endif 25 | 26 | 27 | #include 28 | 29 | #if defined(__cpp_lib_uncaught_exceptions) \ 30 | && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 31 | 32 | # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 33 | #endif // __cpp_lib_uncaught_exceptions 34 | 35 | 36 | #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ 37 | && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ 38 | && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 39 | 40 | # define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 41 | #endif 42 | 43 | 44 | #endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP 45 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_debug_console.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 29/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | * 7 | */ 8 | 9 | #include "catch_debug_console.h" 10 | #include "catch_compiler_capabilities.h" 11 | #include "catch_stream.h" 12 | #include "catch_platform.h" 13 | #include "catch_windows_h_proxy.h" 14 | 15 | #if defined(CATCH_CONFIG_ANDROID_LOGWRITE) 16 | #include 17 | 18 | namespace Catch { 19 | void writeToDebugConsole( std::string const& text ) { 20 | __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() ); 21 | } 22 | } 23 | 24 | #elif defined(CATCH_PLATFORM_WINDOWS) 25 | 26 | namespace Catch { 27 | void writeToDebugConsole( std::string const& text ) { 28 | ::OutputDebugStringA( text.c_str() ); 29 | } 30 | } 31 | 32 | #else 33 | 34 | namespace Catch { 35 | void writeToDebugConsole( std::string const& text ) { 36 | // !TBD: Need a version for Mac/ XCode and other IDEs 37 | Catch::cout() << text; 38 | } 39 | } 40 | 41 | #endif // Platform 42 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_debug_console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 29/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | * 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | void writeToDebugConsole( std::string const& text ); 15 | } 16 | 17 | #endif // TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED 18 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_decomposer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 8/8/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_decomposer.h" 10 | #include "catch_config.hpp" 11 | 12 | namespace Catch { 13 | 14 | ITransientExpression::~ITransientExpression() = default; 15 | 16 | void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { 17 | if( lhs.size() + rhs.size() < 40 && 18 | lhs.find('\n') == std::string::npos && 19 | rhs.find('\n') == std::string::npos ) 20 | os << lhs << " " << op << " " << rhs; 21 | else 22 | os << lhs << "\n" << op << "\n" << rhs; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_default_main.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 20/05/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED 10 | 11 | #include "catch_session.h" 12 | #include "catch_platform.h" 13 | 14 | #ifndef __OBJC__ 15 | 16 | #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) 17 | // Standard C/C++ Win32 Unicode wmain entry point 18 | extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { 19 | #else 20 | // Standard C/C++ main entry point 21 | int main (int argc, char * argv[]) { 22 | #endif 23 | 24 | return Catch::Session().run( argc, argv ); 25 | } 26 | 27 | #else // __OBJC__ 28 | 29 | // Objective-C entry point 30 | int main (int argc, char * const argv[]) { 31 | #if !CATCH_ARC_ENABLED 32 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 33 | #endif 34 | 35 | Catch::registerTestMethods(); 36 | int result = Catch::Session().run( argc, (char**)argv ); 37 | 38 | #if !CATCH_ARC_ENABLED 39 | [pool drain]; 40 | #endif 41 | 42 | return result; 43 | } 44 | 45 | #endif // __OBJC__ 46 | 47 | #endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED 48 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_enforce.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 03/09/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_enforce.h" 9 | 10 | #include 11 | 12 | 13 | namespace Catch { 14 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) 15 | [[noreturn]] 16 | void throw_exception(std::exception const& e) { 17 | Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" 18 | << "The message was: " << e.what() << '\n'; 19 | std::terminate(); 20 | } 21 | #endif 22 | 23 | [[noreturn]] 24 | void throw_logic_error(std::string const& msg) { 25 | throw_exception(std::logic_error(msg)); 26 | } 27 | 28 | [[noreturn]] 29 | void throw_domain_error(std::string const& msg) { 30 | throw_exception(std::domain_error(msg)); 31 | } 32 | 33 | [[noreturn]] 34 | void throw_runtime_error(std::string const& msg) { 35 | throw_exception(std::runtime_error(msg)); 36 | } 37 | 38 | 39 | 40 | } // namespace Catch; 41 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_enforce.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 01/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED 9 | 10 | #include "catch_common.h" 11 | #include "catch_compiler_capabilities.h" 12 | #include "catch_stream.h" 13 | 14 | #include 15 | 16 | namespace Catch { 17 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 18 | template 19 | [[noreturn]] 20 | void throw_exception(Ex const& e) { 21 | throw e; 22 | } 23 | #else // ^^ Exceptions are enabled // Exceptions are disabled vv 24 | [[noreturn]] 25 | void throw_exception(std::exception const& e); 26 | #endif 27 | 28 | [[noreturn]] 29 | void throw_logic_error(std::string const& msg); 30 | [[noreturn]] 31 | void throw_domain_error(std::string const& msg); 32 | [[noreturn]] 33 | void throw_runtime_error(std::string const& msg); 34 | 35 | } // namespace Catch; 36 | 37 | #define CATCH_MAKE_MSG(...) \ 38 | (Catch::ReusableStringStream() << __VA_ARGS__).str() 39 | 40 | #define CATCH_INTERNAL_ERROR(...) \ 41 | Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)) 42 | 43 | #define CATCH_ERROR(...) \ 44 | Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )) 45 | 46 | #define CATCH_RUNTIME_ERROR(...) \ 47 | Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )) 48 | 49 | #define CATCH_ENFORCE( condition, ... ) \ 50 | do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) 51 | 52 | 53 | #endif // TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED 54 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_enum_values_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 4/4/2019. 3 | * Copyright 2019 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED 10 | 11 | #include "catch_interfaces_enum_values_registry.h" 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | namespace Detail { 19 | 20 | std::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); 21 | 22 | class EnumValuesRegistry : public IMutableEnumValuesRegistry { 23 | 24 | std::vector> m_enumInfos; 25 | 26 | EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values) override; 27 | }; 28 | 29 | std::vector parseEnums( StringRef enums ); 30 | 31 | } // Detail 32 | 33 | } // Catch 34 | 35 | #endif //TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_errno_guard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 06/03/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_errno_guard.h" 9 | 10 | #include 11 | 12 | namespace Catch { 13 | ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} 14 | ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } 15 | } 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_errno_guard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 06/03/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED 9 | 10 | namespace Catch { 11 | 12 | class ErrnoGuard { 13 | public: 14 | ErrnoGuard(); 15 | ~ErrnoGuard(); 16 | private: 17 | int m_oldErrno; 18 | }; 19 | 20 | } 21 | 22 | #endif // TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED 23 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_exception_translator_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 20/04/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 10 | 11 | #include "catch_interfaces_exception.h" 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { 19 | public: 20 | ~ExceptionTranslatorRegistry(); 21 | virtual void registerTranslator( const IExceptionTranslator* translator ); 22 | std::string translateActiveException() const override; 23 | std::string tryTranslators() const; 24 | 25 | private: 26 | std::vector> m_translators; 27 | }; 28 | } 29 | 30 | #endif // TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_external_interfaces.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 17/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED 9 | 10 | #include "../reporters/catch_reporter_bases.hpp" 11 | #include "catch_console_colour.h" 12 | #include "catch_reporter_registrars.hpp" 13 | 14 | // Allow users to base their work off existing reporters 15 | #include "../reporters/catch_reporter_compact.h" 16 | #include "../reporters/catch_reporter_console.h" 17 | #include "../reporters/catch_reporter_junit.h" 18 | #include "../reporters/catch_reporter_xml.h" 19 | 20 | #endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED 21 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_generators.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 15/6/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_generators.hpp" 9 | #include "catch_random_number_generator.h" 10 | #include "catch_interfaces_capture.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | 17 | IGeneratorTracker::~IGeneratorTracker() {} 18 | 19 | const char* GeneratorException::what() const noexcept { 20 | return m_msg; 21 | } 22 | 23 | namespace Generators { 24 | 25 | GeneratorUntypedBase::~GeneratorUntypedBase() {} 26 | 27 | auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { 28 | return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); 29 | } 30 | 31 | } // namespace Generators 32 | } // namespace Catch 33 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_impl.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 5/8/2012. 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED 10 | 11 | #ifdef __clang__ 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wweak-vtables" 14 | #endif 15 | 16 | // Keep these here for external reporters 17 | #include "catch_test_spec.h" 18 | #include "catch_test_case_tracker.h" 19 | 20 | #include "catch_leak_detector.h" 21 | 22 | // Cpp files will be included in the single-header file here 23 | // ~*~* CATCH_CPP_STITCH_PLACE *~*~ 24 | 25 | namespace Catch { 26 | LeakDetector leakDetector; 27 | } 28 | 29 | #ifdef __clang__ 30 | #pragma clang diagnostic pop 31 | #endif 32 | 33 | #endif // TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_capture.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_capture.h" 2 | 3 | namespace Catch { 4 | IResultCapture::~IResultCapture() = default; 5 | } 6 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_config.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_config.h" 2 | 3 | namespace Catch { 4 | IConfig::~IConfig() = default; 5 | } 6 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_enum_values_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 4/4/2019. 3 | * Copyright 2019 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED 10 | 11 | #include "catch_stringref.h" 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 | struct IMutableEnumValuesRegistry { 29 | virtual ~IMutableEnumValuesRegistry(); 30 | 31 | virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values ) = 0; 32 | 33 | template 34 | Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list values ) { 35 | static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); 36 | std::vector intValues; 37 | intValues.reserve( values.size() ); 38 | for( auto enumValue : values ) 39 | intValues.push_back( static_cast( enumValue ) ); 40 | return registerEnum( enumName, allEnums, intValues ); 41 | } 42 | }; 43 | 44 | } // Catch 45 | 46 | #endif //TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED 47 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_exception.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_exception.h" 2 | 3 | namespace Catch { 4 | IExceptionTranslator::~IExceptionTranslator() = default; 5 | IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; 6 | } 7 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_generatortracker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 26/6/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED 9 | #define TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | namespace Generators { 16 | class GeneratorUntypedBase { 17 | public: 18 | GeneratorUntypedBase() = default; 19 | virtual ~GeneratorUntypedBase(); 20 | // Attempts to move the generator to the next element 21 | // 22 | // Returns true iff the move succeeded (and a valid element 23 | // can be retrieved). 24 | virtual bool next() = 0; 25 | }; 26 | using GeneratorBasePtr = std::unique_ptr; 27 | 28 | } // namespace Generators 29 | 30 | struct IGeneratorTracker { 31 | virtual ~IGeneratorTracker(); 32 | virtual auto hasGenerator() const -> bool = 0; 33 | virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; 34 | virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; 35 | }; 36 | 37 | } // namespace Catch 38 | 39 | #endif //TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED 40 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_registry_hub.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_registry_hub.h" 2 | 3 | namespace Catch { 4 | IRegistryHub::~IRegistryHub() = default; 5 | IMutableRegistryHub::~IMutableRegistryHub() = default; 6 | } 7 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_runner.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_runner.h" 2 | 3 | namespace Catch { 4 | IRunner::~IRunner() = default; 5 | } 6 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 07/01/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | struct IRunner { 14 | virtual ~IRunner(); 15 | virtual bool aborting() const = 0; 16 | }; 17 | } 18 | 19 | #endif // TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED 20 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_tag_alias_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 27/6/2014. 3 | * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | struct TagAlias; 16 | 17 | struct ITagAliasRegistry { 18 | virtual ~ITagAliasRegistry(); 19 | // Nullptr if not present 20 | virtual TagAlias const* find( std::string const& alias ) const = 0; 21 | virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; 22 | 23 | static ITagAliasRegistry const& get(); 24 | }; 25 | 26 | } // end namespace Catch 27 | 28 | #endif // TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_testcase.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_interfaces_testcase.h" 2 | 3 | namespace Catch { 4 | ITestInvoker::~ITestInvoker() = default; 5 | ITestCaseRegistry::~ITestCaseRegistry() = default; 6 | } 7 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_interfaces_testcase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 07/01/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | class TestSpec; 16 | 17 | struct ITestInvoker { 18 | virtual void invoke () const = 0; 19 | virtual ~ITestInvoker(); 20 | }; 21 | 22 | class TestCase; 23 | struct IConfig; 24 | 25 | struct ITestCaseRegistry { 26 | virtual ~ITestCaseRegistry(); 27 | virtual std::vector const& getAllTests() const = 0; 28 | virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; 29 | }; 30 | 31 | bool isThrowSafe( TestCase const& testCase, IConfig const& config ); 32 | bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); 33 | std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); 34 | std::vector const& getAllTestCasesSorted( IConfig const& config ); 35 | 36 | } 37 | 38 | #endif // TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_leak_detector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 12/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_leak_detector.h" 9 | #include "catch_interfaces_registry_hub.h" 10 | 11 | 12 | #ifdef CATCH_CONFIG_WINDOWS_CRTDBG 13 | #include 14 | 15 | namespace Catch { 16 | 17 | LeakDetector::LeakDetector() { 18 | int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); 19 | flag |= _CRTDBG_LEAK_CHECK_DF; 20 | flag |= _CRTDBG_ALLOC_MEM_DF; 21 | _CrtSetDbgFlag(flag); 22 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 23 | _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 24 | // Change this to leaking allocation's number to break there 25 | _CrtSetBreakAlloc(-1); 26 | } 27 | } 28 | 29 | #else 30 | 31 | Catch::LeakDetector::LeakDetector() {} 32 | 33 | #endif 34 | 35 | Catch::LeakDetector::~LeakDetector() { 36 | Catch::cleanUp(); 37 | } 38 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_leak_detector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 12/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED 9 | 10 | namespace Catch { 11 | 12 | struct LeakDetector { 13 | LeakDetector(); 14 | ~LeakDetector(); 15 | }; 16 | 17 | } 18 | #endif // TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED 19 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 5/11/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_LIST_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_LIST_H_INCLUDED 10 | 11 | #include "catch_option.hpp" 12 | #include "catch_config.hpp" 13 | 14 | #include 15 | 16 | namespace Catch { 17 | 18 | std::size_t listTests( Config const& config ); 19 | 20 | std::size_t listTestsNamesOnly( Config const& config ); 21 | 22 | struct TagInfo { 23 | void add( std::string const& spelling ); 24 | std::string all() const; 25 | 26 | std::set spellings; 27 | std::size_t count = 0; 28 | }; 29 | 30 | std::size_t listTags( Config const& config ); 31 | 32 | std::size_t listReporters(); 33 | 34 | Option list( std::shared_ptr const& config ); 35 | 36 | } // end namespace Catch 37 | 38 | #endif // TWOBLUECUBES_CATCH_LIST_H_INCLUDED 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_matchers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 19/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_matchers.h" 9 | 10 | namespace Catch { 11 | namespace Matchers { 12 | namespace Impl { 13 | 14 | std::string MatcherUntypedBase::toString() const { 15 | if( m_cachedToString.empty() ) 16 | m_cachedToString = describe(); 17 | return m_cachedToString; 18 | } 19 | 20 | MatcherUntypedBase::~MatcherUntypedBase() = default; 21 | 22 | } // namespace Impl 23 | } // namespace Matchers 24 | 25 | using namespace Matchers; 26 | using Matchers::Impl::MatcherBase; 27 | 28 | } // namespace Catch 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_matchers_exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin Hořeňovský on 13/10/2019. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_matchers_exception.hpp" 9 | 10 | 11 | namespace Catch { 12 | namespace Matchers { 13 | namespace Exception { 14 | 15 | bool ExceptionMessageMatcher::match(std::exception const& ex) const { 16 | return ex.what() == m_message; 17 | } 18 | 19 | std::string ExceptionMessageMatcher::describe() const { 20 | return "exception message matches \"" + m_message + "\""; 21 | } 22 | 23 | } 24 | Exception::ExceptionMessageMatcher Message(std::string const& message) { 25 | return Exception::ExceptionMessageMatcher(message); 26 | } 27 | 28 | // namespace Exception 29 | } // namespace Matchers 30 | } // namespace Catch 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_matchers_exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin Hořeňovský on 13/10/2019. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 8 | #define TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 9 | 10 | #include "catch_matchers.h" 11 | 12 | namespace Catch { 13 | namespace Matchers { 14 | namespace Exception { 15 | 16 | class ExceptionMessageMatcher : 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 | } // namespace Exception 30 | 31 | Exception::ExceptionMessageMatcher Message(std::string const& message); 32 | 33 | } // namespace Matchers 34 | } // namespace Catch 35 | 36 | #endif // TWOBLUECUBES_CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_matchers_generic.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_matchers_generic.hpp" 2 | 3 | std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) { 4 | if (desc.empty()) { 5 | return "matches undescribed predicate"; 6 | } else { 7 | return "matches predicate: \"" + desc + '"'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_objc_arc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 1/08/2012. 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED 10 | 11 | #import 12 | 13 | #ifdef __has_feature 14 | #define CATCH_ARC_ENABLED __has_feature(objc_arc) 15 | #else 16 | #define CATCH_ARC_ENABLED 0 17 | #endif 18 | 19 | void arcSafeRelease( NSObject* obj ); 20 | id performOptionalSelector( id obj, SEL sel ); 21 | 22 | #if !CATCH_ARC_ENABLED 23 | inline void arcSafeRelease( NSObject* obj ) { 24 | [obj release]; 25 | } 26 | inline id performOptionalSelector( id obj, SEL sel ) { 27 | if( [obj respondsToSelector: sel] ) 28 | return [obj performSelector: sel]; 29 | return nil; 30 | } 31 | #define CATCH_UNSAFE_UNRETAINED 32 | #define CATCH_ARC_STRONG 33 | #else 34 | inline void arcSafeRelease( NSObject* ){} 35 | inline id performOptionalSelector( id obj, SEL sel ) { 36 | #ifdef __clang__ 37 | #pragma clang diagnostic push 38 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 39 | #endif 40 | if( [obj respondsToSelector: sel] ) 41 | return [obj performSelector: sel]; 42 | #ifdef __clang__ 43 | #pragma clang diagnostic pop 44 | #endif 45 | return nil; 46 | } 47 | #define CATCH_UNSAFE_UNRETAINED __unsafe_unretained 48 | #define CATCH_ARC_STRONG __strong 49 | #endif 50 | 51 | #endif // TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED 52 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 16/8/2013. 3 | * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | * 8 | */ 9 | #ifndef TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED 10 | #define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED 11 | 12 | // See e.g.: 13 | // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html 14 | #ifdef __APPLE__ 15 | # include 16 | # if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ 17 | (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) 18 | # define CATCH_PLATFORM_MAC 19 | # elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) 20 | # define CATCH_PLATFORM_IPHONE 21 | # endif 22 | 23 | #elif defined(linux) || defined(__linux) || defined(__linux__) 24 | # define CATCH_PLATFORM_LINUX 25 | 26 | #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) 27 | # define CATCH_PLATFORM_WINDOWS 28 | #endif 29 | 30 | #endif // TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_polyfills.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 17/11/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_polyfills.hpp" 9 | 10 | #include 11 | 12 | namespace Catch { 13 | 14 | #if !defined(CATCH_CONFIG_POLYFILL_ISNAN) 15 | bool isnan(float f) { 16 | return std::isnan(f); 17 | } 18 | bool isnan(double d) { 19 | return std::isnan(d); 20 | } 21 | #else 22 | // For now we only use this for embarcadero 23 | bool isnan(float f) { 24 | return std::_isnan(f); 25 | } 26 | bool isnan(double d) { 27 | return std::_isnan(d); 28 | } 29 | #endif 30 | 31 | } // end namespace Catch 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_polyfills.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 17/11/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED 8 | #define TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED 9 | 10 | namespace Catch { 11 | bool isnan(float f); 12 | bool isnan(double d); 13 | } 14 | 15 | #endif // TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_reenable_warnings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Two Blue Cubes Ltd 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED 10 | 11 | #ifdef __clang__ 12 | # ifdef __ICC // icpc defines the __clang__ macro 13 | # pragma warning(pop) 14 | # else 15 | # pragma clang diagnostic pop 16 | # endif 17 | #elif defined __GNUC__ 18 | # pragma GCC diagnostic pop 19 | #endif 20 | 21 | #endif // TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED 22 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_reporter_registry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 31/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #include "catch_reporter_registry.h" 8 | 9 | namespace Catch { 10 | 11 | ReporterRegistry::~ReporterRegistry() = default; 12 | 13 | IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { 14 | auto it = m_factories.find( name ); 15 | if( it == m_factories.end() ) 16 | return nullptr; 17 | return it->second->create( ReporterConfig( config ) ); 18 | } 19 | 20 | void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { 21 | m_factories.emplace(name, factory); 22 | } 23 | void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { 24 | m_listeners.push_back( factory ); 25 | } 26 | 27 | IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { 28 | return m_factories; 29 | } 30 | IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { 31 | return m_listeners; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_reporter_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 29/10/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED 10 | 11 | #include "catch_interfaces_reporter.h" 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | class ReporterRegistry : public IReporterRegistry { 18 | 19 | public: 20 | 21 | ~ReporterRegistry() override; 22 | 23 | IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; 24 | 25 | void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); 26 | void registerListener( IReporterFactoryPtr const& factory ); 27 | 28 | FactoryMap const& getFactories() const override; 29 | Listeners const& getListeners() const override; 30 | 31 | private: 32 | FactoryMap m_factories; 33 | Listeners m_listeners; 34 | }; 35 | } 36 | 37 | #endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED 38 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_result_type.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 07/01/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_result_type.h" 10 | 11 | namespace Catch { 12 | 13 | bool isOk( ResultWas::OfType resultType ) { 14 | return ( resultType & ResultWas::FailureBit ) == 0; 15 | } 16 | bool isJustInfo( int flags ) { 17 | return flags == ResultWas::Info; 18 | } 19 | 20 | ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { 21 | return static_cast( static_cast( lhs ) | static_cast( rhs ) ); 22 | } 23 | 24 | bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } 25 | bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } 26 | 27 | } // end namespace Catch 28 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_result_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 07/01/2011. 3 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_RESULT_TYPE_H_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 | 20 | FailureBit = 0x10, 21 | 22 | ExpressionFailed = FailureBit | 1, 23 | ExplicitFailure = FailureBit | 2, 24 | 25 | Exception = 0x100 | FailureBit, 26 | 27 | ThrewException = Exception | 1, 28 | DidntThrowException = Exception | 2, 29 | 30 | FatalErrorCondition = 0x200 | FailureBit 31 | 32 | }; }; 33 | 34 | bool isOk( ResultWas::OfType resultType ); 35 | bool isJustInfo( int flags ); 36 | 37 | 38 | // ResultDisposition::Flags enum 39 | struct ResultDisposition { enum Flags { 40 | Normal = 0x01, 41 | 42 | ContinueOnFailure = 0x02, // Failures fail test, but execution continues 43 | FalseTest = 0x04, // Prefix expression with ! 44 | SuppressFail = 0x08 // Failures are reported but do not fail the test 45 | }; }; 46 | 47 | ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); 48 | 49 | bool shouldContinueOnFailure( int flags ); 50 | inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } 51 | bool shouldSuppressFailure( int flags ); 52 | 53 | } // end namespace Catch 54 | 55 | #endif // TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED 56 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_section.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 03/11/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_section.h" 10 | #include "catch_capture.hpp" 11 | #include "catch_uncaught_exceptions.h" 12 | 13 | namespace Catch { 14 | 15 | Section::Section( SectionInfo const& info ) 16 | : m_info( info ), 17 | m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) 18 | { 19 | m_timer.start(); 20 | } 21 | 22 | Section::~Section() { 23 | if( m_sectionIncluded ) { 24 | SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; 25 | if( uncaught_exceptions() ) 26 | getResultCapture().sectionEndedEarly( endInfo ); 27 | else 28 | getResultCapture().sectionEnded( endInfo ); 29 | } 30 | } 31 | 32 | // This indicates whether the section should be executed or not 33 | Section::operator bool() const { 34 | return m_sectionIncluded; 35 | } 36 | 37 | 38 | } // end namespace Catch 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_section_info.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 01/08/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_section_info.h" 9 | 10 | namespace Catch { 11 | 12 | SectionInfo::SectionInfo 13 | ( SourceLineInfo const& _lineInfo, 14 | std::string const& _name ) 15 | : name( _name ), 16 | lineInfo( _lineInfo ) 17 | {} 18 | 19 | } // end namespace Catch 20 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_section_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 03/11/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED 10 | 11 | #include "catch_common.h" 12 | #include "catch_totals.h" 13 | 14 | #include 15 | 16 | namespace Catch { 17 | 18 | struct SectionInfo { 19 | SectionInfo 20 | ( SourceLineInfo const& _lineInfo, 21 | std::string const& _name ); 22 | 23 | // Deprecated 24 | SectionInfo 25 | ( SourceLineInfo const& _lineInfo, 26 | std::string const& _name, 27 | std::string const& ) : SectionInfo( _lineInfo, _name ) {} 28 | 29 | std::string name; 30 | std::string description; // !Deprecated: this will always be empty 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 // TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED 43 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_singletons.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 15/6/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_singletons.hpp" 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() {} 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 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_singletons.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 15/6/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_SINGLETONS_HPP_INCLUDED 8 | #define TWOBLUECUBES_CATCH_SINGLETONS_HPP_INCLUDED 9 | 10 | namespace Catch { 11 | 12 | struct ISingleton { 13 | virtual ~ISingleton(); 14 | }; 15 | 16 | 17 | void addSingleton( ISingleton* singleton ); 18 | void cleanupSingletons(); 19 | 20 | 21 | template 22 | class Singleton : SingletonImplT, public ISingleton { 23 | 24 | static auto getInternal() -> Singleton* { 25 | static Singleton* s_instance = nullptr; 26 | if( !s_instance ) { 27 | s_instance = new Singleton; 28 | addSingleton( s_instance ); 29 | } 30 | return s_instance; 31 | } 32 | 33 | public: 34 | static auto get() -> InterfaceT const& { 35 | return *getInternal(); 36 | } 37 | static auto getMutable() -> MutableInterfaceT& { 38 | return *getInternal(); 39 | } 40 | }; 41 | 42 | } // namespace Catch 43 | 44 | #endif // TWOBLUECUBES_CATCH_SINGLETONS_HPP_INCLUDED 45 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_startup_exception_registry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 04/06/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_startup_exception_registry.h" 10 | #include "catch_compiler_capabilities.h" 11 | 12 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 13 | namespace Catch { 14 | void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { 15 | CATCH_TRY { 16 | m_exceptions.push_back(exception); 17 | } CATCH_CATCH_ALL { 18 | // If we run out of memory during start-up there's really not a lot more we can do about it 19 | std::terminate(); 20 | } 21 | } 22 | 23 | std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { 24 | return m_exceptions; 25 | } 26 | 27 | } // end namespace Catch 28 | #endif 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_startup_exception_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 04/06/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_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 // TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_INCLUDED 30 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 2/12/2013. 3 | * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | * 8 | */ 9 | #ifndef TWOBLUECUBES_CATCH_STREAM_H_INCLUDED 10 | #define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED 11 | 12 | #include "catch_common.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Catch { 19 | 20 | std::ostream& cout(); 21 | std::ostream& cerr(); 22 | std::ostream& clog(); 23 | 24 | class StringRef; 25 | 26 | struct IStream { 27 | virtual ~IStream(); 28 | virtual std::ostream& stream() const = 0; 29 | }; 30 | 31 | auto makeStream( StringRef const &filename ) -> IStream const*; 32 | 33 | class ReusableStringStream : NonCopyable { 34 | std::size_t m_index; 35 | std::ostream* m_oss; 36 | public: 37 | ReusableStringStream(); 38 | ~ReusableStringStream(); 39 | 40 | auto str() const -> std::string; 41 | 42 | template 43 | auto operator << ( T const& value ) -> ReusableStringStream& { 44 | *m_oss << value; 45 | return *this; 46 | } 47 | auto get() -> std::ostream& { return *m_oss; } 48 | }; 49 | } 50 | 51 | #endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED 52 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_string_manip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 25/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED 9 | 10 | #include "catch_stringref.h" 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | bool startsWith( std::string const& s, std::string const& prefix ); 19 | bool startsWith( std::string const& s, char prefix ); 20 | bool endsWith( std::string const& s, std::string const& suffix ); 21 | bool endsWith( std::string const& s, char suffix ); 22 | bool contains( std::string const& s, std::string const& infix ); 23 | void toLowerInPlace( std::string& s ); 24 | std::string toLower( std::string const& s ); 25 | //! Returns a new string without whitespace at the start/end 26 | std::string trim( std::string const& str ); 27 | //! Returns a substring of the original ref without whitespace. Beware lifetimes! 28 | StringRef trim(StringRef ref); 29 | 30 | // !!! Be aware, returns refs into original string - make sure original string outlives them 31 | std::vector splitStringRef( StringRef str, char delimiter ); 32 | bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); 33 | 34 | struct pluralise { 35 | pluralise( std::size_t count, std::string const& label ); 36 | 37 | friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); 38 | 39 | std::size_t m_count; 40 | std::string m_label; 41 | }; 42 | } 43 | 44 | #endif // TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED 45 | 46 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_stringref.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Two Blue Cubes Ltd. All rights reserved. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_enforce.h" 9 | #include "catch_stringref.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | StringRef::StringRef( char const* rawChars ) noexcept 18 | : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) 19 | {} 20 | 21 | auto StringRef::c_str() const -> char const* { 22 | CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); 23 | return m_start; 24 | } 25 | auto StringRef::data() const noexcept -> char const* { 26 | return m_start; 27 | } 28 | 29 | auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { 30 | if (start < m_size) { 31 | return StringRef(m_start + start, (std::min)(m_size - start, size)); 32 | } else { 33 | return StringRef(); 34 | } 35 | } 36 | auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { 37 | return m_size == other.m_size 38 | && (std::memcmp( m_start, other.m_start, m_size ) == 0); 39 | } 40 | 41 | auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { 42 | return os.write(str.data(), str.size()); 43 | } 44 | 45 | auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { 46 | lhs.append(rhs.data(), rhs.size()); 47 | return lhs; 48 | } 49 | 50 | } // namespace Catch 51 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_suppress_warnings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Two Blue Cubes Ltd 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifdef __clang__ 9 | # ifdef __ICC // icpc defines the __clang__ macro 10 | # pragma warning(push) 11 | # pragma warning(disable: 161 1682) 12 | # else // __ICC 13 | # pragma clang diagnostic push 14 | # pragma clang diagnostic ignored "-Wpadded" 15 | # pragma clang diagnostic ignored "-Wswitch-enum" 16 | # pragma clang diagnostic ignored "-Wcovered-switch-default" 17 | # endif 18 | #elif defined __GNUC__ 19 | // Because REQUIREs trigger GCC's -Wparentheses, and because still 20 | // supported version of g++ have only buggy support for _Pragmas, 21 | // Wparentheses have to be suppressed globally. 22 | # pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details 23 | 24 | # pragma GCC diagnostic push 25 | # pragma GCC diagnostic ignored "-Wunused-variable" 26 | # pragma GCC diagnostic ignored "-Wpadded" 27 | #endif 28 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_tag_alias.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_tag_alias.h" 2 | 3 | namespace Catch { 4 | TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} 5 | } 6 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_tag_alias.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 27/6/2014. 3 | * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED 10 | 11 | #include "catch_common.h" 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | struct TagAlias { 18 | TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); 19 | 20 | std::string tag; 21 | SourceLineInfo lineInfo; 22 | }; 23 | 24 | } // end namespace Catch 25 | 26 | #endif // TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED 27 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_tag_alias_autoregistrar.cpp: -------------------------------------------------------------------------------- 1 | #include "catch_tag_alias_autoregistrar.h" 2 | #include "catch_compiler_capabilities.h" 3 | #include "catch_interfaces_registry_hub.h" 4 | 5 | namespace Catch { 6 | 7 | RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { 8 | CATCH_TRY { 9 | getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); 10 | } CATCH_CATCH_ALL { 11 | // Do not throw when constructing global objects, instead register the exception to be processed later 12 | getMutableRegistryHub().registerStartupException(); 13 | } 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_tag_alias_autoregistrar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 27/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED 9 | 10 | #include "catch_common.h" 11 | 12 | namespace Catch { 13 | 14 | struct RegistrarForTagAliases { 15 | RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); 16 | }; 17 | 18 | } // end namespace Catch 19 | 20 | #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ 21 | CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ 22 | CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ 23 | namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ 24 | CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION 25 | 26 | #endif // TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED 27 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_tag_alias_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 27/6/2014. 3 | * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED 10 | 11 | #include "catch_interfaces_tag_alias_registry.h" 12 | #include "catch_tag_alias.h" 13 | 14 | #include 15 | 16 | namespace Catch { 17 | 18 | class TagAliasRegistry : public ITagAliasRegistry { 19 | public: 20 | ~TagAliasRegistry() override; 21 | TagAlias const* find( std::string const& alias ) const override; 22 | std::string expandAliases( std::string const& unexpandedTestSpec ) const override; 23 | void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); 24 | 25 | private: 26 | std::map m_registry; 27 | }; 28 | 29 | } // end namespace Catch 30 | 31 | #endif // TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_test_registry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 25/07/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch_test_registry.h" 9 | #include "catch_compiler_capabilities.h" 10 | #include "catch_test_case_registry_impl.h" 11 | #include "catch_interfaces_registry_hub.h" 12 | 13 | namespace Catch { 14 | 15 | auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { 16 | return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); 17 | } 18 | 19 | NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} 20 | 21 | AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { 22 | CATCH_TRY { 23 | getMutableRegistryHub() 24 | .registerTest( 25 | makeTestCase( 26 | invoker, 27 | extractClassName( classOrMethod ), 28 | nameAndTags, 29 | lineInfo)); 30 | } CATCH_CATCH_ALL { 31 | // Do not throw when constructing global objects, instead register the exception to be processed later 32 | getMutableRegistryHub().registerStartupException(); 33 | } 34 | } 35 | 36 | AutoReg::~AutoReg() = default; 37 | } 38 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_text.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 10/2/2014. 3 | * Copyright 2014 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_TEXT_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_TEXT_H_INCLUDED 10 | 11 | #include "catch_clara.h" 12 | 13 | namespace Catch { 14 | using namespace clara::TextFlow; 15 | } 16 | 17 | #endif // TWOBLUECUBES_CATCH_TEXT_H_INCLUDED 18 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 05/08/2013. 3 | * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | auto getCurrentNanosecondsSinceEpoch() -> uint64_t; 16 | auto getEstimatedClockResolution() -> uint64_t; 17 | 18 | class Timer { 19 | uint64_t m_nanoseconds = 0; 20 | public: 21 | void start(); 22 | auto getElapsedNanoseconds() const -> uint64_t; 23 | auto getElapsedMicroseconds() const -> uint64_t; 24 | auto getElapsedMilliseconds() const -> unsigned int; 25 | auto getElapsedSeconds() const -> double; 26 | }; 27 | 28 | } // namespace Catch 29 | 30 | #endif // TWOBLUECUBES_CATCH_TIMER_H_INCLUDED 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_to_string.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 9/5/2018. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED 8 | #define TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED 9 | 10 | #include 11 | 12 | #include "catch_compiler_capabilities.h" 13 | #include "catch_stream.h" 14 | 15 | namespace Catch { 16 | template 17 | std::string to_string(T const& t) { 18 | #if defined(CATCH_CONFIG_CPP11_TO_STRING) 19 | return std::to_string(t); 20 | #else 21 | ReusableStringStream rss; 22 | rss << t; 23 | return rss.str(); 24 | #endif 25 | } 26 | } // end namespace Catch 27 | 28 | #endif // TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_totals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil Nash on 23/02/2012. 3 | * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED 9 | #define TWOBLUECUBES_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::size_t total() const; 20 | bool allPassed() const; 21 | bool allOk() const; 22 | 23 | std::size_t passed = 0; 24 | std::size_t failed = 0; 25 | std::size_t failedButOk = 0; 26 | }; 27 | 28 | struct Totals { 29 | 30 | Totals operator - ( Totals const& other ) const; 31 | Totals& operator += ( Totals const& other ); 32 | 33 | Totals delta( Totals const& prevTotals ) const; 34 | 35 | int error = 0; 36 | Counts assertions; 37 | Counts testCases; 38 | }; 39 | } 40 | 41 | #endif // TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED 42 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_uncaught_exceptions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Josh on 1/2/2018. 3 | * Copyright 2018 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_compiler_capabilities.h" 10 | #include "catch_uncaught_exceptions.h" 11 | #include "catch_config_uncaught_exceptions.hpp" 12 | 13 | #include 14 | 15 | namespace Catch { 16 | bool uncaught_exceptions() { 17 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 18 | return false; 19 | #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 20 | return std::uncaught_exceptions() > 0; 21 | #else 22 | return std::uncaught_exception(); 23 | #endif 24 | } 25 | } // end namespace Catch 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_uncaught_exceptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Josh on 1/2/2018. 3 | * Copyright 2018 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED 10 | 11 | namespace Catch { 12 | bool uncaught_exceptions(); 13 | } // end namespace Catch 14 | 15 | #endif // TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_user_interfaces.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 21/11/2017. 3 | * 4 | * This file collects declaration that we want to expose to test files. 5 | * These declarations are expected to be duplicated elsewhere, 6 | * together with their implementation. 7 | * 8 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | */ 11 | #ifndef TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED 12 | #define TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED 13 | 14 | namespace Catch { 15 | unsigned int rngSeed(); 16 | } 17 | 18 | #endif // TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED 19 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_version.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 14/11/2012. 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch_version.h" 10 | #include 11 | 12 | namespace Catch { 13 | 14 | Version::Version 15 | ( unsigned int _majorVersion, 16 | unsigned int _minorVersion, 17 | unsigned int _patchNumber, 18 | char const * const _branchName, 19 | unsigned int _buildNumber ) 20 | : majorVersion( _majorVersion ), 21 | minorVersion( _minorVersion ), 22 | patchNumber( _patchNumber ), 23 | branchName( _branchName ), 24 | buildNumber( _buildNumber ) 25 | {} 26 | 27 | std::ostream& operator << ( std::ostream& os, Version const& version ) { 28 | os << version.majorVersion << '.' 29 | << version.minorVersion << '.' 30 | << version.patchNumber; 31 | // branchName is never null -> 0th char is \0 if it is empty 32 | if (version.branchName[0]) { 33 | os << '-' << version.branchName 34 | << '.' << version.buildNumber; 35 | } 36 | return os; 37 | } 38 | 39 | Version const& libraryVersion() { 40 | static Version version( 2, 13, 9, "", 0 ); 41 | return version; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 13/11/2012. 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_VERSION_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_VERSION_H_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 // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED 40 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_wildcard_pattern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 13/7/2015. 3 | * Copyright 2015 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 9 | #define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 10 | 11 | #include "catch_common.h" 12 | 13 | 14 | namespace Catch 15 | { 16 | class WildcardPattern { 17 | enum WildcardPosition { 18 | NoWildcard = 0, 19 | WildcardAtStart = 1, 20 | WildcardAtEnd = 2, 21 | WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd 22 | }; 23 | 24 | public: 25 | 26 | WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); 27 | virtual ~WildcardPattern() = default; 28 | virtual bool matches( std::string const& str ) const; 29 | 30 | private: 31 | std::string normaliseString( std::string const& str ) const; 32 | CaseSensitive::Choice m_caseSensitivity; 33 | WildcardPosition m_wildcard = NoWildcard; 34 | std::string m_pattern; 35 | }; 36 | } 37 | 38 | #endif // TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED 39 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/internal/catch_windows_h_proxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 16/01/2017. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #ifndef TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED 10 | 11 | #include "catch_platform.h" 12 | 13 | #if defined(CATCH_PLATFORM_WINDOWS) 14 | 15 | #if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) 16 | # define CATCH_DEFINED_NOMINMAX 17 | # define NOMINMAX 18 | #endif 19 | #if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) 20 | # define CATCH_DEFINED_WIN32_LEAN_AND_MEAN 21 | # define WIN32_LEAN_AND_MEAN 22 | #endif 23 | 24 | #ifdef __AFXDLL 25 | #include 26 | #else 27 | #include 28 | #endif 29 | 30 | #ifdef CATCH_DEFINED_NOMINMAX 31 | # undef NOMINMAX 32 | #endif 33 | #ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN 34 | # undef WIN32_LEAN_AND_MEAN 35 | #endif 36 | 37 | #endif // defined(CATCH_PLATFORM_WINDOWS) 38 | 39 | #endif // TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED 40 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/include/reporters/catch_reporter_compact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin Moene on 2013-12-05. 3 | * Copyright 2012 Martin Moene. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | #ifndef TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED 9 | #define TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED 10 | 11 | 12 | #include "catch_reporter_bases.hpp" 13 | 14 | 15 | namespace Catch { 16 | 17 | struct CompactReporter : StreamingReporterBase { 18 | 19 | using StreamingReporterBase::StreamingReporterBase; 20 | 21 | ~CompactReporter() override; 22 | 23 | static std::string getDescription(); 24 | 25 | void noMatchingTestCases(std::string const& spec) override; 26 | 27 | void assertionStarting(AssertionInfo const&) override; 28 | 29 | bool 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 // TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED 40 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(CatchCoverageHelper) 4 | 5 | add_executable(CoverageHelper coverage-helper.cpp) 6 | set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD 11) 7 | set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD_REQUIRED ON) 8 | set_property(TARGET CoverageHelper PROPERTY CXX_EXTENSIONS OFF) 9 | if (MSVC) 10 | target_compile_options( CoverageHelper PRIVATE /W4 /w44265 /WX /w44061 /w44062 ) 11 | endif() 12 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/misc/appveyorBuildConfigurationScript.bat: -------------------------------------------------------------------------------- 1 | SETLOCAL EnableDelayedExpansion 2 | 3 | @REM # Possibilities: 4 | @REM # Debug build + coverage 5 | @REM # Debug build + examples 6 | @REM # Debug build + --- 7 | @REM # Release build 8 | if "%CONFIGURATION%"=="Debug" ( 9 | if "%coverage%"=="1" ( 10 | @REM # coverage needs to build the special helper as well as the main 11 | cmake -Hmisc -Bbuild-misc -A%PLATFORM% || exit /b !ERRORLEVEL! 12 | cmake --build build-misc || exit /b !ERRORLEVEL! 13 | cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind || exit /b !ERRORLEVEL! || exit /b !ERRORLEVEL! 14 | ) else ( 15 | @REM # We know that coverage is 0 16 | python scripts\generateSingleHeader.py || exit /b !ERRORLEVEL! 17 | cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=%examples% -DCATCH_BUILD_EXTRA_TESTS=%examples% || exit /b !ERRORLEVEL! 18 | ) 19 | ) 20 | if "%CONFIGURATION%"=="Release" ( 21 | cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% || exit /b !ERRORLEVEL! 22 | ) 23 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/misc/appveyorMergeCoverageScript.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | import glob 4 | import subprocess 5 | 6 | if __name__ == '__main__': 7 | cov_files = list(glob.glob('projects/cov-report*.bin')) 8 | base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files] 9 | subprocess.check_call(base_cmd) 10 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/misc/appveyorTestRunScript.bat: -------------------------------------------------------------------------------- 1 | SETLOCAL EnableDelayedExpansion 2 | 3 | cd Build 4 | if "%CONFIGURATION%"=="Debug" ( 5 | if "%coverage%"=="1" ( 6 | ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck || exit /b !ERRORLEVEL! 7 | python ..\misc\appveyorMergeCoverageScript.py || exit /b !ERRORLEVEL! 8 | codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% || exit /b !ERRORLEVEL! 9 | ) else ( 10 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! 11 | ) 12 | ) 13 | if "%CONFIGURATION%"=="Release" ( 14 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! 15 | ) 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/misc/installOpenCppCoverage.ps1: -------------------------------------------------------------------------------- 1 | # Downloads are done from the official github release page links 2 | $downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.7.0/OpenCppCoverageSetup-x64-0.9.7.0.exe" 3 | $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe") 4 | 5 | if(-Not (Test-Path $installerPath)) { 6 | Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl) 7 | Start-FileDownload $downloadUrl -FileName $installerPath 8 | } 9 | 10 | Write-Host -ForegroundColor White "About to install OpenCppCoverage..." 11 | 12 | $installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait) 13 | if($installProcess.ExitCode -ne 0) { 14 | throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode) 15 | } 16 | 17 | # Assume standard, boring, installation path of ".../Program Files/OpenCppCoverage" 18 | $installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage") 19 | $env:Path="$env:Path;$installPath" 20 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/ToDo.txt: -------------------------------------------------------------------------------- 1 | Configuration options that are left default and thus are not properly tested 2 | yet: 3 | 4 | CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases 5 | CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows 6 | CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed 7 | CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit 8 | CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals 9 | CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap 10 | CATCH_CONFIG_DEFAULT_REPORTER 11 | CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS 12 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X02-DisabledMacros.cpp: -------------------------------------------------------------------------------- 1 | // X02-DisabledMacros.cpp 2 | // Test that CATCH_CONFIG_DISABLE turns off TEST_CASE autoregistration 3 | // and expressions in assertion macros are not run. 4 | 5 | #define CATCH_CONFIG_MAIN 6 | #include 7 | 8 | 9 | // CATCH_CONFIG_DISABLE also prevents reporter registration. 10 | // We need to manually register at least one reporter for our tests 11 | static Catch::ReporterRegistrar temporary( "console" ); 12 | 13 | #include 14 | 15 | struct foo { 16 | foo(){ 17 | REQUIRE_NOTHROW( print() ); 18 | } 19 | void print() const { 20 | std::cout << "This should not happen\n"; 21 | } 22 | }; 23 | 24 | // Construct foo, but `foo::print` should not be run 25 | foo f; 26 | 27 | // This test should not be run, because it won't be registered 28 | TEST_CASE( "Disabled Macros" ) { 29 | 30 | CAPTURE( 1 ); 31 | CAPTURE( 1, "captured" ); 32 | 33 | std::cout << "This should not happen\n"; 34 | FAIL(); 35 | } 36 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #include 3 | 4 | TEST_CASE("Tests that run") { 5 | // All of these should be run and be reported 6 | CHECK(1 == 2); 7 | CHECK(1 == 1); 8 | CHECK(1 != 3); 9 | CHECK(1 == 4); 10 | } 11 | 12 | 13 | 14 | TEST_CASE("Tests that abort") { 15 | // Avoid abort and other exceptional exits -- there is no way 16 | // to tell CMake that abort is the desired outcome of a test. 17 | std::set_terminate([](){exit(1);}); 18 | REQUIRE(1 == 1); 19 | REQUIRE(1 != 2); 20 | REQUIRE(1 == 3); 21 | // We should not get here, because the test above aborts 22 | REQUIRE(1 != 4); 23 | } 24 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER 2 | 3 | #define CATCH_CONFIG_MAIN 4 | #include 5 | 6 | namespace Catch { 7 | [[noreturn]] 8 | void throw_exception(std::exception const& e) { 9 | Catch::cerr() << "====== CUSTOM HANDLER ====== run terminates because an exception was thrown.\n" 10 | << "The message was: " << e.what() << '\n'; 11 | // Avoid abort and other exceptional exits -- there is no way 12 | // to tell CMake that abort is the desired outcome of a test. 13 | exit(1); 14 | } 15 | } 16 | 17 | TEST_CASE("Tests that run") { 18 | // All of these should be run and be reported 19 | CHECK(1 == 2); 20 | CHECK(1 == 1); 21 | CHECK(1 != 3); 22 | CHECK(1 == 4); 23 | } 24 | 25 | 26 | 27 | TEST_CASE("Tests that abort") { 28 | REQUIRE(1 == 1); 29 | REQUIRE(1 != 2); 30 | REQUIRE(1 == 3); 31 | // We should not get here, because the test above aborts 32 | REQUIRE(1 != 4); 33 | } 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X10-FallbackStringifier.cpp: -------------------------------------------------------------------------------- 1 | // X10-FallbackStringifier.cpp 2 | // Test that defining fallbackStringifier compiles 3 | 4 | #include 5 | 6 | // A catch-all stringifier 7 | template 8 | std::string fallbackStringifier(T const&) { 9 | return "{ !!! }"; 10 | } 11 | 12 | #define CATCH_CONFIG_MAIN 13 | #include 14 | 15 | struct foo { 16 | explicit operator bool() const { 17 | return true; 18 | } 19 | }; 20 | 21 | TEST_CASE("aa") { 22 | REQUIRE(foo{}); 23 | } 24 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X11-DisableStringification.cpp: -------------------------------------------------------------------------------- 1 | // X11-DisableStringification.cpp 2 | // Test that stringification of original expression can be disabled 3 | // this is a workaround for VS 2017 issue with Raw String literal 4 | // and preprocessor token pasting. In other words, hopefully this test 5 | // will be deleted soon :-) 6 | 7 | #define CATCH_CONFIG_MAIN 8 | #include 9 | 10 | struct Hidden {}; 11 | 12 | bool operator==(Hidden, Hidden) { return true; } 13 | 14 | TEST_CASE("DisableStringification") { 15 | REQUIRE( Hidden{} == Hidden{} ); 16 | } 17 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X12-CustomDebugBreakMacro.cpp: -------------------------------------------------------------------------------- 1 | // X12-CustomDebugBreakMacro.cpp 2 | // Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. 3 | 4 | #include 5 | 6 | void custom_debug_break() { 7 | std::cerr << "Pretty please, break into debugger\n"; 8 | } 9 | 10 | #define CATCH_BREAK_INTO_DEBUGGER() custom_debug_break() 11 | 12 | #define CATCH_CONFIG_MAIN 13 | #include 14 | 15 | TEST_CASE("Failing test that breaks into debugger", "[macros]") { 16 | REQUIRE(1 == 2); 17 | } 18 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/ExtraTests/X90-WindowsHeaderInclusion.cpp: -------------------------------------------------------------------------------- 1 | // X90-WindowsHeaderInclusion.cpp 2 | // Test that the Catch2 header compiles even after including windows.h 3 | // without defining NOMINMAX first. As an FYI, if you do that, you are 4 | // wrong. 5 | 6 | #include 7 | #define CATCH_CONFIG_MAIN 8 | #include 9 | 10 | TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") { 11 | SUCCEED(); 12 | } 13 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/CompileTimePerfTests/10.tests.cpp: -------------------------------------------------------------------------------- 1 | // Include set of usage tests multiple times - for compile-time performance testing 2 | // (do not run) 3 | 4 | #include "All.tests.cpp" 5 | #include "All.tests.cpp" 6 | #include "All.tests.cpp" 7 | #include "All.tests.cpp" 8 | #include "All.tests.cpp" 9 | #include "All.tests.cpp" 10 | #include "All.tests.cpp" 11 | #include "All.tests.cpp" 12 | #include "All.tests.cpp" 13 | #include "All.tests.cpp" 14 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/CompileTimePerfTests/100.tests.cpp: -------------------------------------------------------------------------------- 1 | // Include set of usage tests multiple times - for compile-time performance testing 2 | // (do not run) 3 | 4 | #include "10.tests.cpp" 5 | #include "10.tests.cpp" 6 | #include "10.tests.cpp" 7 | #include "10.tests.cpp" 8 | #include "10.tests.cpp" 9 | #include "10.tests.cpp" 10 | #include "10.tests.cpp" 11 | #include "10.tests.cpp" 12 | #include "10.tests.cpp" 13 | #include "10.tests.cpp" 14 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/CompileTimePerfTests/All.tests.cpp: -------------------------------------------------------------------------------- 1 | // include set of usage tests into one file for compiler performance test purposes 2 | // This whole file can now be included multiple times in 10.tests.cpp, and *that* 3 | // file included multiple times (in 100.tests.cpp) 4 | 5 | // Note that the intention is only for these files to be compiled. They will 6 | // fail at runtime due to the re-user of test case names 7 | 8 | #include "../UsageTests/Approx.tests.cpp" 9 | #include "../UsageTests/BDD.tests.cpp" 10 | #include "../UsageTests/Class.tests.cpp" 11 | #include "../UsageTests/Compilation.tests.cpp" 12 | #include "../UsageTests/Condition.tests.cpp" 13 | #include "../UsageTests/Exception.tests.cpp" 14 | #include "../UsageTests/Matchers.tests.cpp" 15 | #include "../UsageTests/Misc.tests.cpp" 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/IntrospectiveTests/Details.tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 3 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | */ 5 | 6 | #include "catch.hpp" 7 | 8 | #if defined(_MSC_VER) 9 | #pragma warning(push) 10 | #pragma warning(disable:4702) // unreachable code in the macro expansions 11 | #endif 12 | 13 | TEST_CASE("Check that our error handling macros throw the right exceptions", "[!throws][internals][approvals]") { 14 | REQUIRE_THROWS_AS(CATCH_INTERNAL_ERROR(""), std::logic_error); 15 | REQUIRE_THROWS_AS(CATCH_ERROR(""), std::domain_error); 16 | REQUIRE_THROWS_AS(CATCH_RUNTIME_ERROR(""), std::runtime_error); 17 | REQUIRE_THROWS_AS([](){CATCH_ENFORCE(false, "");}(), std::domain_error); 18 | REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}()); 19 | } 20 | 21 | #if defined(_MSC_VER) 22 | #pragma warning(pop) // unreachable code in the macro expansions 23 | #endif 24 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 06/10/2019. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch.hpp" 9 | 10 | #include "internal/catch_random_number_generator.h" 11 | 12 | TEST_CASE("Our PCG implementation provides expected results for known seeds", "[rng]") { 13 | Catch::SimplePcg32 rng; 14 | SECTION("Default seeded") { 15 | REQUIRE(rng() == 0xfcdb943b); 16 | REQUIRE(rng() == 0x6f55b921); 17 | REQUIRE(rng() == 0x4c17a916); 18 | REQUIRE(rng() == 0x71eae25f); 19 | REQUIRE(rng() == 0x6ce7909c); 20 | } 21 | SECTION("Specific seed") { 22 | rng.seed(0xabcd1234); 23 | REQUIRE(rng() == 0x57c08495); 24 | REQUIRE(rng() == 0x33c956ac); 25 | REQUIRE(rng() == 0x2206fd76); 26 | REQUIRE(rng() == 0x3501a35b); 27 | REQUIRE(rng() == 0xfdffb30f); 28 | 29 | // Also check repeated output after reseeding 30 | rng.seed(0xabcd1234); 31 | REQUIRE(rng() == 0x57c08495); 32 | REQUIRE(rng() == 0x33c956ac); 33 | REQUIRE(rng() == 0x2206fd76); 34 | REQUIRE(rng() == 0x3501a35b); 35 | REQUIRE(rng() == 0xfdffb30f); 36 | } 37 | } 38 | 39 | TEST_CASE("Comparison ops", "[rng]") { 40 | using Catch::SimplePcg32; 41 | REQUIRE(SimplePcg32{} == SimplePcg32{}); 42 | REQUIRE(SimplePcg32{ 0 } != SimplePcg32{}); 43 | REQUIRE_FALSE(SimplePcg32{ 1 } == SimplePcg32{ 2 }); 44 | REQUIRE_FALSE(SimplePcg32{ 1 } != SimplePcg32{ 1 }); 45 | } 46 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/Misc/invalid-test-names.input: -------------------------------------------------------------------------------- 1 | Test with special, characters in \" name 2 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/Misc/plain-old-tests.input: -------------------------------------------------------------------------------- 1 | random SECTION tests 2 | nested SECTION tests 3 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/Misc/special-characters-in-file.input: -------------------------------------------------------------------------------- 1 | Test with special\, characters \"in name 2 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_console_colour.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_suppress_warnings.h" 3 | #include "internal/catch_console_colour.h" 4 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_debugger.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_debugger.h" 3 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp: -------------------------------------------------------------------------------- 1 | #include "internal/catch_suppress_warnings.h" 2 | #include "internal/catch_interfaces_reporter.h" 3 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_option.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_suppress_warnings.h" 3 | #include "internal/catch_option.hpp" 4 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_stream.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_suppress_warnings.h" 3 | #include "internal/catch_stream.h" 4 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_test_case_tracker.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_test_case_tracker.h" 3 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_test_spec.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_suppress_warnings.h" 3 | #include "internal/catch_test_spec.h" 4 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp: -------------------------------------------------------------------------------- 1 | // This file is only here to verify (to the extent possible) the self sufficiency of the header 2 | #include "internal/catch_suppress_warnings.h" 3 | #include "internal/catch_xmlwriter.h" 4 | #include "internal/catch_reenable_warnings.h" 5 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/TestMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 22/10/2010. 3 | * Copyright 2010 Two Blue Cubes Ltd 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #define CATCH_CONFIG_MAIN 10 | #include "catch.hpp" 11 | 12 | // These reporters are not included in the single include, so must be included separately in the main file 13 | #include "reporters/catch_reporter_teamcity.hpp" 14 | #include "reporters/catch_reporter_tap.hpp" 15 | #include "reporters/catch_reporter_automake.hpp" 16 | #include "reporters/catch_reporter_sonarqube.hpp" 17 | 18 | 19 | // Some example tag aliases 20 | CATCH_REGISTER_TAG_ALIAS( "[@nhf]", "[failing]~[.]" ) 21 | CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" ) 22 | 23 | 24 | #ifdef __clang__ 25 | # pragma clang diagnostic ignored "-Wpadded" 26 | # pragma clang diagnostic ignored "-Wweak-vtables" 27 | # pragma clang diagnostic ignored "-Wc++98-compat" 28 | #endif 29 | 30 | struct TestListener : Catch::TestEventListenerBase { 31 | using TestEventListenerBase::TestEventListenerBase; // inherit constructor 32 | }; 33 | CATCH_REGISTER_LISTENER( TestListener ) 34 | 35 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/TimingTests/Sleep.tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. 3 | * 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | #include "catch.hpp" 9 | 10 | #include 11 | #include 12 | 13 | TEST_CASE( "sleep_for_100ms", "[.min_duration_test][approvals]" ) 14 | { 15 | std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); 16 | CHECK( true ); 17 | } 18 | 19 | TEST_CASE( "sleep_for_250ms", "[.min_duration_test][approvals]" ) 20 | { 21 | std::this_thread::sleep_for( std::chrono::milliseconds( 250 ) ); 22 | CHECK( true ); 23 | } 24 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/Decomposition.tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Martin on 27/5/2017. 3 | * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | namespace { 13 | 14 | struct truthy { 15 | truthy(bool b):m_value(b){} 16 | operator bool() const { 17 | return false; 18 | } 19 | bool m_value; 20 | }; 21 | 22 | std::ostream& operator<<(std::ostream& o, truthy) { 23 | o << "Hey, its truthy!"; 24 | return o; 25 | } 26 | 27 | } // end anonymous namespace 28 | 29 | #include "catch.hpp" 30 | 31 | TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") { 32 | CHECK(truthy(false)); 33 | } 34 | 35 | TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition]") { 36 | FILE* fptr = nullptr; 37 | REQUIRE(fptr == 0); 38 | REQUIRE(fptr == 0l); 39 | } 40 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/ToStringByte.tests.cpp: -------------------------------------------------------------------------------- 1 | #include "catch.hpp" 2 | 3 | #if defined(CATCH_CONFIG_CPP17_BYTE) 4 | 5 | TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) { 6 | using type = std::byte; 7 | REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); 8 | } 9 | 10 | TEST_CASE( "std::vector -> toString", "[toString][byte][approvals]" ) { 11 | using type = std::vector; 12 | REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) ); 13 | } 14 | 15 | #endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE 16 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/ToStringOptional.tests.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER 2 | #include "catch.hpp" 3 | 4 | #if defined(CATCH_CONFIG_CPP17_OPTIONAL) 5 | 6 | TEST_CASE( "std::optional -> toString", "[toString][optional][approvals]" ) { 7 | using type = std::optional; 8 | REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); 9 | REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); 10 | } 11 | 12 | TEST_CASE( "std::optional -> toString", "[toString][optional][approvals]" ) { 13 | using type = std::optional; 14 | REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); 15 | REQUIRE( "\"abc\"" == ::Catch::Detail::stringify( type{ "abc" } ) ); 16 | } 17 | 18 | TEST_CASE( "std::vector > -> toString", "[toString][optional][approvals]" ) { 19 | using type = std::vector >; 20 | REQUIRE( "{ 0, { }, 2 }" == ::Catch::Detail::stringify( type{ 0, {}, 2 } ) ); 21 | } 22 | 23 | #endif // CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL 24 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/ToStringPair.tests.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER 2 | #include "catch.hpp" 3 | 4 | TEST_CASE( "std::pair -> toString", "[toString][pair]" ) { 5 | std::pair value( 34, "xyzzy" ); 6 | REQUIRE( ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" ); 7 | } 8 | 9 | TEST_CASE( "std::pair -> toString", "[toString][pair]" ) { 10 | std::pair value( 34, "xyzzy" ); 11 | REQUIRE( ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" ); 12 | } 13 | 14 | TEST_CASE( "std::vector > -> toString", "[toString][pair]" ) { 15 | std::vector > pr; 16 | pr.push_back( std::make_pair("green", 55 ) ); 17 | REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" ); 18 | } 19 | 20 | // This is pretty contrived - I figure if this works, anything will... 21 | TEST_CASE( "pair > -> toString", "[toString][pair]" ) { 22 | typedef std::pair left_t; 23 | typedef std::pair right_t; 24 | 25 | left_t left( 42, "Arthur" ); 26 | right_t right( "Ford", 24 ); 27 | 28 | std::pair pair( left, right ); 29 | REQUIRE( ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" ); 30 | } 31 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/ToStringTuple.tests.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER 2 | #include "catch.hpp" 3 | 4 | #include 5 | 6 | TEST_CASE( "tuple<>", "[toString][tuple]" ) 7 | { 8 | typedef std::tuple<> type; 9 | CHECK( "{ }" == ::Catch::Detail::stringify(type{}) ); 10 | type value {}; 11 | CHECK( "{ }" == ::Catch::Detail::stringify(value) ); 12 | } 13 | 14 | TEST_CASE( "tuple", "[toString][tuple]" ) 15 | { 16 | typedef std::tuple type; 17 | CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) ); 18 | } 19 | 20 | 21 | TEST_CASE( "tuple", "[toString][tuple]" ) 22 | { 23 | typedef std::tuple type; 24 | CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) ); 25 | CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) ); 26 | } 27 | 28 | TEST_CASE( "tuple", "[toString][tuple]" ) 29 | { 30 | typedef std::tuple type; 31 | CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) ); 32 | } 33 | 34 | TEST_CASE( "tuple,tuple<>,float>", "[toString][tuple]" ) 35 | { 36 | typedef std::tuple,std::tuple<>,float> type; 37 | type value { std::tuple{42}, {}, 1.2f }; 38 | CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) ); 39 | } 40 | 41 | TEST_CASE( "tuple", "[toString][tuple]" ) 42 | { 43 | typedef std::tuple type; 44 | type value { nullptr, 42, "Catch me" }; 45 | CHECK( "{ nullptr, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) ); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/UsageTests/VariadicMacros.tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by Phil on 15/03/2013. 3 | * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "catch.hpp" 10 | 11 | 12 | TEST_CASE() 13 | { 14 | SUCCEED( "anonymous test case" ); 15 | } 16 | 17 | TEST_CASE( "Test case with one argument" ) 18 | { 19 | SUCCEED( "no assertions" ); 20 | } 21 | 22 | TEST_CASE( "Variadic macros", "[variadic][sections]" ) 23 | { 24 | SECTION( "Section with one argument" ) 25 | { 26 | SUCCEED( "no assertions" ); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/SelfTest/WarnAboutNoTests.cmake: -------------------------------------------------------------------------------- 1 | # Workaround for a peculiarity where CTest disregards the return code from a 2 | # test command if a PASS_REGULAR_EXPRESSION is also set 3 | execute_process( 4 | COMMAND ${CMAKE_ARGV3} -w NoTests "___nonexistent_test___" 5 | RESULT_VARIABLE ret 6 | OUTPUT_VARIABLE out 7 | ) 8 | 9 | message("${out}") 10 | 11 | if(NOT ${ret} MATCHES "^[0-9]+$") 12 | message(FATAL_ERROR "${ret}") 13 | endif() 14 | 15 | if(${ret} EQUAL 0) 16 | message(FATAL_ERROR "Expected nonzero return code") 17 | elseif(${out} MATCHES "Helper failed with") 18 | message(FATAL_ERROR "Helper failed") 19 | endif() 20 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/XCode/OCTest/OCTest/CatchOCTestCase.h: -------------------------------------------------------------------------------- 1 | // 2 | // CatchOCTestCase.h 3 | // OCTest 4 | // 5 | // Created by Phil on 13/11/2010. 6 | // Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | #ifndef TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED 11 | #define TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED 12 | 13 | #include "catch.hpp" 14 | 15 | #import 16 | #import "TestObj.h" 17 | 18 | @interface TestFixture : NSObject 19 | { 20 | TestObj* obj; 21 | } 22 | 23 | @end 24 | 25 | #endif // TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/XCode/OCTest/OCTest/Main.mm: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #import "catch.hpp" 3 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/XCode/OCTest/OCTest/OCTest.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * OCTest.mm 3 | * OCTest 4 | * 5 | * Created by Phil on 13/11/2010. 6 | * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 7 | * 8 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | * 11 | */ 12 | 13 | #import "catch.hpp" 14 | 15 | #import "TestObj.h" 16 | 17 | TEST_CASE( "OCTest/TestObj", "tests TestObj" ) 18 | { 19 | TestObj* obj = [[TestObj alloc] init]; 20 | 21 | REQUIRE( obj.int_val == 0 ); 22 | 23 | obj.int_val = 1; 24 | 25 | REQUIRE( obj.int_val == 1 ); 26 | 27 | arcSafeRelease( obj ); 28 | } 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/XCode/OCTest/OCTest/TestObj.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestObj.h 3 | // OCTest 4 | // 5 | // Created by Phil on 13/11/2010. 6 | // Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | #ifndef TWOBLUECUBES_TESTOBJ_H_INCLUDED 11 | #define TWOBLUECUBES_TESTOBJ_H_INCLUDED 12 | 13 | #import 14 | 15 | 16 | @interface TestObj : NSObject { 17 | 18 | int int_val; 19 | } 20 | 21 | -(BOOL) isTrue; 22 | -(BOOL) isFalse; 23 | 24 | @property (nonatomic, assign ) int int_val; 25 | 26 | @end 27 | 28 | #endif // TWOBLUECUBES_TESTOBJ_H_INCLUDED 29 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/projects/XCode/OCTest/OCTest/TestObj.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestObj.m 3 | // OCTest 4 | // 5 | // Created by Phil on 13/11/2010. 6 | // Copyright 2010 Two Blue Cubes Ltd. All rights reserved. 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | #import "TestObj.h" 12 | 13 | 14 | @implementation TestObj 15 | 16 | @synthesize int_val; 17 | 18 | -(BOOL) isTrue { 19 | return YES; 20 | } 21 | -(BOOL) isFalse { 22 | return NO; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/approve.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import os 6 | import sys 7 | import shutil 8 | import glob 9 | from scriptCommon import catchPath 10 | 11 | rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' ) 12 | 13 | if len(sys.argv) > 1: 14 | files = [os.path.join( rootPath, f ) for f in sys.argv[1:]] 15 | else: 16 | files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) ) 17 | 18 | 19 | def approveFile( approvedFile, unapprovedFile ): 20 | justFilename = unapprovedFile[len(rootPath)+1:] 21 | if os.path.exists( unapprovedFile ): 22 | if os.path.exists( approvedFile ): 23 | os.remove( approvedFile ) 24 | os.rename( unapprovedFile, approvedFile ) 25 | print( "approved " + justFilename ) 26 | else: 27 | print( "approval file " + justFilename + " does not exist" ) 28 | 29 | if files: 30 | for unapprovedFile in files: 31 | approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile ) 32 | else: 33 | print( "no files to approve" ) 34 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/benchmarkRunner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import subprocess, os, sys 4 | import xml.etree.ElementTree as ET 5 | from collections import defaultdict 6 | from statistics import median, stdev 7 | from datetime import datetime 8 | 9 | def get_commit_hash(): 10 | res = subprocess.run('git rev-parse HEAD'.split(), check=True, stdout=subprocess.PIPE, universal_newlines=True) 11 | return res.stdout.strip() 12 | 13 | if len(sys.argv) < 2: 14 | print('Usage: {} benchmark-binary'.format(sys.argv[0])) 15 | exit(1) 16 | 17 | 18 | num_runs = 10 19 | data = defaultdict(list) 20 | 21 | 22 | def parse_file(file): 23 | 24 | def recursive_search(node): 25 | if node.tag == 'TestCase': 26 | results = node.find('OverallResult') 27 | time = results.get('durationInSeconds') 28 | data[node.get('name')].append(float(time)) 29 | elif node.tag in ('Group', 'Catch'): 30 | for child in node: 31 | recursive_search(child) 32 | 33 | tree = ET.parse(file) 34 | recursive_search(tree.getroot()) 35 | 36 | def run_benchmarks(binary): 37 | call = [binary] + '-d yes -r xml -o'.split() 38 | for i in range(num_runs): 39 | file = 'temp{}.xml'.format(i) 40 | print('Run number {}'.format(i)) 41 | subprocess.run(call + [file]) 42 | parse_file(file) 43 | # Remove file right after parsing, because benchmark output can be big 44 | os.remove(file) 45 | 46 | 47 | # Run benchmarks 48 | run_benchmarks(sys.argv[1]) 49 | 50 | result_file = '{:%Y-%m-%dT%H-%M-%S}-{}.result'.format(datetime.now(), get_commit_hash()) 51 | 52 | 53 | print('Writing results to {}'.format(result_file)) 54 | with open(result_file, 'w') as file: 55 | for k in sorted(data): 56 | file.write('{}: median: {} (s), stddev: {} (s)\n'.format(k, median(data[k]), stdev(data[k]))) 57 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/developBuild.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementBuildNumber() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/embedClara.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Execute this script any time you import a new copy of Clara into the third_party area 4 | import os 5 | import sys 6 | import embed 7 | 8 | rootPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0]))) 9 | 10 | filename = os.path.join( rootPath, "third_party", "clara.hpp" ) 11 | outfilename = os.path.join( rootPath, "include", "external", "clara.hpp" ) 12 | 13 | 14 | # Mapping of pre-processor identifiers 15 | idMap = { 16 | "CLARA_HPP_INCLUDED": "CATCH_CLARA_HPP_INCLUDED", 17 | "CLARA_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_CONFIG_CONSOLE_WIDTH", 18 | "CLARA_TEXTFLOW_HPP_INCLUDED": "CATCH_CLARA_TEXTFLOW_HPP_INCLUDED", 19 | "CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH", 20 | "CLARA_PLATFORM_WINDOWS": "CATCH_PLATFORM_WINDOWS" 21 | } 22 | 23 | # outer namespace to add 24 | outerNamespace = { "clara": ("Catch", "clara") } 25 | 26 | mapper = embed.LineMapper( idMap, outerNamespace ) 27 | mapper.mapFile( filename, outfilename ) -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/fixWhitespace.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import os 5 | from scriptCommon import catchPath 6 | 7 | def isSourceFile( path ): 8 | return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" ) 9 | 10 | def fixAllFilesInDir( dir ): 11 | changedFiles = 0 12 | for f in os.listdir( dir ): 13 | path = os.path.join( dir,f ) 14 | if os.path.isfile( path ): 15 | if isSourceFile( path ): 16 | if fixFile( path ): 17 | changedFiles += 1 18 | else: 19 | fixAllFilesInDir( path ) 20 | return changedFiles 21 | 22 | def fixFile( path ): 23 | f = open( path, 'r' ) 24 | lines = [] 25 | changed = 0 26 | for line in f: 27 | trimmed = line.rstrip() + "\n" 28 | trimmed = trimmed.replace('\t', ' ') 29 | if trimmed != line: 30 | changed = changed +1 31 | lines.append( trimmed ) 32 | f.close() 33 | if changed > 0: 34 | global changedFiles 35 | changedFiles = changedFiles + 1 36 | print( path + ":" ) 37 | print( " - fixed " + str(changed) + " line(s)" ) 38 | altPath = path + ".backup" 39 | os.rename( path, altPath ) 40 | f2 = open( path, 'w' ) 41 | for line in lines: 42 | f2.write( line ) 43 | f2.close() 44 | os.remove( altPath ) 45 | return True 46 | return False 47 | 48 | changedFiles = fixAllFilesInDir(catchPath) 49 | if changedFiles > 0: 50 | print( "Fixed " + str(changedFiles) + " file(s)" ) 51 | else: 52 | print( "No trailing whitespace found" ) 53 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/majorRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementMajorVersion() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/minorRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementMinorVersion() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/patchRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementPatchNumber() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/scriptCommon.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import subprocess 4 | 5 | 6 | catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0]))) 7 | 8 | def getBuildExecutable(): 9 | if os.name == 'nt': 10 | dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest.exe") 11 | return dir 12 | else: 13 | dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest") 14 | return dir 15 | 16 | 17 | def runAndCapture( args ): 18 | child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE) 19 | lines = [] 20 | line = "" 21 | while True: 22 | out = child.stdout.read(1) 23 | if out == '' and child.poll(): 24 | break 25 | if out != '': 26 | if out == '\n': 27 | lines.append( line ) 28 | line = "" 29 | else: 30 | line = line + out 31 | return lines 32 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/scripts/updateWandbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import json 4 | import os 5 | import urllib.request 6 | import urllib.parse 7 | 8 | 9 | from scriptCommon import catchPath 10 | 11 | def upload(options): 12 | # request_blah = urllib.request.Request('https:// 13 | 14 | request = urllib.request.Request('https://melpon.org/wandbox/api/compile.json', method='POST') 15 | json_bytes = json.dumps(options).encode('utf-8') 16 | request.add_header('Content-Type', 'application/json; charset=utf-8') 17 | request.add_header('Content-Length', len(json_bytes)) 18 | response = urllib.request.urlopen(request, json_bytes) 19 | return json.loads(response.read().decode('utf-8')) 20 | 21 | main_file = ''' 22 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file 23 | #include "catch.hpp" 24 | 25 | unsigned int Factorial( unsigned int number ) { 26 | return number <= 1 ? number : Factorial(number-1)*number; 27 | } 28 | 29 | TEST_CASE( "Factorials are computed", "[factorial]" ) { 30 | REQUIRE( Factorial(1) == 1 ); 31 | REQUIRE( Factorial(2) == 2 ); 32 | REQUIRE( Factorial(3) == 6 ); 33 | REQUIRE( Factorial(10) == 3628800 ); 34 | } 35 | ''' 36 | 37 | def uploadFiles(): 38 | response = upload({ 39 | 'compiler': 'gcc-head', 40 | 'code': main_file, 41 | 'codes': [{ 42 | 'file': 'catch.hpp', 43 | 'code': open(os.path.join(catchPath, 'single_include', 'catch2', 'catch.hpp')).read() 44 | }], 45 | 'options': 'c++11,cpp-no-pedantic,boost-nothing', 46 | 'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE', 47 | 'save': True 48 | }) 49 | 50 | if 'url' in response and 'compiler_error' not in response: 51 | return True, response['url'] 52 | else: 53 | return False, response 54 | -------------------------------------------------------------------------------- /test/unit_tests/Catch2-2.13.9/src/catch_with_main.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #include 3 | -------------------------------------------------------------------------------- /test/unit_tests/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // tests 4 | // 5 | // Created by bwk on 11.05.15. 6 | // Copyright (c) 2015 php. All rights reserved. 7 | // 8 | 9 | // This tells Catch to provide a main() - only do this in one cpp file 10 | #define CATCH_CONFIG_MAIN 11 | 12 | #include 13 | --------------------------------------------------------------------------------