From bd6cfd6ceca4c17b9e7d65506f439f5e278720f5 Mon Sep 17 00:00:00 2001 From: Mark Richins Date: Sat, 29 Nov 2025 20:28:03 -0800 Subject: [PATCH 01/43] Fixed a spelling mistake (#11523) Corrected a spelling error Changed "Raparando" to "Reparando" --- localization/i18n/es/OrcaSlicer_es.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localization/i18n/es/OrcaSlicer_es.po b/localization/i18n/es/OrcaSlicer_es.po index 1f6dcf3b4b..85079d85fe 100644 --- a/localization/i18n/es/OrcaSlicer_es.po +++ b/localization/i18n/es/OrcaSlicer_es.po @@ -685,7 +685,7 @@ msgstr "" "ahora?" msgid "Repairing model object" -msgstr "Raparando modelo" +msgstr "Reparando modelo" msgid "Cut by line" msgstr "Corte por Línea" From 02c8bba8b42912e65e7e99051202afda9bc14ea4 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Fri, 5 Dec 2025 09:03:12 -0300 Subject: [PATCH 02/43] Fix typo in extruder clearance resource name (#11569) Renamed 'param_extruder_clearence.svg' to 'param_extruder_clearance.svg' and updated the corresponding resource reference in Tab.cpp to correct the spelling error. Co-authored-by: Nanashi <53353250+NanashiTheNameless@users.noreply.github.com> --- ...aram_extruder_clearence.svg => param_extruder_clearance.svg} | 0 src/slic3r/GUI/Tab.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename resources/images/{param_extruder_clearence.svg => param_extruder_clearance.svg} (100%) diff --git a/resources/images/param_extruder_clearence.svg b/resources/images/param_extruder_clearance.svg similarity index 100% rename from resources/images/param_extruder_clearence.svg rename to resources/images/param_extruder_clearance.svg diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5c12a960bc..f5f90f1acc 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4413,7 +4413,7 @@ void TabPrinter::build_fff() optgroup->append_line(line); optgroup->append_single_option_line("fan_kickstart"); - optgroup = page->new_optgroup(L("Extruder Clearance"), "param_extruder_clearence"); + optgroup = page->new_optgroup(L("Extruder Clearance"), "param_extruder_clearance"); optgroup->append_single_option_line("extruder_clearance_radius"); optgroup->append_single_option_line("extruder_clearance_height_to_rod"); optgroup->append_single_option_line("extruder_clearance_height_to_lid"); From 52c2a85d28cbeb3a9dd911377c57268d3f107977 Mon Sep 17 00:00:00 2001 From: coryrc Date: Mon, 8 Dec 2025 06:42:11 -0800 Subject: [PATCH 03/43] Fix tests (#10906) * Get libslic3r tests closer to passing I can't get geometry tests to do anything useful. I've added extra output, but it hasn't helped me figure out why they don't work yet. That's also probably the last broken 3mf test doesn't work. The config tests were mostly broken because of config name changes. The placeholder_parser tests have some things that may-or-may-not still apply to Orca. * Vendor a 3.x version of Catch2 Everything is surely broken at this point. * Allow building tests separately from Orca with build_linux.sh * Remove unnecessary log message screwing up ctest Same solution as Prusaslicer * Make 2 TriangleMesh methods const Since they can be. * Move method comment to the header where it belongsc * Add indirectly-included header directly Transform3d IIRC * libslic3r tests converted to Catch2 v3 Still has 3 failing tests, but builds and runs. * Disable 2D convex hull test and comment what I've learned Not sure the best way to solve this yet. * Add diff compare method for DynamicConfig Help the unit test report errors better. * Perl no longer used, remove comment line * Clang-format Config.?pp So difficult to work with ATM * Remove cpp17 unit tests Who gives a shit * Don't need explicit "example" test We have lots of tests to serve as examples. * Leave breadcrumb to enable sla_print tests * Fix serialization of DynamicConfig Add comments to test, because these code paths might not be even used anymore. * Update run_unit_tests to run all the tests By the time I'm done with the PR all tests will either excluded by default or passing, so just do all. * Update how-to-test now that build_linux.sh builds tests separately * Update cmake regenerate instructions Read this online; hopefully works. * Enable slic3rutils test with Catch2 v3 * Port libnest2d and fff_print to Catch2 v3 They build. Many failing. * Add slightly more info to Objects not fit on bed exception * Disable failing fff_print tests from running They're mostly failing for "objects don't fit on bed" for an infinite-sized bed. Given infinite bed is probably only used in tests, it probably was incidentally broken long ago. * Must checkout tests directory in GH Actions So we get the test data * Missed a failing fff_print test * Disable (most/all) broken libnest2d tests Trying all, not checking yet though * Fix Polygon convex/concave detection tests Document the implementation too. Reorganize the tests to be cleaner. * Update the test script to run tests in parallel * Get sla_print tests to build Probably not passing * Don't cause full project rebuild when updating test CMakeLists.txts * Revert "Clang-format Config.?pp" This reverts commit 771e4c0ad2fdbaa26a8fee77030650afacdc5083. --------- Co-authored-by: SoftFever --- .github/workflows/build_all.yml | 1 + CMakeLists.txt | 6 + build_linux.sh | 20 +- cmake/modules/Catch2/Catch.cmake | 175 - cmake/modules/Catch2/CatchAddTests.cmake | 106 - scripts/run_unit_tests.sh | 5 +- src/libslic3r/Config.cpp | 75 + src/libslic3r/Config.hpp | 306 +- src/libslic3r/Geometry.hpp | 1 + src/libslic3r/Model.cpp | 17 +- src/libslic3r/Model.hpp | 1 + src/libslic3r/ModelArrange.hpp | 4 +- src/libslic3r/Polygon.cpp | 57 +- src/libslic3r/PrintConfig.cpp | 13 +- src/libslic3r/PrintConfig.hpp | 3 +- src/libslic3r/PrintConfigConstants.hpp | 7 + src/libslic3r/TriangleMesh.cpp | 4 +- src/libslic3r/TriangleMesh.hpp | 4 +- tests/CMakeLists.txt | 28 +- tests/catch2/CMake/Catch2Config.cmake.in | 9 + tests/catch2/CMake/CatchConfigOptions.cmake | 91 + tests/catch2/CMake/CatchMiscFunctions.cmake | 121 + tests/catch2/CMake/FindGcov.cmake | 157 + tests/catch2/CMake/FindLcov.cmake | 354 + tests/catch2/CMake/Findcodecov.cmake | 258 + tests/catch2/CMake/catch2-with-main.pc.in | 10 + tests/catch2/CMake/catch2.pc.in | 11 + tests/catch2/CMake/llvm-cov-wrapper | 56 + tests/catch2/CMakeLists.txt | 230 + tests/catch2/CMakePresets.json | 40 + tests/catch2/COMMIT | 1 + tests/catch2/VERSION.txt | 2 - tests/catch2/catch.hpp | 17937 ---------------- tests/catch2/catch_reporter_automake.hpp | 62 - tests/catch2/catch_reporter_tap.hpp | 253 - tests/catch2/catch_reporter_teamcity.hpp | 220 - tests/catch2/extras/Catch.cmake | 318 + tests/catch2/extras/CatchAddTests.cmake | 253 + tests/catch2/extras/CatchShardTests.cmake | 72 + tests/catch2/extras/CatchShardTestsImpl.cmake | 52 + .../extras}/ParseAndAddCatchTests.cmake | 277 +- tests/catch2/extras/catch_amalgamated.cpp | 12083 +++++++++++ tests/catch2/extras/catch_amalgamated.hpp | 14314 ++++++++++++ tests/catch2/extras/gdbinit | 16 + tests/catch2/extras/lldbinit | 16 + tests/catch2/src/CMakeLists.txt | 479 + .../src/catch2/benchmark/catch_benchmark.hpp | 146 + .../catch2/benchmark/catch_benchmark_all.hpp | 46 + .../catch2/benchmark/catch_chronometer.cpp | 17 + .../catch2/benchmark/catch_chronometer.hpp | 77 + .../src/catch2/benchmark/catch_clock.hpp | 27 + .../catch2/benchmark/catch_constructor.hpp | 82 + .../catch2/benchmark/catch_environment.hpp | 29 + .../src/catch2/benchmark/catch_estimate.hpp | 25 + .../catch2/benchmark/catch_execution_plan.hpp | 58 + .../src/catch2/benchmark/catch_optimizer.hpp | 78 + .../catch_outlier_classification.hpp | 29 + .../benchmark/catch_sample_analysis.hpp | 31 + .../catch2/benchmark/detail/catch_analyse.cpp | 85 + .../catch2/benchmark/detail/catch_analyse.hpp | 27 + .../detail/catch_benchmark_function.cpp | 23 + .../detail/catch_benchmark_function.hpp | 87 + .../detail/catch_benchmark_stats.hpp | 48 + .../detail/catch_benchmark_stats_fwd.hpp | 23 + .../detail/catch_complete_invoke.hpp | 58 + .../benchmark/detail/catch_estimate_clock.hpp | 126 + .../catch2/benchmark/detail/catch_measure.hpp | 32 + .../catch2/benchmark/detail/catch_repeat.hpp | 36 + .../detail/catch_run_for_at_least.cpp | 31 + .../detail/catch_run_for_at_least.hpp | 65 + .../catch2/benchmark/detail/catch_stats.cpp | 393 + .../catch2/benchmark/detail/catch_stats.hpp | 60 + .../catch2/benchmark/detail/catch_timing.hpp | 29 + tests/catch2/src/catch2/catch_all.hpp | 139 + tests/catch2/src/catch2/catch_approx.cpp | 85 + tests/catch2/src/catch2/catch_approx.hpp | 128 + .../src/catch2/catch_assertion_info.hpp | 28 + .../src/catch2/catch_assertion_result.cpp | 105 + .../src/catch2/catch_assertion_result.hpp | 60 + .../src/catch2/catch_case_sensitive.hpp | 17 + tests/catch2/src/catch2/catch_config.cpp | 273 + tests/catch2/src/catch2/catch_config.hpp | 157 + .../src/catch2/catch_get_random_seed.cpp | 18 + .../src/catch2/catch_get_random_seed.hpp | 18 + tests/catch2/src/catch2/catch_message.cpp | 114 + tests/catch2/src/catch2/catch_message.hpp | 149 + .../catch2/src/catch2/catch_registry_hub.cpp | 105 + .../catch2/src/catch2/catch_section_info.hpp | 42 + tests/catch2/src/catch2/catch_session.cpp | 413 + tests/catch2/src/catch2/catch_session.hpp | 70 + tests/catch2/src/catch2/catch_tag_alias.hpp | 29 + .../catch2/catch_tag_alias_autoregistrar.cpp | 24 + .../catch2/catch_tag_alias_autoregistrar.hpp | 29 + .../src/catch2/catch_template_test_macros.hpp | 124 + .../src/catch2/catch_test_case_info.cpp | 262 + .../src/catch2/catch_test_case_info.hpp | 142 + tests/catch2/src/catch2/catch_test_macros.hpp | 243 + .../catch2/src/catch2/catch_test_run_info.hpp | 22 + tests/catch2/src/catch2/catch_test_spec.cpp | 141 + tests/catch2/src/catch2/catch_test_spec.hpp | 119 + tests/catch2/src/catch2/catch_timer.cpp | 37 + tests/catch2/src/catch2/catch_timer.hpp | 27 + tests/catch2/src/catch2/catch_tostring.cpp | 294 + tests/catch2/src/catch2/catch_tostring.hpp | 651 + tests/catch2/src/catch2/catch_totals.cpp | 65 + tests/catch2/src/catch2/catch_totals.hpp | 41 + .../src/catch2/catch_translate_exception.cpp | 20 + .../src/catch2/catch_translate_exception.hpp | 88 + .../src/catch2/catch_user_config.hpp.in | 247 + tests/catch2/src/catch2/catch_version.cpp | 43 + tests/catch2/src/catch2/catch_version.hpp | 39 + .../src/catch2/catch_version_macros.hpp | 15 + .../generators/catch_generator_exception.cpp | 17 + .../generators/catch_generator_exception.hpp | 31 + .../catch2/generators/catch_generators.cpp | 42 + .../catch2/generators/catch_generators.hpp | 244 + .../generators/catch_generators_adapters.hpp | 242 + .../generators/catch_generators_all.hpp | 30 + .../generators/catch_generators_random.cpp | 41 + .../generators/catch_generators_random.hpp | 107 + .../generators/catch_generators_range.hpp | 111 + .../interfaces/catch_interfaces_all.hpp | 37 + .../interfaces/catch_interfaces_capture.cpp | 20 + .../interfaces/catch_interfaces_capture.hpp | 118 + .../interfaces/catch_interfaces_config.cpp | 13 + .../interfaces/catch_interfaces_config.hpp | 99 + .../catch_interfaces_enum_values_registry.hpp | 47 + .../interfaces/catch_interfaces_exception.cpp | 14 + .../interfaces/catch_interfaces_exception.hpp | 36 + .../catch_interfaces_generatortracker.cpp | 32 + .../catch_interfaces_generatortracker.hpp | 90 + .../catch_interfaces_registry_hub.cpp | 14 + .../catch_interfaces_registry_hub.hpp | 66 + .../interfaces/catch_interfaces_reporter.cpp | 93 + .../interfaces/catch_interfaces_reporter.hpp | 227 + .../catch_interfaces_reporter_factory.cpp | 14 + .../catch_interfaces_reporter_factory.hpp | 45 + .../catch_interfaces_tag_alias_registry.hpp | 29 + .../catch_interfaces_test_invoker.hpp | 23 + .../interfaces/catch_interfaces_testcase.cpp | 13 + .../interfaces/catch_interfaces_testcase.hpp | 30 + .../internal/catch_assertion_handler.cpp | 82 + .../internal/catch_assertion_handler.hpp | 68 + .../catch_case_insensitive_comparisons.cpp | 35 + .../catch_case_insensitive_comparisons.hpp | 30 + .../src/catch2/internal/catch_clara.cpp | 464 + .../src/catch2/internal/catch_clara.hpp | 748 + .../src/catch2/internal/catch_commandline.cpp | 317 + .../src/catch2/internal/catch_commandline.hpp | 21 + .../catch2/internal/catch_compare_traits.hpp | 75 + .../internal/catch_compiler_capabilities.hpp | 467 + .../catch_config_android_logwrite.hpp | 33 + .../catch2/internal/catch_config_counter.hpp | 34 + .../internal/catch_config_prefix_messages.hpp | 29 + .../catch_config_static_analysis_support.hpp | 34 + .../catch_config_uncaught_exceptions.hpp | 46 + .../catch2/internal/catch_config_wchar.hpp | 35 + .../catch2/internal/catch_console_colour.cpp | 286 + .../catch2/internal/catch_console_colour.hpp | 141 + .../catch2/internal/catch_console_width.hpp | 19 + .../internal/catch_container_nonmembers.hpp | 73 + .../src/catch2/internal/catch_context.cpp | 24 + .../src/catch2/internal/catch_context.hpp | 47 + .../catch2/internal/catch_debug_console.cpp | 45 + .../catch2/internal/catch_debug_console.hpp | 17 + .../src/catch2/internal/catch_debugger.cpp | 120 + .../src/catch2/internal/catch_debugger.hpp | 78 + .../src/catch2/internal/catch_decomposer.cpp | 28 + .../src/catch2/internal/catch_decomposer.hpp | 467 + .../internal/catch_deprecation_macro.hpp | 19 + .../src/catch2/internal/catch_enforce.cpp | 41 + .../src/catch2/internal/catch_enforce.hpp | 54 + .../internal/catch_enum_values_registry.cpp | 73 + .../internal/catch_enum_values_registry.hpp | 36 + .../src/catch2/internal/catch_errno_guard.cpp | 16 + .../src/catch2/internal/catch_errno_guard.hpp | 27 + .../catch_exception_translator_registry.cpp | 87 + .../catch_exception_translator_registry.hpp | 29 + .../catch_fatal_condition_handler.cpp | 248 + .../catch_fatal_condition_handler.hpp | 66 + .../internal/catch_floating_point_helpers.cpp | 43 + .../internal/catch_floating_point_helpers.hpp | 108 + .../src/catch2/internal/catch_getenv.cpp | 37 + .../src/catch2/internal/catch_getenv.hpp | 20 + .../catch2/internal/catch_is_permutation.hpp | 141 + .../src/catch2/internal/catch_istream.cpp | 152 + .../src/catch2/internal/catch_istream.hpp | 52 + .../src/catch2/internal/catch_jsonwriter.cpp | 165 + .../src/catch2/internal/catch_jsonwriter.hpp | 121 + .../src/catch2/internal/catch_lazy_expr.cpp | 29 + .../src/catch2/internal/catch_lazy_expr.hpp | 40 + .../catch2/internal/catch_leak_detector.cpp | 38 + .../catch2/internal/catch_leak_detector.hpp | 19 + .../catch2/internal/catch_lifetimebound.hpp | 24 + .../catch2/src/catch2/internal/catch_list.cpp | 120 + .../catch2/src/catch2/internal/catch_list.hpp | 43 + .../catch2/internal/catch_logical_traits.hpp | 44 + .../catch2/src/catch2/internal/catch_main.cpp | 39 + .../catch2/internal/catch_message_info.cpp | 26 + .../catch2/internal/catch_message_info.hpp | 46 + .../catch2/src/catch2/internal/catch_meta.hpp | 47 + .../internal/catch_move_and_forward.hpp | 19 + .../src/catch2/internal/catch_noncopyable.hpp | 29 + .../src/catch2/internal/catch_optional.hpp | 117 + .../catch2/internal/catch_output_redirect.cpp | 339 + .../catch2/internal/catch_output_redirect.hpp | 77 + .../catch2/internal/catch_parse_numbers.cpp | 52 + .../catch2/internal/catch_parse_numbers.hpp | 26 + .../src/catch2/internal/catch_platform.hpp | 43 + .../src/catch2/internal/catch_polyfills.cpp | 42 + .../src/catch2/internal/catch_polyfills.hpp | 21 + .../catch2/internal/catch_preprocessor.hpp | 247 + .../catch_preprocessor_internal_stringify.hpp | 19 + .../catch_preprocessor_remove_parens.hpp | 19 + .../catch_random_floating_point_helpers.hpp | 94 + .../internal/catch_random_integer_helpers.hpp | 224 + .../catch_random_number_generator.cpp | 78 + .../catch_random_number_generator.hpp | 59 + .../internal/catch_random_seed_generation.cpp | 35 + .../internal/catch_random_seed_generation.hpp | 26 + .../internal/catch_reporter_registry.cpp | 91 + .../internal/catch_reporter_registry.hpp | 55 + .../internal/catch_reporter_spec_parser.cpp | 173 + .../internal/catch_reporter_spec_parser.hpp | 85 + .../src/catch2/internal/catch_result_type.hpp | 66 + .../internal/catch_reusable_string_stream.cpp | 70 + .../internal/catch_reusable_string_stream.hpp | 57 + .../src/catch2/internal/catch_run_context.cpp | 838 + .../src/catch2/internal/catch_run_context.hpp | 167 + .../src/catch2/internal/catch_section.cpp | 60 + .../src/catch2/internal/catch_section.hpp | 104 + .../src/catch2/internal/catch_sharding.hpp | 40 + .../src/catch2/internal/catch_singletons.cpp | 36 + .../src/catch2/internal/catch_singletons.hpp | 45 + .../internal/catch_source_line_info.cpp | 33 + .../internal/catch_source_line_info.hpp | 37 + .../catch_startup_exception_registry.cpp | 29 + .../catch_startup_exception_registry.hpp | 29 + .../src/catch2/internal/catch_stdstreams.cpp | 24 + .../src/catch2/internal/catch_stdstreams.hpp | 22 + .../catch2/internal/catch_stream_end_stop.hpp | 30 + .../catch2/internal/catch_string_manip.cpp | 116 + .../catch2/internal/catch_string_manip.hpp | 62 + .../src/catch2/internal/catch_stringref.cpp | 65 + .../src/catch2/internal/catch_stringref.hpp | 126 + .../internal/catch_tag_alias_registry.cpp | 54 + .../internal/catch_tag_alias_registry.hpp | 33 + .../internal/catch_template_test_registry.hpp | 337 + .../internal/catch_test_case_info_hasher.cpp | 39 + .../internal/catch_test_case_info_hasher.hpp | 29 + .../catch_test_case_registry_impl.cpp | 153 + .../catch_test_case_registry_impl.hpp | 59 + .../internal/catch_test_case_tracker.cpp | 239 + .../internal/catch_test_case_tracker.hpp | 245 + .../internal/catch_test_failure_exception.cpp | 31 + .../internal/catch_test_failure_exception.hpp | 34 + .../catch2/internal/catch_test_macro_impl.hpp | 155 + .../catch2/internal/catch_test_registry.cpp | 84 + .../catch2/internal/catch_test_registry.hpp | 222 + .../internal/catch_test_spec_parser.cpp | 239 + .../internal/catch_test_spec_parser.hpp | 81 + .../src/catch2/internal/catch_textflow.cpp | 379 + .../src/catch2/internal/catch_textflow.hpp | 298 + .../catch2/internal/catch_thread_support.hpp | 49 + .../src/catch2/internal/catch_to_string.hpp | 29 + .../internal/catch_uncaught_exceptions.cpp | 25 + .../internal/catch_uncaught_exceptions.hpp | 15 + ...ch_uniform_floating_point_distribution.hpp | 131 + .../catch_uniform_integer_distribution.hpp | 108 + .../src/catch2/internal/catch_unique_name.hpp | 20 + .../src/catch2/internal/catch_unique_ptr.hpp | 118 + .../src/catch2/internal/catch_unreachable.hpp | 56 + .../src/catch2/internal/catch_void_type.hpp | 25 + .../internal/catch_wildcard_pattern.cpp | 47 + .../internal/catch_wildcard_pattern.hpp | 38 + .../catch2/internal/catch_windows_h_proxy.hpp | 28 + .../src/catch2/internal/catch_xmlwriter.cpp | 344 + .../src/catch2/internal/catch_xmlwriter.hpp | 164 + .../src/catch2/matchers/catch_matchers.cpp | 25 + .../src/catch2/matchers/catch_matchers.hpp | 253 + .../catch2/matchers/catch_matchers_all.hpp | 36 + .../catch_matchers_container_properties.cpp | 34 + .../catch_matchers_container_properties.hpp | 90 + .../matchers/catch_matchers_contains.hpp | 102 + .../matchers/catch_matchers_exception.cpp | 26 + .../matchers/catch_matchers_exception.hpp | 61 + .../catch_matchers_floating_point.cpp | 226 + .../catch_matchers_floating_point.hpp | 94 + .../matchers/catch_matchers_predicate.cpp | 17 + .../matchers/catch_matchers_predicate.hpp | 59 + .../matchers/catch_matchers_quantifiers.cpp | 24 + .../matchers/catch_matchers_quantifiers.hpp | 165 + .../matchers/catch_matchers_range_equals.hpp | 160 + .../catch2/matchers/catch_matchers_string.cpp | 114 + .../catch2/matchers/catch_matchers_string.hpp | 85 + .../matchers/catch_matchers_templated.cpp | 41 + .../matchers/catch_matchers_templated.hpp | 308 + .../catch2/matchers/catch_matchers_vector.hpp | 194 + .../matchers/internal/catch_matchers_impl.cpp | 25 + .../matchers/internal/catch_matchers_impl.hpp | 109 + tests/catch2/src/catch2/meson.build | 403 + .../reporters/catch_reporter_automake.cpp | 37 + .../reporters/catch_reporter_automake.hpp | 40 + .../reporters/catch_reporter_common_base.cpp | 49 + .../reporters/catch_reporter_common_base.hpp | 79 + .../reporters/catch_reporter_compact.cpp | 255 + .../reporters/catch_reporter_compact.hpp | 42 + .../reporters/catch_reporter_console.cpp | 670 + .../reporters/catch_reporter_console.hpp | 65 + .../catch_reporter_cumulative_base.cpp | 158 + .../catch_reporter_cumulative_base.hpp | 151 + .../catch_reporter_event_listener.cpp | 40 + .../catch_reporter_event_listener.hpp | 60 + .../reporters/catch_reporter_helpers.cpp | 364 + .../reporters/catch_reporter_helpers.hpp | 95 + .../catch2/reporters/catch_reporter_json.cpp | 373 + .../catch2/reporters/catch_reporter_json.hpp | 94 + .../catch2/reporters/catch_reporter_junit.cpp | 310 + .../catch2/reporters/catch_reporter_junit.hpp | 56 + .../catch2/reporters/catch_reporter_multi.cpp | 199 + .../catch2/reporters/catch_reporter_multi.hpp | 77 + .../reporters/catch_reporter_registrars.cpp | 36 + .../reporters/catch_reporter_registrars.hpp | 133 + .../reporters/catch_reporter_sonarqube.cpp | 162 + .../reporters/catch_reporter_sonarqube.hpp | 60 + .../catch_reporter_streaming_base.cpp | 23 + .../catch_reporter_streaming_base.hpp | 73 + .../catch2/reporters/catch_reporter_tap.cpp | 229 + .../catch2/reporters/catch_reporter_tap.hpp | 43 + .../reporters/catch_reporter_teamcity.cpp | 177 + .../reporters/catch_reporter_teamcity.hpp | 67 + .../catch2/reporters/catch_reporter_xml.cpp | 332 + .../catch2/reporters/catch_reporter_xml.hpp | 64 + .../catch2/reporters/catch_reporters_all.hpp | 41 + tests/catch_main.hpp | 54 - tests/cpp17/CMakeLists.txt | 9 - tests/cpp17/main.cpp | 80 - tests/example/CMakeLists.txt | 6 - tests/example/example_tests_main.cpp | 5 - tests/fff_print/CMakeLists.txt | 5 +- tests/fff_print/fff_print_tests.cpp | 4 +- tests/fff_print/test_data.cpp | 4 +- tests/fff_print/test_extrusion_entity.cpp | 2 +- tests/fff_print/test_fill.cpp | 4 +- tests/fff_print/test_flow.cpp | 24 +- tests/fff_print/test_gcode.cpp | 2 +- tests/fff_print/test_gcodewriter.cpp | 12 +- tests/fff_print/test_model.cpp | 4 +- tests/fff_print/test_print.cpp | 10 +- tests/fff_print/test_printgcode.cpp | 12 +- tests/fff_print/test_printobject.cpp | 16 +- tests/fff_print/test_skirt_brim.cpp | 20 +- tests/fff_print/test_support_material.cpp | 6 +- tests/fff_print/test_trianglemesh.cpp | 2 +- tests/libnest2d/CMakeLists.txt | 12 +- tests/libnest2d/libnest2d_tests_main.cpp | 56 +- tests/libslic3r/CMakeLists.txt | 5 +- tests/libslic3r/libslic3r_tests.cpp | 2 +- tests/libslic3r/test_3mf.cpp | 102 +- tests/libslic3r/test_aabbindirect.cpp | 26 +- tests/libslic3r/test_clipper_offset.cpp | 22 +- tests/libslic3r/test_clipper_utils.cpp | 16 +- tests/libslic3r/test_config.cpp | 176 +- .../test_elephant_foot_compensation.cpp | 2 +- tests/libslic3r/test_geometry.cpp | 134 +- tests/libslic3r/test_hollowing.cpp | 2 +- tests/libslic3r/test_indexed_triangle_set.cpp | 3 +- tests/libslic3r/test_marchingsquares.cpp | 4 +- tests/libslic3r/test_meshboolean.cpp | 6 +- tests/libslic3r/test_mutable_polygon.cpp | 2 +- .../libslic3r/test_mutable_priority_queue.cpp | 3 +- tests/libslic3r/test_optimizers.cpp | 4 +- tests/libslic3r/test_placeholder_parser.cpp | 88 +- tests/libslic3r/test_png_io.cpp | 2 +- tests/libslic3r/test_polygon.cpp | 2 +- tests/libslic3r/test_stl.cpp | 2 +- tests/libslic3r/test_timeutils.cpp | 2 +- tests/libslic3r/test_voronoi.cpp | 9 +- tests/sla_print/CMakeLists.txt | 15 +- tests/sla_print/sla_print_tests.cpp | 14 +- tests/sla_print/sla_print_tests_main.cpp | 12 +- tests/sla_print/sla_raycast_tests.cpp | 16 +- tests/sla_print/sla_supptgen_tests.cpp | 4 +- tests/sla_print/sla_test_utils.cpp | 16 +- tests/sla_print/sla_test_utils.hpp | 8 +- tests/slic3rutils/CMakeLists.txt | 6 +- tests/slic3rutils/slic3rutils_tests_main.cpp | 2 +- tests/update_catch2.sh | 40 + 388 files changed, 59565 insertions(+), 19524 deletions(-) delete mode 100644 cmake/modules/Catch2/Catch.cmake delete mode 100644 cmake/modules/Catch2/CatchAddTests.cmake create mode 100644 src/libslic3r/PrintConfigConstants.hpp create mode 100644 tests/catch2/CMake/Catch2Config.cmake.in create mode 100644 tests/catch2/CMake/CatchConfigOptions.cmake create mode 100644 tests/catch2/CMake/CatchMiscFunctions.cmake create mode 100644 tests/catch2/CMake/FindGcov.cmake create mode 100644 tests/catch2/CMake/FindLcov.cmake create mode 100644 tests/catch2/CMake/Findcodecov.cmake create mode 100644 tests/catch2/CMake/catch2-with-main.pc.in create mode 100644 tests/catch2/CMake/catch2.pc.in create mode 100755 tests/catch2/CMake/llvm-cov-wrapper create mode 100644 tests/catch2/CMakeLists.txt create mode 100644 tests/catch2/CMakePresets.json create mode 100644 tests/catch2/COMMIT delete mode 100644 tests/catch2/VERSION.txt delete mode 100644 tests/catch2/catch.hpp delete mode 100644 tests/catch2/catch_reporter_automake.hpp delete mode 100644 tests/catch2/catch_reporter_tap.hpp delete mode 100644 tests/catch2/catch_reporter_teamcity.hpp create mode 100644 tests/catch2/extras/Catch.cmake create mode 100644 tests/catch2/extras/CatchAddTests.cmake create mode 100644 tests/catch2/extras/CatchShardTests.cmake create mode 100644 tests/catch2/extras/CatchShardTestsImpl.cmake rename {cmake/modules/Catch2 => tests/catch2/extras}/ParseAndAddCatchTests.cmake (50%) create mode 100644 tests/catch2/extras/catch_amalgamated.cpp create mode 100644 tests/catch2/extras/catch_amalgamated.hpp create mode 100644 tests/catch2/extras/gdbinit create mode 100644 tests/catch2/extras/lldbinit create mode 100644 tests/catch2/src/CMakeLists.txt create mode 100644 tests/catch2/src/catch2/benchmark/catch_benchmark.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_benchmark_all.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_chronometer.cpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_chronometer.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_clock.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_constructor.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_environment.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_estimate.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_execution_plan.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_optimizer.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_outlier_classification.hpp create mode 100644 tests/catch2/src/catch2/benchmark/catch_sample_analysis.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_analyse.cpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_analyse.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_benchmark_stats.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_measure.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_repeat.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_stats.cpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_stats.hpp create mode 100644 tests/catch2/src/catch2/benchmark/detail/catch_timing.hpp create mode 100644 tests/catch2/src/catch2/catch_all.hpp create mode 100644 tests/catch2/src/catch2/catch_approx.cpp create mode 100644 tests/catch2/src/catch2/catch_approx.hpp create mode 100644 tests/catch2/src/catch2/catch_assertion_info.hpp create mode 100644 tests/catch2/src/catch2/catch_assertion_result.cpp create mode 100644 tests/catch2/src/catch2/catch_assertion_result.hpp create mode 100644 tests/catch2/src/catch2/catch_case_sensitive.hpp create mode 100644 tests/catch2/src/catch2/catch_config.cpp create mode 100644 tests/catch2/src/catch2/catch_config.hpp create mode 100644 tests/catch2/src/catch2/catch_get_random_seed.cpp create mode 100644 tests/catch2/src/catch2/catch_get_random_seed.hpp create mode 100644 tests/catch2/src/catch2/catch_message.cpp create mode 100644 tests/catch2/src/catch2/catch_message.hpp create mode 100644 tests/catch2/src/catch2/catch_registry_hub.cpp create mode 100644 tests/catch2/src/catch2/catch_section_info.hpp create mode 100644 tests/catch2/src/catch2/catch_session.cpp create mode 100644 tests/catch2/src/catch2/catch_session.hpp create mode 100644 tests/catch2/src/catch2/catch_tag_alias.hpp create mode 100644 tests/catch2/src/catch2/catch_tag_alias_autoregistrar.cpp create mode 100644 tests/catch2/src/catch2/catch_tag_alias_autoregistrar.hpp create mode 100644 tests/catch2/src/catch2/catch_template_test_macros.hpp create mode 100644 tests/catch2/src/catch2/catch_test_case_info.cpp create mode 100644 tests/catch2/src/catch2/catch_test_case_info.hpp create mode 100644 tests/catch2/src/catch2/catch_test_macros.hpp create mode 100644 tests/catch2/src/catch2/catch_test_run_info.hpp create mode 100644 tests/catch2/src/catch2/catch_test_spec.cpp create mode 100644 tests/catch2/src/catch2/catch_test_spec.hpp create mode 100644 tests/catch2/src/catch2/catch_timer.cpp create mode 100644 tests/catch2/src/catch2/catch_timer.hpp create mode 100644 tests/catch2/src/catch2/catch_tostring.cpp create mode 100644 tests/catch2/src/catch2/catch_tostring.hpp create mode 100644 tests/catch2/src/catch2/catch_totals.cpp create mode 100644 tests/catch2/src/catch2/catch_totals.hpp create mode 100644 tests/catch2/src/catch2/catch_translate_exception.cpp create mode 100644 tests/catch2/src/catch2/catch_translate_exception.hpp create mode 100644 tests/catch2/src/catch2/catch_user_config.hpp.in create mode 100644 tests/catch2/src/catch2/catch_version.cpp create mode 100644 tests/catch2/src/catch2/catch_version.hpp create mode 100644 tests/catch2/src/catch2/catch_version_macros.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generator_exception.cpp create mode 100644 tests/catch2/src/catch2/generators/catch_generator_exception.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators.cpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators_adapters.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators_all.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators_random.cpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators_random.hpp create mode 100644 tests/catch2/src/catch2/generators/catch_generators_range.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_all.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_capture.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_capture.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_config.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_config.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_exception.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_exception.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_test_invoker.hpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp create mode 100644 tests/catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_assertion_handler.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_assertion_handler.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_clara.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_clara.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_commandline.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_commandline.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_compare_traits.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_compiler_capabilities.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_android_logwrite.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_counter.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_prefix_messages.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_static_analysis_support.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_config_wchar.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_console_colour.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_console_colour.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_console_width.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_container_nonmembers.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_context.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_context.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_debug_console.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_debug_console.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_debugger.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_debugger.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_decomposer.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_decomposer.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_deprecation_macro.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_enforce.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_enforce.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_enum_values_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_enum_values_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_errno_guard.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_errno_guard.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_exception_translator_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_exception_translator_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_fatal_condition_handler.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_fatal_condition_handler.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_floating_point_helpers.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_floating_point_helpers.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_getenv.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_getenv.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_is_permutation.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_istream.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_istream.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_jsonwriter.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_jsonwriter.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_lazy_expr.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_lazy_expr.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_leak_detector.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_leak_detector.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_lifetimebound.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_list.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_list.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_logical_traits.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_main.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_message_info.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_message_info.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_meta.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_move_and_forward.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_noncopyable.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_optional.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_output_redirect.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_output_redirect.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_parse_numbers.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_parse_numbers.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_platform.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_polyfills.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_polyfills.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_preprocessor.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_preprocessor_internal_stringify.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_floating_point_helpers.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_integer_helpers.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_number_generator.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_number_generator.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_seed_generation.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_random_seed_generation.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_reporter_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_reporter_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_reporter_spec_parser.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_reporter_spec_parser.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_result_type.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_reusable_string_stream.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_reusable_string_stream.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_run_context.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_run_context.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_section.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_section.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_sharding.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_singletons.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_singletons.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_source_line_info.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_source_line_info.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_startup_exception_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_startup_exception_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_stdstreams.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_stdstreams.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_stream_end_stop.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_string_manip.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_string_manip.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_stringref.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_stringref.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_tag_alias_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_tag_alias_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_template_test_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_info_hasher.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_info_hasher.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_registry_impl.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_registry_impl.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_tracker.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_case_tracker.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_failure_exception.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_failure_exception.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_macro_impl.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_registry.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_registry.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_spec_parser.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_test_spec_parser.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_textflow.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_textflow.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_thread_support.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_to_string.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_uncaught_exceptions.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_uncaught_exceptions.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_uniform_floating_point_distribution.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_uniform_integer_distribution.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_unique_name.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_unique_ptr.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_unreachable.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_void_type.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_wildcard_pattern.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_wildcard_pattern.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_windows_h_proxy.hpp create mode 100644 tests/catch2/src/catch2/internal/catch_xmlwriter.cpp create mode 100644 tests/catch2/src/catch2/internal/catch_xmlwriter.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_all.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_container_properties.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_container_properties.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_contains.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_exception.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_exception.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_floating_point.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_floating_point.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_predicate.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_predicate.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_range_equals.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_string.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_string.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_templated.cpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_templated.hpp create mode 100644 tests/catch2/src/catch2/matchers/catch_matchers_vector.hpp create mode 100644 tests/catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp create mode 100644 tests/catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp create mode 100644 tests/catch2/src/catch2/meson.build create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_automake.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_automake.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_common_base.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_common_base.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_compact.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_compact.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_console.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_console.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_event_listener.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_event_listener.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_helpers.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_helpers.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_json.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_json.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_junit.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_junit.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_multi.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_multi.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_registrars.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_registrars.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_tap.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_tap.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_teamcity.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_teamcity.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_xml.cpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporter_xml.hpp create mode 100644 tests/catch2/src/catch2/reporters/catch_reporters_all.hpp delete mode 100644 tests/catch_main.hpp delete mode 100644 tests/cpp17/CMakeLists.txt delete mode 100644 tests/cpp17/main.cpp delete mode 100644 tests/example/CMakeLists.txt delete mode 100644 tests/example/example_tests_main.cpp create mode 100755 tests/update_catch2.sh diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 5c8e93d819..a44787485f 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -90,6 +90,7 @@ jobs: sparse-checkout: | .github scripts + tests - name: Apt-Install Dependencies uses: ./.github/actions/apt-install-deps - name: Restore Test Artifact diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4d58c513..f2fe7fd414 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ if ( (MSVC OR WIN32) AND (${CMAKE_VERSION} VERSION_LESS "3.5") ) message(FATAL_ERROR "CMake current version ${CMAKE_VERSION} is too old. Minimum required is 3.5.") endif() +# The following line used to be in tests/CMakeLists.txt +# Having it there causes rebuilds of all targets on any CMakeLists.txt change under tests/ +# It has no effect on how code is compiled or linked. +# It just lets you later do `set_property(TARGET foo PROPERTY FOLDER "bar")` +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + if (WIN32) # Detect known CI environments set(IS_CI FALSE) diff --git a/build_linux.sh b/build_linux.sh index 1f35b464f6..9a9a9160ba 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -27,7 +27,6 @@ function usage() { echo " -L: use ld.lld as linker (if available)" echo "For a first use, you want to './${SCRIPT_NAME} -u'" echo " and then './${SCRIPT_NAME} -dsi'" - echo "To build with tests: './${SCRIPT_NAME} -st' or './${SCRIPT_NAME} -dst'" } SLIC3R_PRECOMPILED_HEADERS="ON" @@ -102,11 +101,6 @@ if [ ${OPTIND} -eq 1 ] ; then exit 1 fi -if [[ -n "${BUILD_TESTS}" ]] && [[ -z "${BUILD_ORCA}" ]] ; then - echo "-t flag requires -s flag in the same invocation" - exit 1 -fi - function check_available_memory_and_disk() { FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev) MIN_MEM_GB=10 @@ -221,7 +215,7 @@ if [[ -n "${BUILD_DEPS}" ]] ; then print_and_run cmake --build deps/$BUILD_DIR fi -if [[ -n "${BUILD_ORCA}" ]] ; then +if [[ -n "${BUILD_ORCA}" ]] || [[ -n "${BUILD_TESTS}" ]] ; then echo "Configuring OrcaSlicer..." if [[ -n "${CLEAN_BUILD}" ]] ; then print_and_run rm -fr $BUILD_DIR @@ -243,11 +237,13 @@ if [[ -n "${BUILD_ORCA}" ]] ; then "${COLORED_OUTPUT}" \ "${BUILD_ARGS[@]}" echo "done" - echo "Building OrcaSlicer ..." - print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer - echo "Building OrcaSlicer_profile_validator .." - print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator - ./scripts/run_gettext.sh + if [[ -n "${BUILD_ORCA}" ]]; then + echo "Building OrcaSlicer ..." + print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer + echo "Building OrcaSlicer_profile_validator .." + print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator + ./scripts/run_gettext.sh + fi if [[ -n "${BUILD_TESTS}" ]] ; then echo "Building tests ..." print_and_run cmake --build ${BUILD_DIR} --config "${BUILD_CONFIG}" --target tests/all diff --git a/cmake/modules/Catch2/Catch.cmake b/cmake/modules/Catch2/Catch.cmake deleted file mode 100644 index 0ffe978dc5..0000000000 --- a/cmake/modules/Catch2/Catch.cmake +++ /dev/null @@ -1,175 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -Catch ------ - -This module defines a function to help use the Catch test framework. - -The :command:`catch_discover_tests` discovers tests by asking the compiled test -executable to enumerate its tests. This does not require CMake to be re-run -when tests change. However, it may not work in a cross-compiling environment, -and setting test properties is less convenient. - -This command is intended to replace use of :command:`add_test` to register -tests, and will create a separate CTest test for each Catch test case. Note -that this is in some cases less efficient, as common set-up and tear-down logic -cannot be shared by multiple test cases executing in the same instance. -However, it provides more fine-grained pass/fail information to CTest, which is -usually considered as more beneficial. By default, the CTest test name is the -same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``. - -.. command:: catch_discover_tests - - Automatically add tests with CTest by querying the compiled test executable - for available tests:: - - catch_discover_tests(target - [TEST_SPEC arg1...] - [EXTRA_ARGS arg1...] - [WORKING_DIRECTORY dir] - [TEST_PREFIX prefix] - [TEST_SUFFIX suffix] - [PROPERTIES name1 value1...] - [TEST_LIST var] - ) - - ``catch_discover_tests`` sets up a post-build command on the test executable - that generates the list of tests by parsing the output from running the test - with the ``--list-test-names-only`` argument. This ensures that the full - list of tests is obtained. Since test discovery occurs at build time, it is - not necessary to re-run CMake when the list of tests changes. - However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set - in order to function in a cross-compiling environment. - - Additionally, setting properties on tests is somewhat less convenient, since - the tests are not available at CMake time. Additional test properties may be - assigned to the set of tests as a whole using the ``PROPERTIES`` option. If - more fine-grained test control is needed, custom content may be provided - through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES` - directory property. The set of discovered tests is made accessible to such a - script via the ``_TESTS`` variable. - - The options are: - - ``target`` - Specifies the Catch executable, which must be a known CMake executable - target. CMake will substitute the location of the built executable when - running the test. - - ``TEST_SPEC arg1...`` - Specifies test cases, wildcarded test cases, tags and tag expressions to - pass to the Catch executable with the ``--list-test-names-only`` argument. - - ``EXTRA_ARGS arg1...`` - Any extra arguments to pass on the command line to each test case. - - ``WORKING_DIRECTORY dir`` - Specifies the directory in which to run the discovered test cases. If this - option is not provided, the current binary directory is used. - - ``TEST_PREFIX prefix`` - Specifies a ``prefix`` to be prepended to the name of each discovered test - case. This can be useful when the same test executable is being used in - multiple calls to ``catch_discover_tests()`` but with different - ``TEST_SPEC`` or ``EXTRA_ARGS``. - - ``TEST_SUFFIX suffix`` - Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of - every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may - be specified. - - ``PROPERTIES name1 value1...`` - Specifies additional properties to be set on all tests discovered by this - invocation of ``catch_discover_tests``. - - ``TEST_LIST var`` - Make the list of tests available in the variable ``var``, rather than the - default ``_TESTS``. This can be useful when the same test - executable is being used in multiple calls to ``catch_discover_tests()``. - Note that this variable is only available in CTest. - -#]=======================================================================] - -#------------------------------------------------------------------------------ -function(catch_discover_tests TARGET) - cmake_parse_arguments( - "" - "" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST" - "TEST_SPEC;EXTRA_ARGS;PROPERTIES" - ${ARGN} - ) - - if(NOT _WORKING_DIRECTORY) - set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - endif() - if(NOT _TEST_LIST) - set(_TEST_LIST ${TARGET}_TESTS) - endif() - - ## Generate a unique name based on the extra arguments - string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}") - string(SUBSTRING ${args_hash} 0 7 args_hash) - - # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake") - get_property(crosscompiling_emulator - TARGET ${TARGET} - PROPERTY CROSSCOMPILING_EMULATOR - ) - add_custom_command( - TARGET ${TARGET} POST_BUILD - BYPRODUCTS "${ctest_tests_file}" - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TARGET=${TARGET}" - -D "TEST_EXECUTABLE=$" - -D "TEST_EXECUTOR=${crosscompiling_emulator}" - -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" - -D "TEST_SPEC=${_TEST_SPEC}" - -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" - -D "TEST_PROPERTIES=${_PROPERTIES}" - -D "TEST_PREFIX='${_TEST_PREFIX}'" - -D "TEST_SUFFIX='${_TEST_SUFFIX}'" - -D "TEST_LIST=${_TEST_LIST}" - -D "CTEST_FILE=${ctest_tests_file}" - -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" - VERBATIM - ) - - file(WRITE "${ctest_include_file}" - "if(EXISTS \"${ctest_tests_file}\")\n" - " include(\"${ctest_tests_file}\")\n" - "else()\n" - " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n" - "endif()\n" - ) - - if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") - # Add discovered tests to directory TEST_INCLUDE_FILES - set_property(DIRECTORY - APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}" - ) - else() - # Add discovered tests as directory TEST_INCLUDE_FILE if possible - get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET) - if (NOT ${test_include_file_set}) - set_property(DIRECTORY - PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}" - ) - else() - message(FATAL_ERROR - "Cannot set more than one TEST_INCLUDE_FILE" - ) - endif() - endif() - -endfunction() - -############################################################################### - -set(_CATCH_DISCOVER_TESTS_SCRIPT - ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake -) diff --git a/cmake/modules/Catch2/CatchAddTests.cmake b/cmake/modules/Catch2/CatchAddTests.cmake deleted file mode 100644 index ca5ebc17e5..0000000000 --- a/cmake/modules/Catch2/CatchAddTests.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -set(prefix "${TEST_PREFIX}") -set(suffix "${TEST_SUFFIX}") -set(spec ${TEST_SPEC}) -set(extra_args ${TEST_EXTRA_ARGS}) -set(properties ${TEST_PROPERTIES}) -set(script) -set(suite) -set(tests) - -function(add_command NAME) - set(_args "") - foreach(_arg ${ARGN}) - if(_arg MATCHES "[^-./:a-zA-Z0-9_]") - set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument - else() - set(_args "${_args} ${_arg}") - endif() - endforeach() - set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE) -endfunction() - -macro(_add_catch_test_labels LINE) - # convert to list of tags - string(REPLACE "][" "]\\;[" tags ${line}) - - add_command( - set_tests_properties "${prefix}${test}${suffix}" - PROPERTIES - LABELS "${tags}" - ) -endmacro() - -macro(_add_catch_test LINE) - set(test ${line}) - # use escape commas to handle properly test cases with commans inside the name - string(REPLACE "," "\\," test_name ${test}) - # ...and add to script - add_command( - add_test "${prefix}${test}${suffix}" - ${TEST_EXECUTOR} - "${TEST_EXECUTABLE}" - "${test_name}" - ${extra_args} - ) - - add_command( - set_tests_properties "${prefix}${test}${suffix}" - PROPERTIES - WORKING_DIRECTORY "${TEST_WORKING_DIR}" - ${properties} - ) - list(APPEND tests "${prefix}${test}${suffix}") -endmacro() - -# Run test executable to get list of available tests -if(NOT EXISTS "${TEST_EXECUTABLE}") - message(FATAL_ERROR - "Specified test executable '${TEST_EXECUTABLE}' does not exist" - ) -endif() -execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-tests - OUTPUT_VARIABLE output - RESULT_VARIABLE result -) -# Catch --list-test-names-only reports the number of tests, so 0 is... surprising -if(${result} EQUAL 0) - message(WARNING - "Test executable '${TEST_EXECUTABLE}' contains no tests!\n" - ) -elseif(${result} LESS 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${result}\n" - " Output: ${output}\n" - ) -endif() - -string(REPLACE "\n" ";" output "${output}") -set(test) -set(tags_regex "(\\[([^\\[]*)\\])+$") - -# Parse output -foreach(line ${output}) - # lines without leading whitespaces are catch output not tests - if(${line} MATCHES "^[ \t]+") - # strip leading spaces and tabs - string(REGEX REPLACE "^[ \t]+" "" line ${line}) - - if(${line} MATCHES "${tags_regex}") - _add_catch_test_labels(${line}) - else() - _add_catch_test(${line}) - endif() - endif() -endforeach() - -# Create a list of all discovered tests, which users may use to e.g. set -# properties on the tests -add_command(set ${TEST_LIST} ${tests}) - -# Write CTest script -file(WRITE "${CTEST_FILE}" "${script}") diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index 315c14b594..081467b300 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # This file is made to support the unit tests workflow. -# It should only require the directories build/tests and scripts/ to function, +# It should only require the directories build/tests, scripts/, and tests/ to function, # and cmake (with ctest) installed. # (otherwise, update the workflow too, but try to avoid to keep things self-contained) @@ -9,5 +9,4 @@ ROOT_DIR="$(dirname "$0")/.." cd "${ROOT_DIR}" || exit 1 -# TODO: github.com/OrcaSlicer/OrcaSlicer/issues/10309 - Run all tests -ctest --test-dir build/tests/slic3rutils --output-junit "$(pwd)/ctest_results.xml" --output-on-failure +ctest --test-dir build/tests --output-junit "$(pwd)/ctest_results.xml" --output-on-failure -j diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 75935b2177..ce1a8d6799 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -1703,6 +1703,81 @@ t_config_option_keys DynamicConfig::keys() const return keys; } +DynamicConfig::DynamicConfigDifference DynamicConfig::diff_report(const DynamicConfig& rhs) const { + DynamicConfig::DynamicConfigDifference result; + + std::set all_keys; + + for (const auto& kvp : this->options) { + all_keys.insert(kvp.first); + } + for (const auto& kvp : rhs.options) { + all_keys.insert(kvp.first); + } + + for (const auto& key : all_keys) { + auto left_it = this->options.find(key); + auto right_it = rhs.options.find(key); + + bool left_has = (left_it != this->options.end()); + bool right_has = (right_it != rhs.options.end()); + + if (left_has && right_has) { + if (*left_it->second != *right_it->second) { + result.differences[key] = { + left_it->second->serialize(), + right_it->second->serialize() + }; + } + } else if (left_has) { + result.differences[key] = { + left_it->second->serialize(), + std::nullopt + }; + } else if (right_has) { + result.differences[key] = { + std::nullopt, + right_it->second->serialize() + }; + } + } + return result; +} + +std::ostream& operator<<(std::ostream& os, const DynamicConfig::DynamicConfigDifference& diff) { + if (!diff.is_different()) { + os << "Configurations are identical.\n"; + return os; + } + + int missing_right=0, missing_left=0, differ=0; + os << "DynamicConfig Differences Found (" << diff.differences.size() << " keys):\n"; + for (const auto& kvp : diff.differences) { + const auto& key = kvp.first; + const auto& detail = kvp.second; + + os << " Key: **" << key << "**\n"; + + if (detail.is_missing_key()) { + // Determine which side is missing the key + if (detail.left_value.has_value()) { + os << " - **Missing in Right**: Key exists in left config. Value: " << detail.left_value.value() << "\n"; + missing_right++; + } else { + os << " - **Missing in Left**: Key exists in right config. Value: " << detail.right_value.value() << "\n"; + missing_left++; + } + } else if (detail.is_different_value()) { + differ++; + os << " - **Value Differs**:\n"; + os << " -> Left Value: " << detail.left_value.value() << "\n"; + os << " -> Right Value: " << detail.right_value.value() << "\n"; + } + } + os << "Summary: " << missing_right << " missing on right, " << missing_left << " missing on left, and " << differ << " have differing values\n"; + return os; +} + void StaticConfig::set_defaults() { // use defaults from definition diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 98cd75aad1..f99b07c8d2 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -345,15 +345,15 @@ public: virtual void set(const std::vector &rhs) = 0; // Set a single vector item from either a scalar option or the first value of a vector option.vector of ConfigOptions. // This function is useful to split values from multiple extrder / filament settings into separate configurations. - virtual void set_at(const ConfigOption *rhs, size_t i, size_t j) = 0; - //BBS - virtual void set_at_to_nil(size_t i) = 0; - virtual void append(const ConfigOption *rhs) = 0; - virtual void set(const ConfigOption* rhs, size_t start, size_t len) = 0; - virtual void set_with_restore(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int stride) = 0; + virtual void set_at(const ConfigOption* rhs, size_t i, size_t j) = 0; + // BBS + virtual void set_at_to_nil(size_t i) = 0; + virtual void append(const ConfigOption* rhs) = 0; + virtual void set(const ConfigOption* rhs, size_t start, size_t len) = 0; + virtual void set_with_restore(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int stride) = 0; virtual void set_with_restore_2(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int start, int len, bool skip_error = false) = 0; - virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride) = 0; - virtual void set_with_nil(const ConfigOptionVectorBase* rhs, const ConfigOptionVectorBase* inherits, int stride) = 0; + virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride) = 0; + virtual void set_with_nil(const ConfigOptionVectorBase* rhs, const ConfigOptionVectorBase* inherits, int stride) = 0; // Resize the vector of values, copy the newly added values from opt_default if provided. virtual void resize(size_t n, const ConfigOption *opt_default = nullptr) = 0; // Clear the values vector. @@ -504,11 +504,11 @@ public: throw ConfigurationError("ConfigOptionVector::set_with_restore(): Assigning an incompatible type"); } - //set a item related with extruder variants when loading config from filament json, replace the original filament items - //rhs: item from seperate filament config - //restore_index: which index in this vector need to be restored - //start: which index in this vector need to be replaced - //count: how many items in this vector need to be replaced + // set a item related with extruder variants when loading config from filament json, replace the original filament items + // rhs: item from seperate filament config + // restore_index: which index in this vector need to be restored + // start: which index in this vector need to be replaced + // count: how many items in this vector need to be replaced virtual void set_with_restore_2(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int start, int len, bool skip_error = false) override { if (rhs->type() == this->type()) { @@ -565,10 +565,9 @@ public: for (size_t i = 0; i < diff_index.size(); i++) { if (diff_index[i] != -1) { - for (size_t j = 0; j < stride; j++) - { + for (size_t j = 0; j < stride; j++) { if (!other->is_nil(diff_index[i] * stride)) - this->values[i * stride +j] = other->values[diff_index[i] * stride +j]; + this->values[i * stride + j] = other->values[diff_index[i] * stride + j]; } } } @@ -2223,41 +2222,148 @@ public: bool is_scalar() const { return (int(this->type) & int(coVectorType)) == 0; } - template ConfigOption* load_option_from_archive(Archive &archive) const { - if (this->nullable) { - switch (this->type) { - case coFloats: { auto opt = new ConfigOptionFloatsNullable(); archive(*opt); return opt; } - case coInts: { auto opt = new ConfigOptionIntsNullable(); archive(*opt); return opt; } - case coPercents: { auto opt = new ConfigOptionPercentsNullable();archive(*opt); return opt; } - case coBools: { auto opt = new ConfigOptionBoolsNullable(); archive(*opt); return opt; } - case coFloatsOrPercents:{ auto opt = new ConfigOptionFloatsOrPercentsNullable();archive(*opt); return opt; } - default: throw ConfigurationError(std::string("ConfigOptionDef::load_option_from_archive(): Unknown nullable option type for option ") + this->opt_key); - } - } else { - switch (this->type) { - case coFloat: { auto opt = new ConfigOptionFloat(); archive(*opt); return opt; } - case coFloats: { auto opt = new ConfigOptionFloats(); archive(*opt); return opt; } - case coInt: { auto opt = new ConfigOptionInt(); archive(*opt); return opt; } - case coInts: { auto opt = new ConfigOptionInts(); archive(*opt); return opt; } - case coString: { auto opt = new ConfigOptionString(); archive(*opt); return opt; } - case coStrings: { auto opt = new ConfigOptionStrings(); archive(*opt); return opt; } - case coPercent: { auto opt = new ConfigOptionPercent(); archive(*opt); return opt; } - case coPercents: { auto opt = new ConfigOptionPercents(); archive(*opt); return opt; } - case coFloatOrPercent: { auto opt = new ConfigOptionFloatOrPercent(); archive(*opt); return opt; } - case coFloatsOrPercents: { auto opt = new ConfigOptionFloatsOrPercents(); archive(*opt); return opt; } - case coPoint: { auto opt = new ConfigOptionPoint(); archive(*opt); return opt; } - case coPoints: { auto opt = new ConfigOptionPoints(); archive(*opt); return opt; } - case coPoint3: { auto opt = new ConfigOptionPoint3(); archive(*opt); return opt; } - case coBool: { auto opt = new ConfigOptionBool(); archive(*opt); return opt; } - case coBools: { auto opt = new ConfigOptionBools(); archive(*opt); return opt; } - case coEnum: { auto opt = new ConfigOptionEnumGeneric(this->enum_keys_map); archive(*opt); return opt; } + template ConfigOption* load_option_from_archive(Archive& archive) const + { + if (this->nullable) { + switch (this->type) { + case coFloats: { + auto opt = new ConfigOptionFloatsNullable(); + archive(*opt); + return opt; + } + case coInts: { + auto opt = new ConfigOptionIntsNullable(); + archive(*opt); + return opt; + } + case coPercents: { + auto opt = new ConfigOptionPercentsNullable(); + archive(*opt); + return opt; + } + case coBools: { + auto opt = new ConfigOptionBoolsNullable(); + archive(*opt); + return opt; + } + case coFloatsOrPercents: { + auto opt = new ConfigOptionFloatsOrPercentsNullable(); + archive(*opt); + return opt; + } + case coEnums: { + auto opt = new ConfigOptionEnumsGenericNullable(this->enum_keys_map); + archive(*opt); + return opt; + } + default: + throw ConfigurationError( + std::string("ConfigOptionDef::load_option_from_archive(): Unknown nullable option type for option ") + this->opt_key); + } + } else { + switch (this->type) { + case coFloat: { + auto opt = new ConfigOptionFloat(); + archive(*opt); + return opt; + } + case coFloats: { + auto opt = new ConfigOptionFloats(); + archive(*opt); + return opt; + } + case coInt: { + auto opt = new ConfigOptionInt(); + archive(*opt); + return opt; + } + case coInts: { + auto opt = new ConfigOptionInts(); + archive(*opt); + return opt; + } + case coString: { + auto opt = new ConfigOptionString(); + archive(*opt); + return opt; + } + case coStrings: { + auto opt = new ConfigOptionStrings(); + archive(*opt); + return opt; + } + case coPercent: { + auto opt = new ConfigOptionPercent(); + archive(*opt); + return opt; + } + case coPercents: { + auto opt = new ConfigOptionPercents(); + archive(*opt); + return opt; + } + case coFloatOrPercent: { + auto opt = new ConfigOptionFloatOrPercent(); + archive(*opt); + return opt; + } + case coFloatsOrPercents: { + auto opt = new ConfigOptionFloatsOrPercents(); + archive(*opt); + return opt; + } + case coPoint: { + auto opt = new ConfigOptionPoint(); + archive(*opt); + return opt; + } + case coPoints: { + auto opt = new ConfigOptionPoints(); + archive(*opt); + return opt; + } + case coPoint3: { + auto opt = new ConfigOptionPoint3(); + archive(*opt); + return opt; + } + case coBool: { + auto opt = new ConfigOptionBool(); + archive(*opt); + return opt; + } + case coBools: { + auto opt = new ConfigOptionBools(); + archive(*opt); + return opt; + } + case coEnum: { + auto opt = new ConfigOptionEnumGeneric(this->enum_keys_map); + archive(*opt); + return opt; + } // BBS - case coEnums: { auto opt = new ConfigOptionEnumsGeneric(this->enum_keys_map); archive(*opt); return opt; } - case coIntsGroups: { auto opt = new ConfigOptionIntsGroups(); archive(*opt); return opt; } - default: throw ConfigurationError(std::string("ConfigOptionDef::load_option_from_archive(): Unknown option type for option ") + this->opt_key); - } - } - } + case coEnums: { + auto opt = new ConfigOptionEnumsGeneric(this->enum_keys_map); + archive(*opt); + return opt; + } + case coIntsGroups: { + auto opt = new ConfigOptionIntsGroups(); + archive(*opt); + return opt; + } + case coPointsGroups: { + auto opt = new ConfigOptionPointsGroups(); + archive(*opt); + return opt; + } + default: + throw ConfigurationError(std::string("ConfigOptionDef::load_option_from_archive(): Unknown option type for option ") + + this->opt_key); + } + } + } template ConfigOption* save_option_to_archive(Archive &archive, const ConfigOption *opt) const { if (this->nullable) { @@ -2267,35 +2373,41 @@ public: case coPercents: archive(*static_cast(opt));break; case coBools: archive(*static_cast(opt)); break; case coFloatsOrPercents: archive(*static_cast(opt)); break; - default: throw ConfigurationError(std::string("ConfigOptionDef::save_option_to_archive(): Unknown nullable option type for option ") + this->opt_key); - } - } else { - switch (this->type) { - case coFloat: archive(*static_cast(opt)); break; - case coFloats: archive(*static_cast(opt)); break; - case coInt: archive(*static_cast(opt)); break; - case coInts: archive(*static_cast(opt)); break; - case coString: archive(*static_cast(opt)); break; - case coStrings: archive(*static_cast(opt)); break; - case coPercent: archive(*static_cast(opt)); break; - case coPercents: archive(*static_cast(opt)); break; - case coFloatOrPercent: archive(*static_cast(opt)); break; - case coFloatsOrPercents: archive(*static_cast(opt)); break; - case coPoint: archive(*static_cast(opt)); break; - case coPoints: archive(*static_cast(opt)); break; - case coPoint3: archive(*static_cast(opt)); break; - case coBool: archive(*static_cast(opt)); break; - case coBools: archive(*static_cast(opt)); break; - case coEnum: archive(*static_cast(opt)); break; + case coEnums: archive(*static_cast(opt)); break; + default: + throw ConfigurationError( + std::string("ConfigOptionDef::save_option_to_archive(): Unknown nullable option type for option ") + this->opt_key); + } + } else { + switch (this->type) { + case coFloat: archive(*static_cast(opt)); break; + case coFloats: archive(*static_cast(opt)); break; + case coInt: archive(*static_cast(opt)); break; + case coInts: archive(*static_cast(opt)); break; + case coString: archive(*static_cast(opt)); break; + case coStrings: archive(*static_cast(opt)); break; + case coPercent: archive(*static_cast(opt)); break; + case coPercents: archive(*static_cast(opt)); break; + case coFloatOrPercent: archive(*static_cast(opt)); break; + case coFloatsOrPercents: archive(*static_cast(opt)); break; + case coPoint: archive(*static_cast(opt)); break; + case coPoints: archive(*static_cast(opt)); break; + case coPoint3: archive(*static_cast(opt)); break; + case coBool: archive(*static_cast(opt)); break; + case coBools: archive(*static_cast(opt)); break; + case coEnum: archive(*static_cast(opt)); break; // BBS - case coEnums: archive(*static_cast(opt)); break; - case coIntsGroups: archive(*static_cast(opt)); break; - default: throw ConfigurationError(std::string("ConfigOptionDef::save_option_to_archive(): Unknown option type for option ") + this->opt_key); - } - } - // Make the compiler happy, shut up the warnings. - return nullptr; - } + case coEnums: archive(*static_cast(opt)); break; + case coIntsGroups: archive(*static_cast(opt)); break; + case coPointsGroups: archive(*static_cast(opt)); break; + default: + throw ConfigurationError(std::string("ConfigOptionDef::save_option_to_archive(): Unknown option type for option ") + + this->opt_key); + } + } + // Make the compiler happy, shut up the warnings. + return nullptr; + } // Usually empty. // Special values - "i_enum_open", "f_enum_open" to provide combo box for int or float selection, @@ -2514,7 +2626,7 @@ public: template TYPE* option(const t_config_option_key &opt_key, bool create = false) { - ConfigOption *opt = this->optptr(opt_key, create); + ConfigOption* opt = this->optptr(opt_key, create); if (opt != nullptr && opt->type() != TYPE::static_type()) { BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": attempt to access option with wrong type: " << opt_key; return nullptr; @@ -2794,6 +2906,40 @@ public: std::map>::const_iterator cend() const { return options.cend(); } size_t size() const { return options.size(); } + /** + * @brief Detailed information about the difference found for a single key. + */ + struct KeyDifference { + std::optional left_value; + std::optional right_value; + + bool is_missing_key() const { + return !left_value.has_value() || !right_value.has_value(); + } + bool is_different_value() const { + return left_value.has_value() && right_value.has_value() && (left_value.value() != right_value.value()); + } + }; + + /** + * @brief The full report object containing all detected differences. + */ + struct DynamicConfigDifference { + std::map differences; + + bool is_different() const { + return !differences.empty(); + } + }; + + /** + * @brief Computes the symmetric difference between this DynamicConfig (left) + * and another DynamicConfig (rhs). + * @param rhs The right-hand side config to compare against. + * @return DynamicConfigDifference report. + */ + DynamicConfigDifference diff_report(const DynamicConfig& rhs) const; + private: std::map> options; @@ -2801,6 +2947,8 @@ private: template void serialize(Archive &ar) { ar(options); } }; +std::ostream& operator<<(std::ostream& os, const DynamicConfig::DynamicConfigDifference& diff); + // Configuration store with a static definition of configuration values. // In Slic3r, the static configuration stores are during the slicing / g-code generation for efficiency reasons, // because the configuration values could be accessed directly. diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index 2af19aa584..0ae7524fa0 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -4,6 +4,7 @@ #include "libslic3r.h" #include "BoundingBox.hpp" #include "ExPolygon.hpp" +#include "Point.hpp" #include "Polygon.hpp" #include "Polyline.hpp" diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 35af84ff28..8a128d511a 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -647,7 +647,6 @@ ModelMaterial* Model::add_material(t_model_material_id material_id, const ModelM return material; } -// makes sure all objects have at least one instance bool Model::add_default_instances() { // apply a default position to all objects not having one @@ -1641,17 +1640,31 @@ Polygon ModelObject::convex_hull_2d(const Transform3d& trafo_instance) const Points pts; for (const ModelVolume* v : volumes) { - if (v->is_model_part()) + if (v->is_model_part()) { //BBS: use convex hull vertex instead of all append(pts, its_convex_hull_2d_above(v->get_convex_hull().its, (trafo_instance * v->get_matrix()).cast(), 0.0f).points); + // The next commented line instead of the previous + the rest of this #if0 section is the same as PrusaSlicer until https://github.com/prusa3d/PrusaSlicer/commit/2f7f3578d531f2d34f7732a64449606d86bb4aaa where it was parallelised. //append(pts, its_convex_hull_2d_above(v->mesh().its, (trafo_instance * v->get_matrix()).cast(), 0.0f).points); + // its_convex_hull_2d_above calls its_collect_mesh_projection_points_above + // The latter multiplies each vertex by the full matrix + // For every vector which crosses the Z plane, the intersection is used instead of any point below. Consecutive points below the Z plane are ignored. + } } return Geometry::convex_hull(std::move(pts)); #else + // This seems to differ from PrusaSlicer (and the old code above) in that + // points below the Z plane aren't treated specially. Points pts; for (const ModelVolume *v : this->volumes) if (v->is_model_part()) { const Polygon& volume_hull = v->get_convex_hull_2d(trafo_instance); + // In comparison to the old code above, get_convex_hull_2d starts with: + // new_matrix = trafo_instance * m_transformation.get_matrix(); + // which is the same matrix multiplication as above. + // Then checks caches, maybe calling ModelVolume::calculate_convex_hull_2d(const Geometry::Transformation &) if no hit + // That method accesses v->get_convex_hull().its (also used above). + // It multiplies each point by the matrix w/o translate, then calls convex_hull(pts) + // Then translates polygon in X & Y pts.insert(pts.end(), volume_hull.points.begin(), volume_hull.points.end()); } diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index eacd7d8090..35333d6e2e 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -1632,6 +1632,7 @@ public: void delete_material(t_model_material_id material_id); void clear_materials(); + // Make sure all objects have at least one instance bool add_default_instances(); // Returns approximate axis aligned bounding box of this model. BoundingBoxf3 bounding_box_approx() const; diff --git a/src/libslic3r/ModelArrange.hpp b/src/libslic3r/ModelArrange.hpp index b6e661f150..e389eea5f0 100644 --- a/src/libslic3r/ModelArrange.hpp +++ b/src/libslic3r/ModelArrange.hpp @@ -17,9 +17,9 @@ using arrangement::CircleBed; // Do something with ArrangePolygons in virtual beds using VirtualBedFn = std::function; -[[noreturn]] inline void throw_if_out_of_bed(arrangement::ArrangePolygon&) +[[noreturn]] inline void throw_if_out_of_bed(arrangement::ArrangePolygon& ap) { - throw Slic3r::RuntimeError("Objects could not fit on the bed"); + throw Slic3r::RuntimeError("Objects could not fit on the bed; bed_idx==" + std::to_string(ap.bed_idx)); } ArrangePolygons get_arrange_polys(const Model &model, ModelInstancePtrs &instances); diff --git a/src/libslic3r/Polygon.cpp b/src/libslic3r/Polygon.cpp index 0d2e2668c7..9ecc2630d4 100644 --- a/src/libslic3r/Polygon.cpp +++ b/src/libslic3r/Polygon.cpp @@ -4,6 +4,8 @@ #include "Polygon.hpp" #include "Polyline.hpp" +#include + namespace Slic3r { double Polygon::length() const @@ -207,6 +209,7 @@ bool Polygon::intersections(const Line &line, Points *intersections) const } return intersections->size() > intersections_size; } + bool Polygon::overlaps(const Polygons& other) const { if (this->empty() || other.empty()) @@ -219,6 +222,7 @@ bool Polygon::overlaps(const Polygons& other) const // If *this is completely inside other, then pl_out is empty, but the expolygons overlap. Test for that situation. std::any_of(other.begin(), other.end(), [this](auto& poly) {return poly.contains(this->points.front()); }); } + // Filter points from poly to the output with the help of FilterFn. // filter function receives two vectors: // v1: this_point - previous_point @@ -236,8 +240,10 @@ Points filter_points_by_vectors(const Points &poly, FilterFn filter) for (Point p2 : poly) { // p2 is next point to the currently visited point p1. Vec2d v2 = (p2 - p1).cast(); + // std::cerr << ((void*) &poly) << ": p1=" << p1 << "\tp2=" << p2 << "\tv1="< Points filter_convex_concave_points_by_angle_threshold(const Points &poly, double angle_threshold, ConvexConcaveFilterFn convex_concave_filter) { + // The filter function is typically cross2(v1, v2) {>,<} 0 assert(angle_threshold >= 0.); + assert(angle_threshold < M_PI); if (angle_threshold > EPSILON) { - double cos_angle = cos(angle_threshold); - return filter_points_by_vectors(poly, [convex_concave_filter, cos_angle](const Vec2d &v1, const Vec2d &v2){ - return convex_concave_filter(v1, v2) && v1.normalized().dot(v2.normalized()) < cos_angle; + // The methods con{cave,vex}_points are documented as + // "with the angle at the vertex larger than a threshold." + // Due to the imprecision of floating point, this is difficult to get exactly right. + // So I'm adding just enough here that an input of (M_PI/2) does not match a right angle. + // Which doesn't mean it'll be correct for all values. + // And we might learn people actually want "at or larger than threshold" instead. + double cos_threshold = cos(std::nextafter(angle_threshold, +INFINITY)); + return filter_points_by_vectors(poly, [convex_concave_filter, cos_threshold](const Vec2d &v1, const Vec2d &v2){ + if (!convex_concave_filter(v1, v2)) { /*std::cerr << "FIL_FALS";*/ return false; } + // Math lesson: Dot product is the product of the magnitudes and the cos(angle) between them. + // So if we normalize both, their magnitudes are 1 and, thus, the dot product is cos(angle) + // So we want to ensure we only pick angles *bigger* than our angle_threshold + // cos(θ) goes 1->-1 as θ=0->Pi , the opposite direction + // So if we want angle_vectors > angle_threshold + // we must check dot_product_of_vectors < cos(angle_threshold) + auto vec_dot = v1.normalized().dot(v2.normalized()); + // std::cerr << "\tvec_dot="<tooltip = L("Slicing height for each layer. Smaller layer height means more accurate and more printing time."); def->sidetext = L("mm"); // milimeters, CIS languages need translation def->min = 0; - def->set_default_value(new ConfigOptionFloat(0.2)); + def->set_default_value(new ConfigOptionFloat(INITIAL_LAYER_HEIGHT)); def = this->add("printable_height", coFloat); def->label = L("Printable height"); @@ -833,7 +834,7 @@ void PrintConfigDef::init_fff_params() def->category = L("Quality"); def->tooltip = L("Detour to avoid traveling across walls, which may cause blobs on the surface."); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool(false)); + def->set_default_value(new ConfigOptionBool(INITIAL_REDUCE_CROSSING_WALL)); def = this->add("max_travel_detour_distance", coFloatOrPercent); def->label = L("Avoid crossing walls - Max detour length"); @@ -4598,7 +4599,7 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->max = 100; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionInt(0)); + def->set_default_value(new ConfigOptionInt(INITIAL_RAFT_LAYERS)); def = this->add("resolution", coFloat); def->label = L("Resolution"); @@ -9519,10 +9520,10 @@ std::map validate(const FullPrintConfig &cfg, bool und #define PRINT_CONFIG_CACHE_INITIALIZE(CLASSES_SEQ) \ BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CACHE_ELEMENT_DEFINITION, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_SEQ)) \ int print_config_static_initializer() { \ - /* Putting a trace here to avoid the compiler to optimize out this function. */ \ - BOOST_LOG_TRIVIAL(trace) << "Initializing StaticPrintConfigs"; \ + /* For some reason it's important this function doesn't get optimized out, so this should work. */ \ + static volatile int ret = 1; \ BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CACHE_ELEMENT_INITIALIZATION, _, BOOST_PP_TUPLE_TO_SEQ(CLASSES_SEQ)) \ - return 1; \ + return ret; \ } PRINT_CONFIG_CACHE_INITIALIZE(( PrintObjectConfig, PrintRegionConfig, MachineEnvelopeConfig, GCodeConfig, PrintConfig, FullPrintConfig, diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index cc0c765530..338fd5c1a7 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -512,7 +512,7 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType) class DynamicPrintConfig; -// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs. +// Defines each and every configuration option of Slic3r, including the properties of the GUI dialogs. // Does not store the actual values, but defines default values. class PrintConfigDef : public ConfigDef { @@ -563,7 +563,6 @@ double min_object_distance(const ConfigBase &cfg); // The dynamic configuration is also used to store user modifications of the print global parameters, // so the modified configuration values may be diffed against the active configuration // to invalidate the proper slicing resp. g-code generation processing steps. -// This object is mapped to Perl as Slic3r::Config. class DynamicPrintConfig : public DynamicConfig { public: diff --git a/src/libslic3r/PrintConfigConstants.hpp b/src/libslic3r/PrintConfigConstants.hpp new file mode 100644 index 0000000000..5520fbc72e --- /dev/null +++ b/src/libslic3r/PrintConfigConstants.hpp @@ -0,0 +1,7 @@ +#pragma once + +// These are here just for unit testing. + +#define INITIAL_LAYER_HEIGHT 0.2 +#define INITIAL_RAFT_LAYERS 0 +#define INITIAL_REDUCE_CROSSING_WALL false diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index b388d5bd9e..9e08e6f1e0 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -217,12 +217,12 @@ bool TriangleMesh::ReadSTLFile(const char *input_file, bool repair, ImportstlPro return from_stl(stl, repair); } -bool TriangleMesh::write_ascii(const char* output_file) +bool TriangleMesh::write_ascii(const char* output_file) const { return its_write_stl_ascii(output_file, "", this->its); } -bool TriangleMesh::write_binary(const char* output_file) +bool TriangleMesh::write_binary(const char* output_file) const { return its_write_stl_binary(output_file, "", this->its); } diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 927dcfebb0..b963671ce9 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -95,8 +95,8 @@ public: void clear() { this->its.clear(); this->m_stats.clear(); } bool from_stl(stl_file& stl, bool repair = true); bool ReadSTLFile(const char *input_file, bool repair = true, ImportstlProgressFn stlFn = nullptr, int custom_header_length = 80); - bool write_ascii(const char* output_file); - bool write_binary(const char* output_file); + bool write_ascii(const char* output_file) const; + bool write_binary(const char* output_file) const; float volume(); void WriteOBJFile(const char* output_file) const; void scale(float factor); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b97967fe34..409cdede1d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,37 +1,27 @@ -# TODO Add individual tests as executables in separate directories -# add_subirectory() +# Add individual tests as executables in separate directories at the bottom of this file + +add_subdirectory(catch2) set(TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) file(TO_NATIVE_PATH "${TEST_DATA_DIR}" TEST_DATA_DIR) -add_library(Catch2 INTERFACE) -list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/Catch2) -target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR}) -add_library(Catch2::Catch2 ALIAS Catch2) -target_compile_definitions(Catch2 INTERFACE -DCATCH_CONFIG_ENABLE_BENCHMARKING) -if (APPLE) - # OSX builds targeting OSX 10.9 do not support new std::uncought_exception() - # see https://github.com/catchorg/Catch2/issues/1218 - target_compile_definitions(Catch2 INTERFACE -DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) -endif() +include(CTest) include(Catch) -set(CATCH_EXTRA_ARGS "" CACHE STRING "Extra arguments for catch2 test suites.") +set(CATCH_EXTRA_ARGS "" CACHE STRING "Extra arguments for catch2 test suites.") # Unknown if this still works and/or should be replaced with something else. add_library(test_common INTERFACE) target_compile_definitions(test_common INTERFACE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)" CATCH_CONFIG_FAST_COMPILE) -target_link_libraries(test_common INTERFACE Catch2::Catch2) +target_include_directories(test_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if (APPLE) target_link_libraries(test_common INTERFACE "-liconv -framework IOKit" "-framework CoreFoundation" -lc++) endif() -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - add_subdirectory(libnest2d) add_subdirectory(libslic3r) add_subdirectory(slic3rutils) add_subdirectory(fff_print) -# add_subdirectory(sla_print) -add_subdirectory(cpp17 EXCLUDE_FROM_ALL) # does not have to be built all the time -# add_subdirectory(example) +add_subdirectory(sla_print) + + diff --git a/tests/catch2/CMake/Catch2Config.cmake.in b/tests/catch2/CMake/Catch2Config.cmake.in new file mode 100644 index 0000000000..9268138ab3 --- /dev/null +++ b/tests/catch2/CMake/Catch2Config.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +# Avoid repeatedly including the targets +if(NOT TARGET Catch2::Catch2) + # Provide path for scripts + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + + include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake) +endif() diff --git a/tests/catch2/CMake/CatchConfigOptions.cmake b/tests/catch2/CMake/CatchConfigOptions.cmake new file mode 100644 index 0000000000..3621fac0b0 --- /dev/null +++ b/tests/catch2/CMake/CatchConfigOptions.cmake @@ -0,0 +1,91 @@ + +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 + +## +# This file contains options that are materialized into the Catch2 +# compiled library. All of them default to OFF, as even the positive +# forms correspond to the user _forcing_ them to ON, while being OFF +# means that Catch2 can use its own autodetection. +# +# For detailed docs look into docs/configuration.md + +macro(AddOverridableConfigOption OptionBaseName) + option(CATCH_CONFIG_${OptionBaseName} "Read docs/configuration.md for details" OFF) + option(CATCH_CONFIG_NO_${OptionBaseName} "Read docs/configuration.md for details" OFF) + mark_as_advanced(CATCH_CONFIG_${OptionBaseName} CATCH_CONFIG_NO_${OptionBaseName}) +endmacro() + +macro(AddConfigOption OptionBaseName) + option(CATCH_CONFIG_${OptionBaseName} "Read docs/configuration.md for details" OFF) + mark_as_advanced(CATCH_CONFIG_${OptionBaseName}) +endmacro() + +set(_OverridableOptions + "ANDROID_LOGWRITE" + "BAZEL_SUPPORT" + "COLOUR_WIN32" + "COUNTER" + "CPP11_TO_STRING" + "CPP17_BYTE" + "CPP17_OPTIONAL" + "CPP17_STRING_VIEW" + "CPP17_UNCAUGHT_EXCEPTIONS" + "CPP17_VARIANT" + "GLOBAL_NEXTAFTER" + "POSIX_SIGNALS" + "USE_ASYNC" + "WCHAR" + "WINDOWS_SEH" + "GETENV" + "EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT" + "USE_BUILTIN_CONSTANT_P" + "DEPRECATION_ANNOTATIONS" + "EXPERIMENTAL_THREAD_SAFE_ASSERTIONS" +) + +foreach(OptionName ${_OverridableOptions}) + AddOverridableConfigOption(${OptionName}) +endforeach() + +set(_OtherConfigOptions + "DISABLE_EXCEPTIONS" + "DISABLE_EXCEPTIONS_CUSTOM_HANDLER" + "DISABLE" + "DISABLE_STRINGIFICATION" + "ENABLE_ALL_STRINGMAKERS" + "ENABLE_OPTIONAL_STRINGMAKER" + "ENABLE_PAIR_STRINGMAKER" + "ENABLE_TUPLE_STRINGMAKER" + "ENABLE_VARIANT_STRINGMAKER" + "EXPERIMENTAL_REDIRECT" + "FAST_COMPILE" + "NOSTDOUT" + "PREFIX_ALL" + "PREFIX_MESSAGES" + "WINDOWS_CRTDBG" +) + + +foreach(OptionName ${_OtherConfigOptions}) + AddConfigOption(${OptionName}) +endforeach() +if(DEFINED BUILD_SHARED_LIBS) + set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) +else() + set(CATCH_CONFIG_SHARED_LIBRARY "") +endif() + +set(CATCH_CONFIG_DEFAULT_REPORTER "console" CACHE STRING "Read docs/configuration.md for details. The name of the reporter should be without quotes.") +set(CATCH_CONFIG_CONSOLE_WIDTH "80" CACHE STRING "Read docs/configuration.md for details. Must form a valid integer literal.") + +mark_as_advanced(CATCH_CONFIG_SHARED_LIBRARY CATCH_CONFIG_DEFAULT_REPORTER CATCH_CONFIG_CONSOLE_WIDTH) + +# There is no good way to both turn this into a CMake cache variable, +# and keep reasonable default semantics inside the project. Thus we do +# not define it and users have to provide it as an outside variable. +#set(CATCH_CONFIG_FALLBACK_STRINGIFIER "" CACHE STRING "Read docs/configuration.md for details.") diff --git a/tests/catch2/CMake/CatchMiscFunctions.cmake b/tests/catch2/CMake/CatchMiscFunctions.cmake new file mode 100644 index 0000000000..d1cf5fc2c8 --- /dev/null +++ b/tests/catch2/CMake/CatchMiscFunctions.cmake @@ -0,0 +1,121 @@ + +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 + +include(CheckCXXCompilerFlag) +function(add_cxx_flag_if_supported_to_targets flagname targets) + string(MAKE_C_IDENTIFIER ${flagname} flag_identifier) + check_cxx_compiler_flag("${flagname}" HAVE_FLAG_${flag_identifier}) + + if(HAVE_FLAG_${flag_identifier}) + foreach(target ${targets}) + target_compile_options(${target} PRIVATE ${flagname}) + endforeach() + endif() +endfunction() + +# Assumes that it is only called for development builds, where warnings +# and Werror is desired, so it also enables Werror. +function(add_warnings_to_targets targets) + LIST(LENGTH targets TARGETS_LEN) + # For now we just assume 2 possibilities: msvc and msvc-like compilers, + # and other. + if(MSVC) + foreach(target ${targets}) + # Force MSVC to consider everything as encoded in utf-8 + target_compile_options(${target} PRIVATE /utf-8) + # Enable Werror equivalent + if(CATCH_ENABLE_WERROR) + target_compile_options(${target} PRIVATE /WX) + endif() + + # MSVC is currently handled specially + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level + target_compile_options(${target} PRIVATE /w44265 /w44061 /w44062 /w45038) + endif() + endforeach() + endif() + + if(NOT MSVC) + set(CHECKED_WARNING_FLAGS + "-Wabsolute-value" + "-Wall" + "-Wcall-to-pure-virtual-from-ctor-dtor" + "-Wcast-align" + "-Wcatch-value" + "-Wdangling" + "-Wdeprecated" + "-Wdeprecated-register" + "-Wexceptions" + "-Wexit-time-destructors" + "-Wextra" + "-Wextra-semi" + "-Wfloat-equal" + "-Wglobal-constructors" + "-Winit-self" + "-Wmisleading-indentation" + "-Wmismatched-new-delete" + "-Wmismatched-return-types" + "-Wmismatched-tags" + "-Wmissing-braces" + "-Wmissing-declarations" + "-Wmissing-noreturn" + "-Wmissing-prototypes" + "-Wmissing-variable-declarations" + "-Wnon-virtual-dtor" + "-Wnull-dereference" + "-Wold-style-cast" + "-Woverloaded-virtual" + "-Wparentheses" + "-Wpedantic" + "-Wredundant-decls" + "-Wreorder" + "-Wreturn-std-move" + "-Wshadow" + "-Wstrict-aliasing" + "-Wsubobject-linkage" + "-Wsuggest-destructor-override" + "-Wsuggest-override" + "-Wundef" + "-Wuninitialized" + "-Wunneeded-internal-declaration" + "-Wunreachable-code-aggressive" + "-Wunused" + "-Wunused-function" + "-Wunused-parameter" + "-Wvla" + "-Wweak-vtables" + + # This is a useful warning, but our tests sometimes rely on + # functions being present, but not picked (e.g. various checks + # for stringification implementation ordering). + # Ergo, we should use it every now and then, but we cannot + # enable it by default. + # "-Wunused-member-function" + ) + foreach(warning ${CHECKED_WARNING_FLAGS}) + add_cxx_flag_if_supported_to_targets(${warning} "${targets}") + endforeach() + + if(CATCH_ENABLE_WERROR) + foreach(target ${targets}) + # Enable Werror equivalent + target_compile_options(${target} PRIVATE -Werror) + endforeach() + endif() + endif() +endfunction() + +# Adds flags required for reproducible build to the target +# Currently only supports GCC and Clang +function(add_build_reproducibility_settings target) + # Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + add_cxx_flag_if_supported_to_targets("-ffile-prefix-map=${CATCH_DIR}/=" "${target}") + endif() +endfunction() diff --git a/tests/catch2/CMake/FindGcov.cmake b/tests/catch2/CMake/FindGcov.cmake new file mode 100644 index 0000000000..414171134c --- /dev/null +++ b/tests/catch2/CMake/FindGcov.cmake @@ -0,0 +1,157 @@ +# This file is part of CMake-codecov. +# +# Copyright (c) +# 2015-2017 RWTH Aachen University, Federal Republic of Germany +# +# See the LICENSE file in the package base directory for details +# +# Written by Alexander Haase, alexander.haase@rwth-aachen.de +# + + +# include required Modules +include(FindPackageHandleStandardArgs) + + +# Search for gcov binary. +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY}) + +get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach (LANG ${ENABLED_LANGUAGES}) + # Gcov evaluation is dependent on the used compiler. Check gcov support for + # each compiler that is used. If gcov binary was already found for this + # compiler, do not try to find it again. + if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN) + get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH) + + if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU") + # Some distributions like OSX (homebrew) ship gcov with the compiler + # version appended as gcov-x. To find this binary we'll build the + # suggested binary name with the compiler version. + string(REGEX MATCH "^[0-9]+" GCC_VERSION + "${CMAKE_${LANG}_COMPILER_VERSION}") + + find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov + HINTS ${COMPILER_PATH}) + + elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang") + # Some distributions like Debian ship llvm-cov with the compiler + # version appended as llvm-cov-x.y. To find this binary we'll build + # the suggested binary name with the compiler version. + string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION + "${CMAKE_${LANG}_COMPILER_VERSION}") + + # llvm-cov prior version 3.5 seems to be not working with coverage + # evaluation tools, but these versions are compatible with the gcc + # gcov tool. + if(LLVM_VERSION VERSION_GREATER 3.4) + find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}" + "llvm-cov" HINTS ${COMPILER_PATH}) + mark_as_advanced(LLVM_COV_BIN) + + if (LLVM_COV_BIN) + find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS + ${CMAKE_MODULE_PATH}) + if (LLVM_COV_WRAPPER) + set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "") + + # set additional parameters + set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV + "LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING + "Environment variables for llvm-cov-wrapper.") + mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV) + endif () + endif () + endif () + + if (NOT GCOV_BIN) + # Fall back to gcov binary if llvm-cov was not found or is + # incompatible. This is the default on OSX, but may crash on + # recent Linux versions. + find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH}) + endif () + endif () + + + if (GCOV_BIN) + set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING + "${LANG} gcov binary.") + + if (NOT CMAKE_REQUIRED_QUIET) + message("-- Found gcov evaluation for " + "${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}") + endif() + + unset(GCOV_BIN CACHE) + endif () + endif () +endforeach () + + + + +# Add a new global target for all gcov targets. This target could be used to +# generate the gcov files for the whole project instead of calling -gcov +# for each target. +if (NOT TARGET gcov) + add_custom_target(gcov) +endif (NOT TARGET gcov) + + + +# This function will add gcov evaluation for target . Only sources of +# this target will be evaluated and no dependencies will be added. It will call +# Gcov on any source file of once and store the gcov file in the same +# directory. +function (add_gcov_target TNAME) + set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir) + + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + + set(BUFFER "") + foreach(FILE ${SOURCES}) + get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH) + + # call gcov + add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov + COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null + DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno + WORKING_DIRECTORY ${FILE_PATH} + ) + + list(APPEND BUFFER ${TDIR}/${FILE}.gcov) + endforeach() + + + # add target for gcov evaluation of + add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER}) + + # add evaluation target to the global gcov target. + add_dependencies(gcov ${TNAME}-gcov) +endfunction (add_gcov_target) diff --git a/tests/catch2/CMake/FindLcov.cmake b/tests/catch2/CMake/FindLcov.cmake new file mode 100644 index 0000000000..beb925ae06 --- /dev/null +++ b/tests/catch2/CMake/FindLcov.cmake @@ -0,0 +1,354 @@ +# This file is part of CMake-codecov. +# +# Copyright (c) +# 2015-2017 RWTH Aachen University, Federal Republic of Germany +# +# See the LICENSE file in the package base directory for details +# +# Written by Alexander Haase, alexander.haase@rwth-aachen.de +# + + +# configuration +set(LCOV_DATA_PATH "${CMAKE_BINARY_DIR}/lcov/data") +set(LCOV_DATA_PATH_INIT "${LCOV_DATA_PATH}/init") +set(LCOV_DATA_PATH_CAPTURE "${LCOV_DATA_PATH}/capture") +set(LCOV_HTML_PATH "${CMAKE_BINARY_DIR}/lcov/html") + + + + +# Search for Gcov which is used by Lcov. +find_package(Gcov) + + + + +# This function will add lcov evaluation for target . Only sources of +# this target will be evaluated and no dependencies will be added. It will call +# geninfo on any source file of once and store the info file in the same +# directory. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (add_lcov_target TNAME) + if (LCOV_FOUND) + # capture initial coverage data + lcov_capture_initial_tgt(${TNAME}) + + # capture coverage data after execution + lcov_capture_tgt(${TNAME}) + endif () +endfunction (add_lcov_target) + + + + +# include required Modules +include(FindPackageHandleStandardArgs) + +# Search for required lcov binaries. +find_program(LCOV_BIN lcov) +find_program(GENINFO_BIN geninfo) +find_program(GENHTML_BIN genhtml) +find_package_handle_standard_args(lcov + REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN +) + +# enable genhtml C++ demangeling, if c++filt is found. +set(GENHTML_CPPFILT_FLAG "") +find_program(CPPFILT_BIN c++filt) +if (NOT CPPFILT_BIN STREQUAL "") + set(GENHTML_CPPFILT_FLAG "--demangle-cpp") +endif (NOT CPPFILT_BIN STREQUAL "") + +# enable no-external flag for lcov, if available. +if (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG) + set(FLAG "") + execute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP) + string(REGEX MATCH "external" GENINFO_RES "${GENINFO_HELP}") + if (GENINFO_RES) + set(FLAG "--no-external") + endif () + + set(GENINFO_EXTERN_FLAG "${FLAG}" + CACHE STRING "Geninfo flag to exclude system sources.") +endif () + +# If Lcov was not found, exit module now. +if (NOT LCOV_FOUND) + return() +endif (NOT LCOV_FOUND) + + + + +# Create directories to be used. +file(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT}) +file(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE}) + +set(LCOV_REMOVE_PATTERNS "") + +# This function will merge lcov files to a single target file. Additional lcov +# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function. +function (lcov_merge_files OUTFILE ...) + # Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files. + list(REMOVE_AT ARGV 0) + + # Generate merged file. + string(REPLACE "${CMAKE_BINARY_DIR}/" "" FILE_REL "${OUTFILE}") + add_custom_command(OUTPUT "${OUTFILE}.raw" + COMMAND cat ${ARGV} > ${OUTFILE}.raw + DEPENDS ${ARGV} + COMMENT "Generating ${FILE_REL}" + ) + + add_custom_command(OUTPUT "${OUTFILE}" + COMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE} + --base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS} + COMMAND ${LCOV_BIN} --quiet -r ${OUTFILE} ${LCOV_REMOVE_PATTERNS} + --output-file ${OUTFILE} ${LCOV_EXTRA_FLAGS} + DEPENDS ${OUTFILE}.raw + COMMENT "Post-processing ${FILE_REL}" + ) +endfunction () + + + + +# Add a new global target to generate initial coverage reports for all targets. +# This target will be used to generate the global initial info file, which is +# used to gather even empty report data. +if (NOT TARGET lcov-capture-init) + add_custom_target(lcov-capture-init) + set(LCOV_CAPTURE_INIT_FILES "" CACHE INTERNAL "") +endif (NOT TARGET lcov-capture-init) + + +# This function will add initial capture of coverage data for target , +# which is needed to get also data for objects, which were not loaded at +# execution time. It will call geninfo for every source file of once and +# store the info file in the same directory. +function (lcov_capture_initial_tgt TNAME) + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + + set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir) + set(GENINFO_FILES "") + foreach(FILE ${SOURCES}) + # generate empty coverage files + set(OUTFILE "${TDIR}/${FILE}.info.init") + list(APPEND GENINFO_FILES ${OUTFILE}) + + add_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN} + --quiet --base-directory ${PROJECT_SOURCE_DIR} --initial + --gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE} + ${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno + DEPENDS ${TNAME} + COMMENT "Capturing initial coverage data for ${FILE}" + ) + endforeach() + + # Concatenate all files generated by geninfo to a single file per target. + set(OUTFILE "${LCOV_DATA_PATH_INIT}/${TNAME}.info") + set(LCOV_EXTRA_FLAGS "--initial") + lcov_merge_files("${OUTFILE}" ${GENINFO_FILES}) + add_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE}) + + # add geninfo file generation to global lcov-geninfo target + add_dependencies(lcov-capture-init ${TNAME}-capture-init) + set(LCOV_CAPTURE_INIT_FILES "${LCOV_CAPTURE_INIT_FILES}" + "${OUTFILE}" CACHE INTERNAL "" + ) +endfunction (lcov_capture_initial_tgt) + + +# This function will generate the global info file for all targets. It has to be +# called after all other CMake functions in the root CMakeLists.txt file, to get +# a full list of all targets that generate coverage data. +function (lcov_capture_initial) + # Skip this function (and do not create the following targets), if there are + # no input files. + if ("${LCOV_CAPTURE_INIT_FILES}" STREQUAL "") + return() + endif () + + # Add a new target to merge the files of all targets. + set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info") + lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES}) + add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE} + lcov-capture-init + ) +endfunction (lcov_capture_initial) + + + + +# Add a new global target to generate coverage reports for all targets. This +# target will be used to generate the global info file. +if (NOT TARGET lcov-capture) + add_custom_target(lcov-capture) + set(LCOV_CAPTURE_FILES "" CACHE INTERNAL "") +endif (NOT TARGET lcov-capture) + + +# This function will add capture of coverage data for target , which is +# needed to get also data for objects, which were not loaded at execution time. +# It will call geninfo for every source file of once and store the info +# file in the same directory. +function (lcov_capture_tgt TNAME) + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + + set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir) + set(GENINFO_FILES "") + foreach(FILE ${SOURCES}) + # Generate coverage files. If no .gcda file was generated during + # execution, the empty coverage file will be used instead. + set(OUTFILE "${TDIR}/${FILE}.info") + list(APPEND GENINFO_FILES ${OUTFILE}) + + add_custom_command(OUTPUT ${OUTFILE} + COMMAND test -f "${TDIR}/${FILE}.gcda" + && ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory + ${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN} + --output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG} + ${TDIR}/${FILE}.gcda + || cp ${OUTFILE}.init ${OUTFILE} + DEPENDS ${TNAME} ${TNAME}-capture-init + COMMENT "Capturing coverage data for ${FILE}" + ) + endforeach() + + # Concatenate all files generated by geninfo to a single file per target. + set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info") + lcov_merge_files("${OUTFILE}" ${GENINFO_FILES}) + add_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE}) + + # add geninfo file generation to global lcov-capture target + add_dependencies(lcov-capture ${TNAME}-geninfo) + set(LCOV_CAPTURE_FILES "${LCOV_CAPTURE_FILES}" "${OUTFILE}" CACHE INTERNAL + "" + ) + + # Add target for generating html output for this target only. + file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME}) + add_custom_target(${TNAME}-genhtml + COMMAND ${GENHTML_BIN} --quiet --sort --prefix ${PROJECT_SOURCE_DIR} + --baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info + --output-directory ${LCOV_HTML_PATH}/${TNAME} + --title "${CMAKE_PROJECT_NAME} - target ${TNAME}" + ${GENHTML_CPPFILT_FLAG} ${OUTFILE} + DEPENDS ${TNAME}-geninfo ${TNAME}-capture-init + ) +endfunction (lcov_capture_tgt) + + +# This function will generate the global info file for all targets. It has to be +# called after all other CMake functions in the root CMakeLists.txt file, to get +# a full list of all targets that generate coverage data. +function (lcov_capture) + # Skip this function (and do not create the following targets), if there are + # no input files. + if ("${LCOV_CAPTURE_FILES}" STREQUAL "") + return() + endif () + + # Add a new target to merge the files of all targets. + set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info") + lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES}) + add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture) + + # Add a new global target for all lcov targets. This target could be used to + # generate the lcov html output for the whole project instead of calling + # -geninfo and -genhtml for each target. It will also be + # used to generate a html site for all project data together instead of one + # for each target. + if (NOT TARGET lcov) + file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets) + add_custom_target(lcov + COMMAND ${GENHTML_BIN} --quiet --sort + --baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info + --output-directory ${LCOV_HTML_PATH}/all_targets + --title "${CMAKE_PROJECT_NAME}" --prefix "${PROJECT_SOURCE_DIR}" + ${GENHTML_CPPFILT_FLAG} ${OUTFILE} + DEPENDS lcov-geninfo-init lcov-geninfo + ) + endif () +endfunction (lcov_capture) + + + + +# Add a new global target to generate the lcov html report for the whole project +# instead of calling -genhtml for each target (to create an own report +# for each target). Instead of the lcov target it does not require geninfo for +# all targets, so you have to call -geninfo to generate the info files +# the targets you'd like to have in your report or lcov-geninfo for generating +# info files for all targets before calling lcov-genhtml. +file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets) +if (NOT TARGET lcov-genhtml) + add_custom_target(lcov-genhtml + COMMAND ${GENHTML_BIN} + --quiet + --output-directory ${LCOV_HTML_PATH}/selected_targets + --title \"${CMAKE_PROJECT_NAME} - targets `find + ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name + \"all_targets.info\" -exec basename {} .info \\\;`\" + --prefix ${PROJECT_SOURCE_DIR} + --sort + ${GENHTML_CPPFILT_FLAG} + `find ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name + \"all_targets.info\"` + ) +endif (NOT TARGET lcov-genhtml) diff --git a/tests/catch2/CMake/Findcodecov.cmake b/tests/catch2/CMake/Findcodecov.cmake new file mode 100644 index 0000000000..2c0f2fee5f --- /dev/null +++ b/tests/catch2/CMake/Findcodecov.cmake @@ -0,0 +1,258 @@ +# This file is part of CMake-codecov. +# +# Copyright (c) +# 2015-2017 RWTH Aachen University, Federal Republic of Germany +# +# See the LICENSE file in the package base directory for details +# +# Written by Alexander Haase, alexander.haase@rwth-aachen.de +# + + +# Add an option to choose, if coverage should be enabled or not. If enabled +# marked targets will be build with coverage support and appropriate targets +# will be added. If disabled coverage will be ignored for *ALL* targets. +option(ENABLE_COVERAGE "Enable coverage build." OFF) + +set(COVERAGE_FLAG_CANDIDATES + # gcc and clang + "-O0 -g -fprofile-arcs -ftest-coverage" + + # gcc and clang fallback + "-O0 -g --coverage" +) + + +# Add coverage support for target ${TNAME} and register target for coverage +# evaluation. If coverage is disabled or not supported, this function will +# simply do nothing. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (add_coverage TNAME) + # only add coverage for target, if coverage is support and enabled. + if (ENABLE_COVERAGE) + foreach (TNAME ${ARGV}) + add_coverage_target(${TNAME}) + endforeach () + endif () +endfunction (add_coverage) + + +# Add global target to gather coverage information after all targets have been +# added. Other evaluation functions could be added here, after checks for the +# specific module have been passed. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (coverage_evaluate) + # add lcov evaluation + if (LCOV_FOUND) + lcov_capture_initial() + lcov_capture() + endif (LCOV_FOUND) +endfunction () + + +# Exit this module, if coverage is disabled. add_coverage is defined before this +# return, so this module can be exited now safely without breaking any build- +# scripts. +if (NOT ENABLE_COVERAGE) + return() +endif () + + + + +# Find the reuired flags foreach language. +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY}) + +get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach (LANG ${ENABLED_LANGUAGES}) + # Coverage flags are not dependent on language, but the used compiler. So + # instead of searching flags foreach language, search flags foreach compiler + # used. + set(COMPILER ${CMAKE_${LANG}_COMPILER_ID}) + if (NOT COVERAGE_${COMPILER}_FLAGS) + foreach (FLAG ${COVERAGE_FLAG_CANDIDATES}) + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try ${COMPILER} code coverage flag = [${FLAG}]") + endif() + + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(COVERAGE_FLAG_DETECTED CACHE) + + if (${LANG} STREQUAL "C") + include(CheckCCompilerFlag) + check_c_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED) + + elseif (${LANG} STREQUAL "CXX") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED) + + elseif (${LANG} STREQUAL "Fortran") + # CheckFortranCompilerFlag was introduced in CMake 3.x. To be + # compatible with older Cmake versions, we will check if this + # module is present before we use it. Otherwise we will define + # Fortran coverage support as not available. + include(CheckFortranCompilerFlag OPTIONAL + RESULT_VARIABLE INCLUDED) + if (INCLUDED) + check_fortran_compiler_flag("${FLAG}" + COVERAGE_FLAG_DETECTED) + elseif (NOT CMAKE_REQUIRED_QUIET) + message("-- Performing Test COVERAGE_FLAG_DETECTED") + message("-- Performing Test COVERAGE_FLAG_DETECTED - Failed" + " (Check not supported)") + endif () + endif() + + if (COVERAGE_FLAG_DETECTED) + set(COVERAGE_${COMPILER}_FLAGS "${FLAG}" + CACHE STRING "${COMPILER} flags for code coverage.") + mark_as_advanced(COVERAGE_${COMPILER}_FLAGS) + break() + else () + message(WARNING "Code coverage is not available for ${COMPILER}" + " compiler. Targets using this compiler will be " + "compiled without it.") + endif () + endforeach () + endif () +endforeach () + +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + + + + +# Helper function to get the language of a source file. +function (codecov_lang_of_source FILE RETURN_VAR) + get_filename_component(FILE_EXT "${FILE}" EXT) + string(TOLOWER "${FILE_EXT}" FILE_EXT) + string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT) + + get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + foreach (LANG ${ENABLED_LANGUAGES}) + list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP) + if (NOT ${TEMP} EQUAL -1) + set(${RETURN_VAR} "${LANG}" PARENT_SCOPE) + return() + endif () + endforeach() + + set(${RETURN_VAR} "" PARENT_SCOPE) +endfunction () + + +# Helper function to get the relative path of the source file destination path. +# This path is needed by FindGcov and FindLcov cmake files to locate the +# captured data. +function (codecov_path_of_source FILE RETURN_VAR) + string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _source ${FILE}) + + # If expression was found, SOURCEFILE is a generator-expression for an + # object library. Currently we found no way to call this function automatic + # for the referenced target, so it must be called in the directoryso of the + # object library definition. + if (NOT "${_source}" STREQUAL "") + set(${RETURN_VAR} "" PARENT_SCOPE) + return() + endif () + + + string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" FILE "${FILE}") + if(IS_ABSOLUTE ${FILE}) + file(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE}) + endif() + + # get the right path for file + string(REPLACE ".." "__" PATH "${FILE}") + + set(${RETURN_VAR} "${PATH}" PARENT_SCOPE) +endfunction() + + + + +# Add coverage support for target ${TNAME} and register target for coverage +# evaluation. +function(add_coverage_target TNAME) + # Check if all sources for target use the same compiler. If a target uses + # e.g. C and Fortran mixed and uses different compilers (e.g. clang and + # gfortran) this can trigger huge problems, because different compilers may + # use different implementations for code coverage. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(TARGET_COMPILER "") + set(ADDITIONAL_FILES "") + foreach (FILE ${TSOURCES}) + # If expression was found, FILE is a generator-expression for an object + # library. Object libraries will be ignored. + string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE}) + if ("${_file}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (LANG) + list(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID}) + + list(APPEND ADDITIONAL_FILES "${FILE}.gcno") + list(APPEND ADDITIONAL_FILES "${FILE}.gcda") + endif () + endif () + endforeach () + + list(REMOVE_DUPLICATES TARGET_COMPILER) + list(LENGTH TARGET_COMPILER NUM_COMPILERS) + + if (NUM_COMPILERS GREATER 1) + message(WARNING "Can't use code coverage for target ${TNAME}, because " + "it will be compiled by incompatible compilers. Target will be " + "compiled without code coverage.") + return() + + elseif (NUM_COMPILERS EQUAL 0) + message(WARNING "Can't use code coverage for target ${TNAME}, because " + "it uses an unknown compiler. Target will be compiled without " + "code coverage.") + return() + + elseif (NOT DEFINED "COVERAGE_${TARGET_COMPILER}_FLAGS") + # A warning has been printed before, so just return if flags for this + # compiler aren't available. + return() + endif() + + + # enable coverage for target + set_property(TARGET ${TNAME} APPEND_STRING + PROPERTY COMPILE_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}") + set_property(TARGET ${TNAME} APPEND_STRING + PROPERTY LINK_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}") + + + # Add gcov files generated by compiler to clean target. + set(CLEAN_FILES "") + foreach (FILE ${ADDITIONAL_FILES}) + codecov_path_of_source(${FILE} FILE) + list(APPEND CLEAN_FILES "CMakeFiles/${TNAME}.dir/${FILE}") + endforeach() + + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "${CLEAN_FILES}") + + + add_gcov_target(${TNAME}) + add_lcov_target(${TNAME}) +endfunction(add_coverage_target) + + + + +# Include modules for parsing the collected data and output it in a readable +# format (like gcov and lcov). +find_package(Gcov) +find_package(Lcov) diff --git a/tests/catch2/CMake/catch2-with-main.pc.in b/tests/catch2/CMake/catch2-with-main.pc.in new file mode 100644 index 0000000000..eeac3e3500 --- /dev/null +++ b/tests/catch2/CMake/catch2-with-main.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/@lib_dir@ +pkg_version=@Catch2_VERSION@ + +Name: Catch2 with main function +Description: A modern, C++-native test framework for C++14 and above (links in default main) +URL: https://github.com/catchorg/Catch2 +Version: ${pkg_version} +Requires: catch2 = ${pkg_version} +Libs: -L${libdir} -l@lib_name@ diff --git a/tests/catch2/CMake/catch2.pc.in b/tests/catch2/CMake/catch2.pc.in new file mode 100644 index 0000000000..74e22c150f --- /dev/null +++ b/tests/catch2/CMake/catch2.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=${prefix}/@include_dir@ +libdir=${prefix}/@lib_dir@ + +Name: Catch2 +Description: A modern, C++-native, test framework for C++14 and above +URL: https://github.com/catchorg/Catch2 +Version: @Catch2_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -l@lib_name@ diff --git a/tests/catch2/CMake/llvm-cov-wrapper b/tests/catch2/CMake/llvm-cov-wrapper new file mode 100755 index 0000000000..2ac3310248 --- /dev/null +++ b/tests/catch2/CMake/llvm-cov-wrapper @@ -0,0 +1,56 @@ +#!/bin/sh + +# This file is part of CMake-codecov. +# +# Copyright (c) +# 2015-2017 RWTH Aachen University, Federal Republic of Germany +# +# See the LICENSE file in the package base directory for details +# +# Written by Alexander Haase, alexander.haase@rwth-aachen.de +# + +if [ -z "$LLVM_COV_BIN" ] +then + echo "LLVM_COV_BIN not set!" >& 2 + exit 1 +fi + + +# Get LLVM version to find out. +LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ + | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") + +if [ "$1" = "-v" ] +then + echo "llvm-cov-wrapper $LLVM_VERSION" + exit 0 +fi + + +if [ -n "$LLVM_VERSION" ] +then + MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1) + MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2) + + if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ] + then + if [ -f "$1" ] + then + filename=$(basename "$1") + extension="${filename##*.}" + + case "$extension" in + "gcno") exec $LLVM_COV_BIN --gcno="$1" ;; + "gcda") exec $LLVM_COV_BIN --gcda="$1" ;; + esac + fi + fi + + if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ] + then + exec $LLVM_COV_BIN $@ + fi +fi + +exec $LLVM_COV_BIN gcov $@ diff --git a/tests/catch2/CMakeLists.txt b/tests/catch2/CMakeLists.txt new file mode 100644 index 0000000000..d967c1ecf0 --- /dev/null +++ b/tests/catch2/CMakeLists.txt @@ -0,0 +1,230 @@ +cmake_minimum_required(VERSION 3.16) + +# detect if Catch is being bundled, +# disable testsuite in that case +if(NOT DEFINED PROJECT_NAME) + set(NOT_SUBPROJECT ON) +else() + set(NOT_SUBPROJECT OFF) +endif() + + + +option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON) +option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON) +option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF) +option(CATCH_ENABLE_REPRODUCIBLE_BUILD "Add compiler flags for improving build reproducibility" ON) + +include(CMakeDependentOption) +cmake_dependent_option(CATCH_BUILD_TESTING "Build the SelfTest project" ON "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_EXAMPLES "Build code examples" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_FUZZERS "Build fuzzers" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_BENCHMARKS "Build the benchmarks" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_WERROR "Enables Werror during build" ON "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_SURROGATES "Enable generating and building surrogate TUs for the main headers" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_CONFIGURE_TESTS "Enable CMake configuration tests. WARNING: VERY EXPENSIVE" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_CMAKE_HELPER_TESTS "Enable CMake helper tests. WARNING: VERY EXPENSIVE" OFF "CATCH_DEVELOPMENT_BUILD" OFF) + +# Catch2's build breaks if done in-tree. You probably should not build +# things in tree anyway, but we can allow projects that include Catch2 +# as a subproject to build in-tree as long as it is not in our tree. +if(CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") +endif() + +project(Catch2 + VERSION 3.11.0 # CML version placeholder, don't delete + LANGUAGES CXX + HOMEPAGE_URL "https://github.com/catchorg/Catch2" + DESCRIPTION "A modern, C++-native, unit test framework." +) + +# Provide path for scripts. We first add path to the scripts we don't use, +# but projects including us might, and set the path up to parent scope. +# Then we also add path that we use to configure the project, but is of +# no use to top level projects. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/extras") +if(NOT NOT_SUBPROJECT) + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE) +endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +include(CatchConfigOptions) +if(CATCH_DEVELOPMENT_BUILD) + include(CTest) +endif() + +# This variable is used in some subdirectories, so we need it here, rather +# than later in the install block +set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2") + +# We have some Windows builds that test `wmain` entry point, +# and we need this change to be present in all binaries that +# are built during these tests, so this is required here, before +# the subdirectories are added. +if(CATCH_TEST_USE_WMAIN) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup") +endif() + +# Basic paths +set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(SOURCES_DIR ${CATCH_DIR}/src/catch2) +set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest) + +# We need to bring-in the variables defined there to this scope +add_subdirectory(src) + +if (CATCH_BUILD_BENCHMARKS) + set(CMAKE_FOLDER "benchmarks") + add_subdirectory(benchmarks) +endif() + +# Build tests only if requested +if(BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT) + find_package(Python3 REQUIRED COMPONENTS Interpreter) + if(NOT TARGET Python3::Interpreter) + message(FATAL_ERROR "Python not found, but required for tests") + endif() + set(CMAKE_FOLDER "tests") + add_subdirectory(tests) +endif() + +if(CATCH_BUILD_EXAMPLES) + set(CMAKE_FOLDER "Examples") + add_subdirectory(examples) +endif() + +if(CATCH_BUILD_EXTRA_TESTS) + set(CMAKE_FOLDER "tests/ExtraTests") + add_subdirectory(tests/ExtraTests) +endif() + +if(CATCH_BUILD_FUZZERS) + set(CMAKE_FOLDER "fuzzing") + add_subdirectory(fuzzing) +endif() + +if(CATCH_DEVELOPMENT_BUILD) + set(CATCH_ALL_TARGETS ${CATCH_IMPL_TARGETS} ${CATCH_TEST_TARGETS}) + add_warnings_to_targets("${CATCH_ALL_TARGETS}") + # After we added the noreturn hint to FAIL and SKIP, Clang became + # extremely good at diagnosing tests that test these macros as being + # noreturn, but not marked as such. This made the warning useless for + # our test files. + add_cxx_flag_if_supported_to_targets("-Wno-missing-noreturn" "${CATCH_TEST_TARGETS}") +endif() + +# Only perform the installation steps when Catch is not being used as +# a subproject via `add_subdirectory`, or the destinations will break, +# see https://github.com/catchorg/Catch2/issues/1373 +if(NOT_SUBPROJECT) + configure_package_config_file( + ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake + INSTALL_DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" + COMPATIBILITY + SameMajorVersion + ) + + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + # Install documentation + if(CATCH_INSTALL_DOCS) + install( + DIRECTORY + docs/ + DESTINATION + "${CMAKE_INSTALL_DOCDIR}" + PATTERN "doxygen" EXCLUDE + ) + endif() + + if(CATCH_INSTALL_EXTRAS) + # Install CMake scripts + install( + FILES + "extras/ParseAndAddCatchTests.cmake" + "extras/Catch.cmake" + "extras/CatchAddTests.cmake" + "extras/CatchShardTests.cmake" + "extras/CatchShardTestsImpl.cmake" + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + # Install debugger helpers + install( + FILES + "extras/gdbinit" + "extras/lldbinit" + DESTINATION + ${CMAKE_INSTALL_DATAROOTDIR}/Catch2 + ) + endif() + + ## Provide some pkg-config integration + set(PKGCONFIG_INSTALL_DIR + "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig" + CACHE PATH "Path where catch2.pc is installed" + ) + + # Generate the pkg-config files + # To understand the script below, you have to understand that it works in two steps. + # 1) A CMake script is generated at configuration time + # 2) It is executed at install time. + # And both of these have access to different parts of the information we need. + # + # Further, the variables before "[[" are expanded at configuration time, + # while the ones inside the [[]] block are expanded at script execution (install) time. + string( + JOIN "\n" + install_script + "set(install_pkgconfdir \"${PKGCONFIG_INSTALL_DIR}\")" + "set(impl_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in\")" + "set(main_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2-with-main.pc.in\")" + "set(Catch2_VERSION ${Catch2_VERSION})" + "set(include_dir \"${CMAKE_INSTALL_INCLUDEDIR}\")" + "set(lib_dir \"${CMAKE_INSTALL_LIBDIR}\")" + [[ + message(STATUS "DESTDIR: $ENV{DESTDIR}") + set(DESTDIR_PREFIX "") + if (DEFINED ENV{DESTDIR}) + set(DESTDIR_PREFIX "$ENV{DESTDIR}") + endif () + message(STATUS "PREFIX: ${DESTDIR_PREFIX}") + set(lib_name "$") + configure_file( + "${impl_pc_file}" + "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc" + @ONLY + ) + + set(lib_name "$") + configure_file( + "${main_pc_file}" + "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc" + @ONLY + ) + ]] + ) + install(CODE "${install_script}") + + set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/") + + include(CPack) +endif() diff --git a/tests/catch2/CMakePresets.json b/tests/catch2/CMakePresets.json new file mode 100644 index 0000000000..ffc6e240d1 --- /dev/null +++ b/tests/catch2/CMakePresets.json @@ -0,0 +1,40 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "basic-tests", + "binaryDir": "build", + "installDir": "build/install", + "displayName": "Basic development build", + "description": "Enables development build with basic tests that are cheap to build and run", + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "OFF", + "CMAKE_CXX_STANDARD_REQUIRED": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CATCH_DEVELOPMENT_BUILD": "ON" + } + }, + { + "name": "most-tests", + "inherits": "basic-tests", + "displayName": "Full development build", + "description": "Enables development build with extended set of tests (still relatively cheap to build)", + "cacheVariables": { + "CATCH_BUILD_EXAMPLES": "ON", + "CATCH_BUILD_EXTRA_TESTS": "ON", + "CATCH_BUILD_SURROGATES": "ON", + "CATCH_BUILD_BENCHMARKS": "ON" + } + }, + { + "name": "all-tests", + "inherits": "most-tests", + "displayName": "Full development build", + "description": "Enables development build with examples and ALL tests", + "cacheVariables": { + "CATCH_ENABLE_CONFIGURE_TESTS": "ON", + "CATCH_ENABLE_CMAKE_HELPER_TESTS": "ON" + } + } + ] +} diff --git a/tests/catch2/COMMIT b/tests/catch2/COMMIT new file mode 100644 index 0000000000..c928b757e4 --- /dev/null +++ b/tests/catch2/COMMIT @@ -0,0 +1 @@ +31ee3beb0a474463e0101674c22f2fef0311d601 diff --git a/tests/catch2/VERSION.txt b/tests/catch2/VERSION.txt deleted file mode 100644 index 587a8125d2..0000000000 --- a/tests/catch2/VERSION.txt +++ /dev/null @@ -1,2 +0,0 @@ -2.9.2 g2c869e1 - diff --git a/tests/catch2/catch.hpp b/tests/catch2/catch.hpp deleted file mode 100644 index 1bfc71c5d9..0000000000 --- a/tests/catch2/catch.hpp +++ /dev/null @@ -1,17937 +0,0 @@ -/* - * Catch v2.13.6 - * Generated: 2021-04-16 18:23:38.044268 - * ---------------------------------------------------------- - * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2021 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// start catch.hpp - - -#define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 6 - -#ifdef __clang__ -# pragma clang system_header -#elif defined __GNUC__ -# pragma GCC system_header -#endif - -// start catch_suppress_warnings.h - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif -#elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" -#endif -// end catch_suppress_warnings.h -#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS -#endif - -// In the impl file, we want to have access to all parts of the headers -// Can also be used to sanely support PCHs -#if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) -// start catch_platform.h - -// See e.g.: -// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html -#ifdef __APPLE__ -# include -# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ - (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) -# define CATCH_PLATFORM_MAC -# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) -# define CATCH_PLATFORM_IPHONE -# endif - -#elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX - -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS -#endif - -// end catch_platform.h - -#ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif -#endif - -// start catch_user_interfaces.h - -namespace Catch { - unsigned int rngSeed(); -} - -// end catch_user_interfaces.h -// start catch_tag_alias_autoregistrar.h - -// start catch_common.h - -// start catch_compiler_capabilities.h - -// Detect a number of compiler features - by compiler -// The following features are defined: -// -// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? -// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? -// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? -// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? -// **************** -// Note to maintainers: if new toggles are added please document them -// in configuration.md, too -// **************** - -// In general each macro has a _NO_ form -// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. -// Many features, at point of detection, define an _INTERNAL_ macro, so they -// can be combined, en-mass, with the _NO_ forms later. - -#ifdef __cplusplus - -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif - -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - -#endif - -// Only GCC compiler should be used in this block, so other compilers trying to -// mask themselves as GCC should be ignored. -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) - -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) - -#endif - -#if defined(__clang__) - -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) - -// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug -// which results in calls to destructors being emitted for each temporary, -// without a matching initialization. In practice, this can result in something -// like `std::string::~string` being called on an uninitialized value. -// -// For example, this code will likely segfault under IBM XL: -// ``` -// REQUIRE(std::string("12") + "34" == "1234") -// ``` -// -// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -# endif - -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) - -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) - -#endif // __clang__ - -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif - -//////////////////////////////////////////////////////////////////////////////// -// We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#endif - -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Android somehow still does not support std::to_string -#if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Not all Windows environments support SEH properly -#if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#endif - -//////////////////////////////////////////////////////////////////////////////// -// PS4 -#if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ - -// Required for some versions of Cygwin to declare gettimeofday -// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE -// some versions of cygwin (most) do not support std::to_string. Use the libstd check. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) - -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING - -# endif -#endif // __CYGWIN__ - -//////////////////////////////////////////////////////////////////////////////// -// Visual C++ -#if defined(_MSC_VER) - -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) - -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif - -// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ -// _MSVC_TRADITIONAL == 0 means new conformant preprocessor -// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(__clang__) // Handle Clang masquerading for msvc -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif // MSVC_TRADITIONAL -# endif // __clang__ - -#endif // _MSC_VER - -#if defined(_REENTRANT) || defined(_MSC_VER) -// Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// Check if we are compiled with -fno-exceptions or equivalent -#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED -#endif - -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ - -//////////////////////////////////////////////////////////////////////////////// -// Embarcadero C++Build -#if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// Use of __COUNTER__ is suppressed during code analysis in -// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly -// handled by it. -// Otherwise all supported compilers support COUNTER macro, -// but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// RTX is a special version of Windows that is real time. -// This means that it is detected as Windows, but does not provide -// the same set of capabilities as real Windows does. -#if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE -#endif - -#if !defined(_GLIBCXX_USE_C99_MATH_TR1) -#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Various stdlib support checks that require __has_include -#if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif - - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if __cpp_lib_byte > 0 - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // defined(__has_include) - -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER -#endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH -#endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS -#endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE -#endif - -#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN -#endif - -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC -#endif - -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -# define CATCH_CONFIG_ANDROID_LOGWRITE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -# define CATCH_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Even if we do not think the compiler has that warning, we still have -// to provide a macro that can be used by the code. -#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS -#endif - -// The goal of this macro is to avoid evaluation of the arguments, but -// still have the compiler warn on problems inside... -#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) -#endif - -#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#elif defined(__clang__) && (__clang_major__ < 5) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) -#define CATCH_CATCH_ANON(type) if ((false)) -#else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) -#define CATCH_CATCH_ANON(type) catch (type) -#endif - -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) -#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif - -// end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) -#else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) -#endif - -#include -#include -#include - -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - -namespace Catch { - - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} - -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) - -// end catch_common.h -namespace Catch { - - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; - -} // end namespace Catch - -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION - -// end catch_tag_alias_autoregistrar.h -// start catch_test_registry.h - -// start catch_interfaces_testcase.h - -#include - -namespace Catch { - - class TestSpec; - - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; - - class TestCase; - struct IConfig; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; - - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - -} - -// end catch_interfaces_testcase.h -// start catch_stringref.h - -#include -#include -#include -#include - -namespace Catch { - - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char*; - - private: - static constexpr char const* const s_empty = ""; - - char const* m_start = s_empty; - size_type m_size = 0; - - public: // construction - constexpr StringRef() noexcept = default; - - StringRef( char const* rawChars ) noexcept; - - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} - - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} - - explicit operator std::string() const { - return std::string(m_start, m_size); - } - - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } - - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } - - public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } - - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; - - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; - - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; - - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } - - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } -} // namespace Catch - -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} - -// end catch_stringref.h -// start catch_preprocessor.hpp - - -#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) - -#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ -// MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) -#else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) -#endif - -#define CATCH_REC_END(...) -#define CATCH_REC_OUT - -#define CATCH_EMPTY() -#define CATCH_DEFER(id) id CATCH_EMPTY() - -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 -#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ -#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) -#else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) -#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) -#endif - -#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ -#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) - -#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) -#else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) -#endif - -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) - -#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) - -#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N - -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - template class...> struct TemplateTypeList{};\ - template class...Cs>\ - constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ - template\ - struct append;\ - template\ - struct rewrap;\ - template class, typename...>\ - struct create;\ - template class, typename>\ - struct convert;\ - \ - template \ - struct append { using type = T; };\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ - template< template class L1, typename...E1, typename...Rest>\ - struct append, TypeList, Rest...> { using type = L1; };\ - \ - template< template class Container, template class List, typename...elems>\ - struct rewrap, List> { using type = TypeList>; };\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ - \ - template