├── .cmake-format.py ├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── community.md │ ├── enhancement.md │ ├── feature_request.md │ └── question.md ├── travis │ ├── cmake-build.sh │ ├── cmake-lang.sh │ ├── cmake-test.sh │ └── legacy-build.sh └── workflows │ ├── pr-size.sh │ ├── pr-size.yml │ └── stale.yml ├── .gitignore ├── .travis.yml ├── .vscode ├── cmake-kits.json ├── cmake-variants.yaml └── settings.json ├── CMakeLists.txt ├── Community_made.md ├── Firmware ├── BlinkM.cpp ├── BlinkM.h ├── Configuration.cpp ├── Configuration.h ├── ConfigurationStore.cpp ├── ConfigurationStore.h ├── Configuration_adv.h ├── Configuration_var.h ├── Dcodes.cpp ├── Dcodes.h ├── Filament_sensor.cpp ├── Filament_sensor.h ├── Firmware.ino ├── Marlin.h ├── MarlinSerial.cpp ├── MarlinSerial.h ├── Marlin_main.cpp ├── Prusa_farm.cpp ├── Prusa_farm.h ├── Sd2Card.cpp ├── Sd2Card.h ├── SdBaseFile.cpp ├── SdBaseFile.h ├── SdFatConfig.h ├── SdFatStructs.h ├── SdFatUtil.cpp ├── SdFatUtil.h ├── SdFile.cpp ├── SdFile.h ├── SdInfo.h ├── SdVolume.cpp ├── SdVolume.h ├── Servo.cpp ├── Servo.h ├── SpoolJoin.cpp ├── SpoolJoin.h ├── Tcodes.cpp ├── Tcodes.h ├── Timer.cpp ├── Timer.h ├── TimerRemaining.h ├── adc.cpp ├── adc.h ├── asm.h ├── backlight.cpp ├── backlight.h ├── boards.h ├── bootapp.c ├── bootapp.h ├── cardreader.cpp ├── cardreader.h ├── cmdqueue.cpp ├── cmdqueue.h ├── config.h ├── doxyfile ├── eeprom.cpp ├── eeprom.h ├── fancheck.cpp ├── fancheck.h ├── fastio.h ├── first_lay_cal.cpp ├── first_lay_cal.h ├── heatbed_pwm.cpp ├── la10compat.cpp ├── la10compat.h ├── language.c ├── language.h ├── lcd.cpp ├── lcd.h ├── le.sh ├── macros.h ├── meatpack.cpp ├── meatpack.h ├── menu.cpp ├── menu.h ├── mesh_bed_calibration.cpp ├── mesh_bed_calibration.h ├── mesh_bed_leveling.cpp ├── mesh_bed_leveling.h ├── messages.cpp ├── messages.h ├── mmu2.cpp ├── mmu2.h ├── mmu2 │ ├── buttons.h │ ├── check-pce.sh │ ├── error_codes.h │ ├── errors_list.h │ ├── progress_codes.h │ └── variants │ │ ├── config_MMU2.h │ │ └── config_MMU2S.h ├── mmu2_config.h ├── mmu2_crc.cpp ├── mmu2_crc.h ├── mmu2_error_converter.cpp ├── mmu2_error_converter.h ├── mmu2_fsensor.cpp ├── mmu2_fsensor.h ├── mmu2_log.cpp ├── mmu2_log.h ├── mmu2_marlin.h ├── mmu2_marlin1.cpp ├── mmu2_marlin_macros.h ├── mmu2_power.cpp ├── mmu2_power.h ├── mmu2_progress_converter.cpp ├── mmu2_progress_converter.h ├── mmu2_protocol.cpp ├── mmu2_protocol.h ├── mmu2_protocol_logic.cpp ├── mmu2_protocol_logic.h ├── mmu2_reporting.cpp ├── mmu2_reporting.h ├── mmu2_serial.cpp ├── mmu2_serial.h ├── mmu2_state.h ├── mmu2_supported_version.h ├── motion_control.cpp ├── motion_control.h ├── optiboot_xflash.cpp ├── optiboot_xflash.h ├── pat9125.cpp ├── pat9125.h ├── pins.h ├── pins_Einsy_1_0.h ├── pins_Rambo_1_0.h ├── pins_Rambo_1_3.h ├── planner.cpp ├── planner.h ├── power_panic.cpp ├── power_panic.h ├── printers.h ├── qr_solve.cpp ├── qr_solve.h ├── rbuf.c ├── rbuf.h ├── sm4.c ├── sm4.h ├── sound.cpp ├── sound.h ├── speed_lookuptable.cpp ├── speed_lookuptable.h ├── spi.c ├── spi.h ├── static_assert.h ├── stepper.cpp ├── stepper.h ├── stk500.h ├── strlen_cx.h ├── strtod.c ├── swi2c.c ├── swi2c.h ├── system_timer.h ├── temperature.cpp ├── temperature.h ├── thermal_model.h ├── thermal_model │ ├── e3d_REVO.h │ ├── e3d_REVO_HF_60W.h │ └── e3d_v6.h ├── thermistortables.h ├── timer02.c ├── timer02.h ├── tmc2130.cpp ├── tmc2130.h ├── tone04.c ├── tone04.h ├── twi.cpp ├── twi.h ├── uart2.c ├── uart2.h ├── ultralcd.cpp ├── ultralcd.h ├── util.cpp ├── util.h ├── variants │ ├── MK25-RAMBo10a.h │ ├── MK25-RAMBo13a.h │ ├── MK25S-RAMBo10a.h │ ├── MK25S-RAMBo13a.h │ ├── MK3-E3DREVO.h │ ├── MK3-E3DREVO_HF_60W.h │ ├── MK3.h │ ├── MK3S-E3DREVO.h │ ├── MK3S-E3DREVO_HF_60W.h │ ├── MK3S.h │ ├── README.md │ └── obsolete │ │ ├── 1_75mm_MK2-RAMBo10a-E3Dv6full.h │ │ └── 1_75mm_MK2-RAMBo13a-E3Dv6full.h ├── vector_3.cpp ├── vector_3.h ├── xflash.c ├── xflash.h ├── xflash_dump.cpp ├── xflash_dump.h ├── xflash_layout.h ├── xyzcal.cpp └── xyzcal.h ├── LICENSE ├── MK404-build.sh ├── PF-build.sh ├── README.md ├── build.sh ├── cmake ├── AnyAvrGcc.cmake ├── AvrGcc.cmake ├── Check_final_lang_bin_size.cmake ├── Check_lang_size.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── ProjectVersion.cmake ├── ReproducibleBuild.cmake └── Utilities.cmake ├── lang ├── Community_made_translations.md ├── README.md ├── config.sh ├── fw-build.sh ├── fw-clean.sh ├── iso639-1.txt ├── lang-build.py ├── lang-check.py ├── lang-extract.py ├── lang-map.py ├── lang-patchsec.py ├── lib │ ├── charset.py │ └── io.py ├── po │ ├── Firmware.pot │ ├── Firmware_cs.po │ ├── Firmware_de.po │ ├── Firmware_es.po │ ├── Firmware_fr.po │ ├── Firmware_hr.po │ ├── Firmware_hu.po │ ├── Firmware_it.po │ ├── Firmware_nl.po │ ├── Firmware_no.po │ ├── Firmware_pl.po │ ├── Firmware_ro.po │ ├── Firmware_sk.po │ └── Firmware_sv.po ├── requirements.txt ├── update-po.py ├── update-po.sh ├── update-pot.py └── update-pot.sh ├── lib ├── CMakeLists.txt └── Catch2 │ ├── .bazelrc │ ├── .clang-format │ ├── .conan │ ├── build.py │ └── test_package │ │ ├── CMakeLists.txt │ │ ├── conanfile.py │ │ └── test_package.cpp │ ├── .gitattributes │ ├── .github │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── pull_request_template.md │ └── workflows │ │ ├── linux-meson-builds.yml │ │ ├── linux-other-builds.yml │ │ ├── linux-simple-builds.yml │ │ ├── mac-builds.yml │ │ └── validate-header-guards.yml │ ├── .gitignore │ ├── .gitrepo │ ├── BUILD.bazel │ ├── CMake │ ├── Catch2Config.cmake.in │ ├── CatchConfigOptions.cmake │ ├── CatchMiscFunctions.cmake │ ├── FindGcov.cmake │ ├── FindLcov.cmake │ ├── Findcodecov.cmake │ ├── catch2-with-main.pc.in │ ├── catch2.pc.in │ └── llvm-cov-wrapper │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── CODE_OF_CONDUCT.md │ ├── Doxyfile │ ├── LICENSE.txt │ ├── README.md │ ├── SECURITY.md │ ├── WORKSPACE.bazel │ ├── appveyor.yml │ ├── codecov.yml │ ├── conanfile.py │ ├── data │ └── artwork │ │ ├── catch2-c-logo.png │ │ ├── catch2-hand-logo.png │ │ └── catch2-logo-small.png │ ├── docs │ ├── Readme.md │ ├── assertions.md │ ├── benchmarks.md │ ├── ci-and-misc.md │ ├── cmake-integration.md │ ├── command-line.md │ ├── commercial-users.md │ ├── comparing-floating-point-numbers.md │ ├── configuration.md │ ├── contributing.md │ ├── deprecations.md │ ├── event-listeners.md │ ├── faq.md │ ├── generators.md │ ├── limitations.md │ ├── list-of-examples.md │ ├── logging.md │ ├── matchers.md │ ├── migrate-v2-to-v3.md │ ├── opensource-users.md │ ├── other-macros.md │ ├── own-main.md │ ├── release-notes.md │ ├── release-process.md │ ├── reporter-events.md │ ├── reporters.md │ ├── test-cases-and-sections.md │ ├── test-fixtures.md │ ├── tostring.md │ ├── tutorial.md │ ├── usage-tips.md │ └── why-catch.md │ ├── examples │ ├── 010-TestCase.cpp │ ├── 020-TestCase-1.cpp │ ├── 020-TestCase-2.cpp │ ├── 030-Asn-Require-Check.cpp │ ├── 100-Fix-Section.cpp │ ├── 110-Fix-ClassFixture.cpp │ ├── 120-Bdd-ScenarioGivenWhenThen.cpp │ ├── 210-Evt-EventListeners.cpp │ ├── 231-Cfg-OutputStreams.cpp │ ├── 300-Gen-OwnGenerator.cpp │ ├── 301-Gen-MapTypeConversion.cpp │ ├── 302-Gen-Table.cpp │ ├── 310-Gen-VariablesInGenerators.cpp │ ├── 311-Gen-CustomCapture.cpp │ └── CMakeLists.txt │ ├── extras │ ├── Catch.cmake │ ├── CatchAddTests.cmake │ ├── CatchShardTests.cmake │ ├── CatchShardTestsImpl.cmake │ ├── ParseAndAddCatchTests.cmake │ ├── catch_amalgamated.cpp │ ├── catch_amalgamated.hpp │ ├── gdbinit │ └── lldbinit │ ├── fuzzing │ ├── CMakeLists.txt │ ├── NullOStream.cpp │ ├── NullOStream.h │ ├── build_fuzzers.sh │ ├── fuzz_TestSpecParser.cpp │ ├── fuzz_XmlWriter.cpp │ └── fuzz_textflow.cpp │ ├── mdsnippets.json │ ├── meson.build │ ├── src │ ├── CMakeLists.txt │ └── catch2 │ │ ├── benchmark │ │ ├── catch_benchmark.hpp │ │ ├── catch_benchmark_all.hpp │ │ ├── catch_chronometer.cpp │ │ ├── catch_chronometer.hpp │ │ ├── catch_clock.hpp │ │ ├── catch_constructor.hpp │ │ ├── catch_environment.hpp │ │ ├── catch_estimate.hpp │ │ ├── catch_execution_plan.hpp │ │ ├── catch_optimizer.hpp │ │ ├── catch_outlier_classification.hpp │ │ ├── catch_sample_analysis.hpp │ │ └── detail │ │ │ ├── catch_analyse.hpp │ │ │ ├── catch_benchmark_function.cpp │ │ │ ├── catch_benchmark_function.hpp │ │ │ ├── catch_complete_invoke.hpp │ │ │ ├── catch_estimate_clock.hpp │ │ │ ├── catch_measure.hpp │ │ │ ├── catch_repeat.hpp │ │ │ ├── catch_run_for_at_least.cpp │ │ │ ├── catch_run_for_at_least.hpp │ │ │ ├── catch_stats.cpp │ │ │ ├── catch_stats.hpp │ │ │ └── catch_timing.hpp │ │ ├── catch_all.hpp │ │ ├── catch_approx.cpp │ │ ├── catch_approx.hpp │ │ ├── catch_assertion_info.hpp │ │ ├── catch_assertion_result.cpp │ │ ├── catch_assertion_result.hpp │ │ ├── catch_config.cpp │ │ ├── catch_config.hpp │ │ ├── catch_get_random_seed.cpp │ │ ├── catch_get_random_seed.hpp │ │ ├── catch_message.cpp │ │ ├── catch_message.hpp │ │ ├── catch_registry_hub.cpp │ │ ├── catch_section_info.hpp │ │ ├── catch_session.cpp │ │ ├── catch_session.hpp │ │ ├── catch_tag_alias.hpp │ │ ├── catch_tag_alias_autoregistrar.cpp │ │ ├── catch_tag_alias_autoregistrar.hpp │ │ ├── catch_template_test_macros.hpp │ │ ├── catch_test_case_info.cpp │ │ ├── catch_test_case_info.hpp │ │ ├── catch_test_macros.hpp │ │ ├── catch_test_spec.cpp │ │ ├── catch_test_spec.hpp │ │ ├── catch_timer.cpp │ │ ├── catch_timer.hpp │ │ ├── catch_tostring.cpp │ │ ├── catch_tostring.hpp │ │ ├── catch_totals.cpp │ │ ├── catch_totals.hpp │ │ ├── catch_translate_exception.hpp │ │ ├── catch_user_config.hpp.in │ │ ├── catch_version.cpp │ │ ├── catch_version.hpp │ │ ├── catch_version_macros.hpp │ │ ├── generators │ │ ├── catch_generator_exception.cpp │ │ ├── catch_generator_exception.hpp │ │ ├── catch_generators.cpp │ │ ├── catch_generators.hpp │ │ ├── catch_generators_adapters.hpp │ │ ├── catch_generators_all.hpp │ │ ├── catch_generators_random.cpp │ │ ├── catch_generators_random.hpp │ │ └── catch_generators_range.hpp │ │ ├── interfaces │ │ ├── catch_interfaces_all.hpp │ │ ├── catch_interfaces_capture.cpp │ │ ├── catch_interfaces_capture.hpp │ │ ├── catch_interfaces_config.cpp │ │ ├── catch_interfaces_config.hpp │ │ ├── catch_interfaces_enum_values_registry.hpp │ │ ├── catch_interfaces_exception.cpp │ │ ├── catch_interfaces_exception.hpp │ │ ├── catch_interfaces_generatortracker.cpp │ │ ├── catch_interfaces_generatortracker.hpp │ │ ├── catch_interfaces_registry_hub.cpp │ │ ├── catch_interfaces_registry_hub.hpp │ │ ├── catch_interfaces_reporter.cpp │ │ ├── catch_interfaces_reporter.hpp │ │ ├── catch_interfaces_reporter_factory.cpp │ │ ├── catch_interfaces_reporter_factory.hpp │ │ ├── catch_interfaces_reporter_registry.cpp │ │ ├── catch_interfaces_reporter_registry.hpp │ │ ├── catch_interfaces_tag_alias_registry.hpp │ │ ├── catch_interfaces_testcase.cpp │ │ └── catch_interfaces_testcase.hpp │ │ ├── internal │ │ ├── catch_assertion_handler.cpp │ │ ├── catch_assertion_handler.hpp │ │ ├── catch_case_insensitive_comparisons.cpp │ │ ├── catch_case_insensitive_comparisons.hpp │ │ ├── catch_case_sensitive.hpp │ │ ├── catch_clara.cpp │ │ ├── catch_clara.hpp │ │ ├── catch_commandline.cpp │ │ ├── catch_commandline.hpp │ │ ├── catch_compiler_capabilities.hpp │ │ ├── catch_config_android_logwrite.hpp │ │ ├── catch_config_counter.hpp │ │ ├── catch_config_uncaught_exceptions.hpp │ │ ├── catch_config_wchar.hpp │ │ ├── catch_console_colour.cpp │ │ ├── catch_console_colour.hpp │ │ ├── catch_console_width.hpp │ │ ├── catch_container_nonmembers.hpp │ │ ├── catch_context.cpp │ │ ├── catch_context.hpp │ │ ├── catch_debug_console.cpp │ │ ├── catch_debug_console.hpp │ │ ├── catch_debugger.cpp │ │ ├── catch_debugger.hpp │ │ ├── catch_decomposer.cpp │ │ ├── catch_decomposer.hpp │ │ ├── catch_enforce.cpp │ │ ├── catch_enforce.hpp │ │ ├── catch_enum_values_registry.cpp │ │ ├── catch_enum_values_registry.hpp │ │ ├── catch_errno_guard.cpp │ │ ├── catch_errno_guard.hpp │ │ ├── catch_exception_translator_registry.cpp │ │ ├── catch_exception_translator_registry.hpp │ │ ├── catch_fatal_condition_handler.cpp │ │ ├── catch_fatal_condition_handler.hpp │ │ ├── catch_floating_point_helpers.cpp │ │ ├── catch_floating_point_helpers.hpp │ │ ├── catch_istream.cpp │ │ ├── catch_istream.hpp │ │ ├── catch_lazy_expr.cpp │ │ ├── catch_lazy_expr.hpp │ │ ├── catch_leak_detector.cpp │ │ ├── catch_leak_detector.hpp │ │ ├── catch_list.cpp │ │ ├── catch_list.hpp │ │ ├── catch_main.cpp │ │ ├── catch_message_info.cpp │ │ ├── catch_message_info.hpp │ │ ├── catch_meta.hpp │ │ ├── catch_move_and_forward.hpp │ │ ├── catch_noncopyable.hpp │ │ ├── catch_optional.hpp │ │ ├── catch_output_redirect.cpp │ │ ├── catch_output_redirect.hpp │ │ ├── catch_platform.hpp │ │ ├── catch_polyfills.cpp │ │ ├── catch_polyfills.hpp │ │ ├── catch_preprocessor.hpp │ │ ├── catch_preprocessor_remove_parens.hpp │ │ ├── catch_random_number_generator.cpp │ │ ├── catch_random_number_generator.hpp │ │ ├── catch_random_seed_generation.cpp │ │ ├── catch_random_seed_generation.hpp │ │ ├── catch_reporter_registry.cpp │ │ ├── catch_reporter_registry.hpp │ │ ├── catch_reporter_spec_parser.cpp │ │ ├── catch_reporter_spec_parser.hpp │ │ ├── catch_result_type.cpp │ │ ├── catch_result_type.hpp │ │ ├── catch_reusable_string_stream.cpp │ │ ├── catch_reusable_string_stream.hpp │ │ ├── catch_run_context.cpp │ │ ├── catch_run_context.hpp │ │ ├── catch_section.cpp │ │ ├── catch_section.hpp │ │ ├── catch_sharding.hpp │ │ ├── catch_singletons.cpp │ │ ├── catch_singletons.hpp │ │ ├── catch_source_line_info.cpp │ │ ├── catch_source_line_info.hpp │ │ ├── catch_startup_exception_registry.cpp │ │ ├── catch_startup_exception_registry.hpp │ │ ├── catch_stdstreams.cpp │ │ ├── catch_stdstreams.hpp │ │ ├── catch_stream_end_stop.hpp │ │ ├── catch_string_manip.cpp │ │ ├── catch_string_manip.hpp │ │ ├── catch_stringref.cpp │ │ ├── catch_stringref.hpp │ │ ├── catch_tag_alias_registry.cpp │ │ ├── catch_tag_alias_registry.hpp │ │ ├── catch_template_test_registry.hpp │ │ ├── catch_test_case_info_hasher.cpp │ │ ├── catch_test_case_info_hasher.hpp │ │ ├── catch_test_case_registry_impl.cpp │ │ ├── catch_test_case_registry_impl.hpp │ │ ├── catch_test_case_tracker.cpp │ │ ├── catch_test_case_tracker.hpp │ │ ├── catch_test_failure_exception.hpp │ │ ├── catch_test_macro_impl.hpp │ │ ├── catch_test_registry.cpp │ │ ├── catch_test_registry.hpp │ │ ├── catch_test_spec_parser.cpp │ │ ├── catch_test_spec_parser.hpp │ │ ├── catch_textflow.cpp │ │ ├── catch_textflow.hpp │ │ ├── catch_to_string.hpp │ │ ├── catch_uncaught_exceptions.cpp │ │ ├── catch_uncaught_exceptions.hpp │ │ ├── catch_unique_name.hpp │ │ ├── catch_unique_ptr.hpp │ │ ├── catch_void_type.hpp │ │ ├── catch_wildcard_pattern.cpp │ │ ├── catch_wildcard_pattern.hpp │ │ ├── catch_windows_h_proxy.hpp │ │ ├── catch_xmlwriter.cpp │ │ └── catch_xmlwriter.hpp │ │ ├── matchers │ │ ├── catch_matchers.cpp │ │ ├── catch_matchers.hpp │ │ ├── catch_matchers_all.hpp │ │ ├── catch_matchers_container_properties.cpp │ │ ├── catch_matchers_container_properties.hpp │ │ ├── catch_matchers_contains.hpp │ │ ├── catch_matchers_exception.cpp │ │ ├── catch_matchers_exception.hpp │ │ ├── catch_matchers_floating_point.cpp │ │ ├── catch_matchers_floating_point.hpp │ │ ├── catch_matchers_predicate.cpp │ │ ├── catch_matchers_predicate.hpp │ │ ├── catch_matchers_quantifiers.cpp │ │ ├── catch_matchers_quantifiers.hpp │ │ ├── catch_matchers_string.cpp │ │ ├── catch_matchers_string.hpp │ │ ├── catch_matchers_templated.cpp │ │ ├── catch_matchers_templated.hpp │ │ ├── catch_matchers_vector.hpp │ │ └── internal │ │ │ ├── catch_matchers_impl.cpp │ │ │ └── catch_matchers_impl.hpp │ │ ├── meson.build │ │ └── reporters │ │ ├── catch_reporter_automake.cpp │ │ ├── catch_reporter_automake.hpp │ │ ├── catch_reporter_common_base.cpp │ │ ├── catch_reporter_common_base.hpp │ │ ├── catch_reporter_compact.cpp │ │ ├── catch_reporter_compact.hpp │ │ ├── catch_reporter_console.cpp │ │ ├── catch_reporter_console.hpp │ │ ├── catch_reporter_cumulative_base.cpp │ │ ├── catch_reporter_cumulative_base.hpp │ │ ├── catch_reporter_event_listener.cpp │ │ ├── catch_reporter_event_listener.hpp │ │ ├── catch_reporter_helpers.cpp │ │ ├── catch_reporter_helpers.hpp │ │ ├── catch_reporter_junit.cpp │ │ ├── catch_reporter_junit.hpp │ │ ├── catch_reporter_multi.cpp │ │ ├── catch_reporter_multi.hpp │ │ ├── catch_reporter_registrars.cpp │ │ ├── catch_reporter_registrars.hpp │ │ ├── catch_reporter_sonarqube.cpp │ │ ├── catch_reporter_sonarqube.hpp │ │ ├── catch_reporter_streaming_base.cpp │ │ ├── catch_reporter_streaming_base.hpp │ │ ├── catch_reporter_tap.cpp │ │ ├── catch_reporter_tap.hpp │ │ ├── catch_reporter_teamcity.cpp │ │ ├── catch_reporter_teamcity.hpp │ │ ├── catch_reporter_xml.cpp │ │ ├── catch_reporter_xml.hpp │ │ └── catch_reporters_all.hpp │ ├── tests │ ├── CMakeLists.txt │ ├── ExtraTests │ │ ├── CMakeLists.txt │ │ ├── ToDo.txt │ │ ├── X01-PrefixedMacros.cpp │ │ ├── X02-DisabledMacros.cpp │ │ ├── X03-DisabledExceptions-DefaultHandler.cpp │ │ ├── X04-DisabledExceptions-CustomHandler.cpp │ │ ├── X05-DeferredStaticChecks.cpp │ │ ├── X10-FallbackStringifier.cpp │ │ ├── X11-DisableStringification.cpp │ │ ├── X12-CustomDebugBreakMacro.cpp │ │ ├── X21-PartialTestCaseEvents.cpp │ │ ├── X22-BenchmarksInCumulativeReporter.cpp │ │ ├── X23-CasingInReporterNames.cpp │ │ ├── X24-ListenerStdoutCaptureInMultireporter.cpp │ │ ├── X25-ListenerCanAskForCapturedStdout.cpp │ │ ├── X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp │ │ ├── X27-CapturedStdoutInTestCaseEvents.cpp │ │ ├── X28-ListenersGetEventsBeforeReporters.cpp │ │ ├── X29-CustomArgumentsForReporters.cpp │ │ ├── X30-BazelReporter.cpp │ │ ├── X31-DuplicatedTestCases.cpp │ │ ├── X32-DuplicatedTestCasesDifferentTags.cpp │ │ ├── X33-DuplicatedTestCaseMethods.cpp │ │ ├── X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp │ │ ├── X35-DuplicatedReporterNames.cpp │ │ ├── X90-WindowsHeaderInclusion.cpp │ │ ├── X91-AmalgamatedCatch.cpp │ │ └── X92-NoTests.cpp │ ├── SelfTest │ │ ├── Baselines │ │ │ ├── automake.std.approved.txt │ │ │ ├── automake.sw.approved.txt │ │ │ ├── automake.sw.multi.approved.txt │ │ │ ├── compact.sw.approved.txt │ │ │ ├── compact.sw.multi.approved.txt │ │ │ ├── console.std.approved.txt │ │ │ ├── console.sw.approved.txt │ │ │ ├── console.sw.multi.approved.txt │ │ │ ├── console.swa4.approved.txt │ │ │ ├── default.sw.multi.approved.txt │ │ │ ├── junit.sw.approved.txt │ │ │ ├── junit.sw.multi.approved.txt │ │ │ ├── sonarqube.sw.approved.txt │ │ │ ├── sonarqube.sw.multi.approved.txt │ │ │ ├── tap.sw.approved.txt │ │ │ ├── tap.sw.multi.approved.txt │ │ │ ├── teamcity.sw.approved.txt │ │ │ ├── teamcity.sw.multi.approved.txt │ │ │ ├── xml.sw.approved.txt │ │ │ └── xml.sw.multi.approved.txt │ │ ├── IntrospectiveTests │ │ │ ├── Clara.tests.cpp │ │ │ ├── CmdLine.tests.cpp │ │ │ ├── CmdLineHelpers.tests.cpp │ │ │ ├── ColourImpl.tests.cpp │ │ │ ├── Details.tests.cpp │ │ │ ├── FloatingPoint.tests.cpp │ │ │ ├── GeneratorsImpl.tests.cpp │ │ │ ├── InternalBenchmark.tests.cpp │ │ │ ├── PartTracker.tests.cpp │ │ │ ├── RandomNumberGeneration.tests.cpp │ │ │ ├── Reporters.tests.cpp │ │ │ ├── Sharding.tests.cpp │ │ │ ├── Stream.tests.cpp │ │ │ ├── String.tests.cpp │ │ │ ├── StringManip.tests.cpp │ │ │ ├── Tag.tests.cpp │ │ │ ├── TestCaseInfoHasher.tests.cpp │ │ │ ├── TestSpecParser.tests.cpp │ │ │ ├── TextFlow.tests.cpp │ │ │ ├── ToString.tests.cpp │ │ │ ├── UniquePtr.tests.cpp │ │ │ └── Xml.tests.cpp │ │ ├── Misc │ │ │ ├── invalid-test-names.input │ │ │ ├── plain-old-tests.input │ │ │ └── special-characters-in-file.input │ │ ├── TestRegistrations.cpp │ │ ├── TimingTests │ │ │ └── Sleep.tests.cpp │ │ └── UsageTests │ │ │ ├── Approx.tests.cpp │ │ │ ├── BDD.tests.cpp │ │ │ ├── Benchmark.tests.cpp │ │ │ ├── Class.tests.cpp │ │ │ ├── Compilation.tests.cpp │ │ │ ├── Condition.tests.cpp │ │ │ ├── Decomposition.tests.cpp │ │ │ ├── EnumToString.tests.cpp │ │ │ ├── Exception.tests.cpp │ │ │ ├── Generators.tests.cpp │ │ │ ├── Matchers.tests.cpp │ │ │ ├── MatchersRanges.tests.cpp │ │ │ ├── Message.tests.cpp │ │ │ ├── Misc.tests.cpp │ │ │ ├── ToStringByte.tests.cpp │ │ │ ├── ToStringChrono.tests.cpp │ │ │ ├── ToStringGeneral.tests.cpp │ │ │ ├── ToStringOptional.tests.cpp │ │ │ ├── ToStringPair.tests.cpp │ │ │ ├── ToStringTuple.tests.cpp │ │ │ ├── ToStringVariant.tests.cpp │ │ │ ├── ToStringVector.tests.cpp │ │ │ ├── ToStringWhich.tests.cpp │ │ │ ├── Tricky.tests.cpp │ │ │ └── VariadicMacros.tests.cpp │ ├── TestScripts │ │ ├── ConfigureTestsCommon.py │ │ ├── testBazelReporter.py │ │ ├── testConfigureDefaultReporter.py │ │ ├── testConfigureDisable.py │ │ ├── testConfigureDisableStringification.py │ │ ├── testConfigureExperimentalRedirect.py │ │ ├── testPartialTestCaseEvent.py │ │ ├── testRandomOrder.py │ │ └── testSharding.py │ └── meson.build │ ├── third_party │ └── clara.hpp │ └── tools │ ├── misc │ ├── CMakeLists.txt │ ├── appveyorBuildConfigurationScript.bat │ ├── appveyorMergeCoverageScript.py │ ├── appveyorTestRunScript.bat │ ├── coverage-helper.cpp │ └── installOpenCppCoverage.ps1 │ └── scripts │ ├── approvalTests.py │ ├── approve.py │ ├── buildAndTest.cmd │ ├── buildAndTest.sh │ ├── checkConvenienceHeaders.py │ ├── checkDuplicateFilenames.py │ ├── checkLicense.py │ ├── developBuild.py │ ├── extractFeaturesFromReleaseNotes.py │ ├── fixWhitespace.py │ ├── generateAmalgamatedFiles.py │ ├── majorRelease.py │ ├── minorRelease.py │ ├── patchRelease.py │ ├── releaseCommon.py │ ├── scriptCommon.py │ ├── updateDocumentSnippets.py │ └── updateDocumentToC.py ├── prepare_winbuild.ps1 ├── tests ├── Arduino.h ├── CMakeLists.txt ├── Example_test.cpp ├── PrusaStatistics_test.cpp └── Timer_test.cpp ├── tools ├── README.md ├── dump2bin ├── dump_crash ├── dump_eeprom ├── dump_sram ├── elf_mem_map ├── lib │ ├── avr.py │ └── dump.py ├── noreset ├── tml_decode ├── update_eeprom ├── utils.gdb └── xfimg2dump └── utils └── bootstrap.py /.cmake-format.py: -------------------------------------------------------------------------------- 1 | # If a statement is wrapped to more than one line, than dangle the closing 2 | # parenthesis on it's own line. 3 | dangle_parens = True 4 | dangle_align = 'child' 5 | 6 | # If true, the parsers may infer whether or not an argument list is sortable 7 | # (without annotation). 8 | autosort = True 9 | 10 | # How wide to allow formatted cmake files 11 | line_width = 100 12 | 13 | additional_commands = { 14 | "target_sources": { 15 | "kwargs": { 16 | "PUBLIC": "*", 17 | "PRIVATE": "*", 18 | "INTERFACE": "*", 19 | } 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | #-*-mode:conf-*- 2 | # editorconfig file (see EditorConfig.org) 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | insert_final_newline = true 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | indent_style = space 12 | indent_size = 4 13 | tab_width = 4 14 | max_line_length = 100 15 | 16 | [lang/po/*.po] 17 | end_of_line = crlf 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | lang/po/*.po text eol=crlf diff=po 2 | lang/po/*.pot text diff=po 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 12 | **Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2] 13 | **Printer firmware version** - [e.g. 3.8.1, 3.8.1-RC1, ...] 14 | 15 | **MMU upgrade** - [e.g. MMU2S, MMU2, MMU1] 16 | **MMU upgrade firmware version** - [e.g. 1.0.6, 1.0.6-RC2, ...] 17 | 18 | **SD card or USB/Octoprint** 19 | Please let us know if you print via SD card or USB/Octoprint 20 | 21 | **Describe the bug** 22 | A clear and concise description of what the bug is. 23 | 24 | **To Reproduce** 25 | Please describe steps to reproduce the behavior. 26 | 27 | **Expected behavior** 28 | A clear and concise description of what you expected to happen. 29 | 30 | **G-code** 31 | Please attach a G-code. This will make it easier for us to replicate the error. 32 | 33 | **Video** 34 | Please attach a video. It usually helps to solve the problem. 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/community.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Community 3 | about: Related to "Community made" features 4 | title: "[Community made] " 5 | labels: community_made 6 | assignees: '' 7 | 8 | --- 9 | 10 | Prusa Research will NOT follow up these issues! 11 | The maintainers of the "Community made" feature should/will react. 12 | 13 | Please, before you create a new "Community made" ticket, please make sure you searched in open and closed issues and couldn't find anything that matches. 14 | 15 | **Which Community made feature do you want to address?** 16 | 17 | **What is your request/question/suggestion?** 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement 3 | about: Suggest an idea for this project 4 | title: " [ENHANCEMENT]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches. 11 | 12 | Enter what type of printer or upgrade the enhancement applies to. 13 | **Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2] 14 | **MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1] 15 | 16 | **Is your enhancement related to a problem? Please describe.** 17 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 18 | 19 | **Describe the solution you'd like** 20 | A clear and concise description of what you want to happen. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE REQUEST]" 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches. 11 | 12 | If it makes sense, enter what type of printer or upgrade the feature request applies to. 13 | **Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2] 14 | **MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1] 15 | 16 | **Is your feature request related to a problem? Please describe.** 17 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 18 | 19 | **Describe the solution you'd like** 20 | A clear and concise description of what you want to happen. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: What do you want to know? 4 | title: "[QUESTION]" 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please, before you create a new question, please make sure you searched in open and closed issues and couldn't find anything that matches. 11 | 12 | **What is your question?** 13 | -------------------------------------------------------------------------------- /.github/travis/cmake-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -xe 3 | rm -rf build 4 | mkdir build 5 | cd build 6 | cmake .. \ 7 | -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" \ 8 | -DCMAKE_BUILD_TYPE=Release \ 9 | -G Ninja 10 | ninja ALL_FIRMWARE 11 | -------------------------------------------------------------------------------- /.github/travis/cmake-lang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -xe 3 | rm -rf build 4 | mkdir build 5 | cd build 6 | cmake .. \ 7 | -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" \ 8 | -DCMAKE_BUILD_TYPE=Release \ 9 | -G Ninja 10 | 11 | # ignore all failures in order to show as much output as possible 12 | ninja -k0 check_lang || true 13 | -------------------------------------------------------------------------------- /.github/travis/cmake-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -xe 3 | rm -rf build 4 | mkdir build 5 | cd build 6 | cmake .. -G Ninja 7 | ninja tests 8 | ctest 9 | -------------------------------------------------------------------------------- /.github/workflows/pr-size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | MESSAGE=$1 3 | BASE_DIR=$2 4 | PR_DIR=$3 5 | shift 3 6 | 7 | # this assumes we're running from the repository root 8 | AVR_SIZE=$(echo .dependencies/avr-gcc-*/bin/avr-size) 9 | test -x "$AVR_SIZE" || exit 2 10 | 11 | avr_size() 12 | { 13 | "$AVR_SIZE" --mcu=atmega2560 -C "$@" 14 | } 15 | 16 | avr_flash() 17 | { 18 | avr_size "$@" | sed -ne 's/^Program: *\([0-9]\+\).*/\1/p' 19 | } 20 | 21 | avr_ram() 22 | { 23 | avr_size "$@" | sed -ne 's/^Data: *\([0-9]\+\).*/\1/p' 24 | } 25 | 26 | cat < "$MESSAGE" 27 | | Target | ΔFlash (bytes) | ΔSRAM (bytes) | 28 | | ------ | -------------- | ------------- | 29 | EOF 30 | for TARGET in $@ 31 | do 32 | # strip the multilang prefix 33 | variant=${TARGET%_MULTILANG} 34 | 35 | base_bin=$(echo ${BASE_DIR}/build_gen/$variant/${variant}_lang_base) 36 | base_flash=$(avr_flash "$base_bin") 37 | base_ram=$(avr_ram "$base_bin") 38 | 39 | pr_bin=$(echo ${PR_DIR}/build_gen/$variant/${variant}_lang_base) 40 | pr_flash=$(avr_flash "$pr_bin") 41 | pr_ram=$(avr_ram "$pr_bin") 42 | 43 | flash_d=$(($pr_flash - $base_flash)) 44 | ram_d=$(($pr_ram - $base_ram)) 45 | 46 | echo "| \`$TARGET\` | $flash_d | $ram_d |" >> "$MESSAGE" 47 | done 48 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Mark stale issues 2 | 3 | on: 4 | schedule: 5 | # 1:30 AM on MON/THU 6 | - cron: "30 1 * * 1,4" 7 | 8 | jobs: 9 | stale: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/stale@v3 15 | with: 16 | repo-token: ${{ secrets.GITHUB_TOKEN }} 17 | # Don't ever mark PRs as stale. 18 | days-before-pr-stale: -1 19 | stale-issue-message: 'This issue is stale because it has been open for 60 days with no activity. The issue will be closed in 7 days unless you remove the "stale" label or add a comment.' 20 | close-issue-message: 'This issue has been closed due to lack of activity.' 21 | # Don't act on things assigned to a milestone or assigned to someone. 22 | exempt-all-milestones: true 23 | exempt-all-assignees: true 24 | enable-statistics: true 25 | # Disable this and change the operations per run back to 30 when this goes live. 26 | debug-only: true 27 | operations-per-run: 1000 28 | stale-issue-label: 'stale-issue' 29 | stale-pr-label: 'stale-pr' 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE data 2 | /.settings 3 | /.project 4 | /.cproject 5 | 6 | # cmake 7 | /build/ 8 | /build_gen/ 9 | /.dependencies 10 | /compile_commands.json 11 | 12 | # Temporary configuration 13 | /Firmware/Configuration_prusa.h 14 | 15 | # Temporary language files 16 | /lang/po/*.mo 17 | /lang/tmp/ 18 | /lang/Firmware-intl.hex 19 | /lang/Firmware-intl-en_*.hex 20 | /lang/*.map 21 | 22 | # Temporary files and directories 23 | *[~#] 24 | *.tmp 25 | *.bak 26 | .DS_Store 27 | __pycache__ 28 | 29 | # Generated files 30 | /build-env/ 31 | /Firmware/Doc/ 32 | -------------------------------------------------------------------------------- /.vscode/cmake-kits.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "avr-gcc", 4 | "toolchainFile": "${workspaceFolder}/cmake/AvrGcc.cmake", 5 | "cmakeSettings": { 6 | "CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.10.2/ninja", 7 | "CMAKE_BUILD_TYPE": "Release" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /.vscode/cmake-variants.yaml: -------------------------------------------------------------------------------- 1 | buildType: 2 | default: debug 3 | choices: 4 | debug: 5 | short: Debug 6 | long: Emit debug information 7 | buildType: Debug 8 | release: 9 | short: Release 10 | long: Optimize generated code 11 | buildType: Release 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": true, 3 | "cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json", 4 | "cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.22.5/bin/cmake", 5 | "cmake.generator": "Ninja", 6 | "files.insertFinalNewline": true, 7 | "files.associations": { 8 | "xlocale": "cpp" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Firmware/BlinkM.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | BlinkM.cpp - Library for controlling a BlinkM over i2c 3 | Created by Tim Koster, August 21 2013. 4 | */ 5 | #include "Marlin.h" 6 | #ifdef BLINKM 7 | 8 | #if (ARDUINO >= 100) 9 | # include "Arduino.h" 10 | #else 11 | # include "WProgram.h" 12 | #endif 13 | 14 | #include "BlinkM.h" 15 | 16 | void SendColors(byte red, byte grn, byte blu) 17 | { 18 | Wire.begin(); 19 | Wire.beginTransmission(0x09); 20 | Wire.write('o'); //to disable ongoing script, only needs to be used once 21 | Wire.write('n'); 22 | Wire.write(red); 23 | Wire.write(grn); 24 | Wire.write(blu); 25 | Wire.endTransmission(); 26 | } 27 | 28 | #endif //BLINKM 29 | 30 | -------------------------------------------------------------------------------- /Firmware/BlinkM.h: -------------------------------------------------------------------------------- 1 | /* 2 | BlinkM.h 3 | Library header file for BlinkM library 4 | */ 5 | #if (ARDUINO >= 100) 6 | # include "Arduino.h" 7 | #else 8 | # include "WProgram.h" 9 | #endif 10 | 11 | #include "Wire.h" 12 | 13 | void SendColors(byte red, byte grn, byte blu); 14 | 15 | -------------------------------------------------------------------------------- /Firmware/Configuration.cpp: -------------------------------------------------------------------------------- 1 | #include "Configuration.h" 2 | #include "Configuration_var.h" 3 | 4 | const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE; 5 | const char _sPrinterName[] PROGMEM=PRINTER_NAME; 6 | const uint16_t _nPrinterMmuType PROGMEM=PRINTER_MMU_TYPE; 7 | const char _sPrinterMmuName[] PROGMEM=PRINTER_MMU_NAME; 8 | -------------------------------------------------------------------------------- /Firmware/Configuration_var.h: -------------------------------------------------------------------------------- 1 | // Include the printer's variant configuration header 2 | #pragma once 3 | 4 | // This is set by the cmake build to be able to take control of 5 | // the variant header without breaking existing build mechanisms. 6 | #ifndef CMAKE_CONTROL 7 | #include "Configuration_prusa.h" 8 | #else 9 | #include FW_VARIANT 10 | #endif 11 | -------------------------------------------------------------------------------- /Firmware/Prusa_farm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "config.h" 5 | 6 | #define FARM_PREHEAT_HOTEND_TEMP 250 7 | #define FARM_PREHEAT_HPB_TEMP 80 8 | 9 | #define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul) 10 | #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring 11 | #define NC_BUTTON_LONG_PRESS 15 //time in s 12 | 13 | //#define FARM_CONNECT_MESSAGE 14 | 15 | #ifdef PRUSA_FARM 16 | extern uint8_t farm_mode; 17 | #else 18 | #define farm_mode 0 19 | #endif 20 | 21 | #ifdef PRUSA_M28 22 | extern bool prusa_sd_card_upload; 23 | extern void serial_read_stream(); 24 | #endif 25 | extern void prusa_statistics(uint8_t _message); 26 | extern void prusa_statistics_update_from_status_screen(); 27 | extern void prusa_statistics_update_from_lcd_update(); 28 | extern void farm_mode_init(); 29 | extern bool farm_prusa_code_seen(); 30 | extern void farm_gcode_g98(); 31 | extern void farm_gcode_g99(); 32 | extern void farm_disable(); 33 | -------------------------------------------------------------------------------- /Firmware/Tcodes.h: -------------------------------------------------------------------------------- 1 | /// @file 2 | #pragma once 3 | #include 4 | 5 | void TCodes(char * const strchr_pointer, uint8_t codeValue); 6 | -------------------------------------------------------------------------------- /Firmware/adc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "config.h" 5 | 6 | /* 7 | http://resnet.uoregon.edu/~gurney_j/jmpc/bitwise.html 8 | */ 9 | #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) 10 | #define BX_(x) ((x) - (((x)>>1)&0x77777777) - (((x)>>2)&0x33333333) - (((x)>>3)&0x11111111)) 11 | 12 | #define ADC_PIN_IDX(pin) BITCOUNT(ADC_CHAN_MSK & ((1 << (pin)) - 1)) 13 | 14 | #if BITCOUNT(ADC_CHAN_MSK) != ADC_CHAN_CNT 15 | # error "ADC_CHAN_MSK oes not match ADC_CHAN_CNT" 16 | #endif 17 | 18 | #define VOLT_DIV_REF 5 //[V] 19 | 20 | extern volatile uint8_t adc_channel; 21 | extern volatile uint16_t adc_values[ADC_CHAN_CNT]; 22 | 23 | extern void adc_init(); 24 | extern void adc_start_cycle(); //should be called from an atomic context only 25 | static inline bool adc_cycle_done() { return adc_channel >= ADC_CHAN_CNT; } 26 | -------------------------------------------------------------------------------- /Firmware/asm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "macros.h" 4 | 5 | #ifdef __AVR_ATmega2560__ 6 | 7 | // return the current PC (on AVRs with 22bit PC) 8 | FORCE_INLINE __uint24 GETPC(void) 9 | { 10 | __uint24 ret; 11 | asm ( 12 | "rcall .\n" 13 | "pop %A0\n" 14 | "pop %B0\n" 15 | "pop %C0\n" 16 | : "=&r" (ret) 17 | ); 18 | return ret; 19 | } 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /Firmware/backlight.h: -------------------------------------------------------------------------------- 1 | //backlight.h 2 | #ifndef _BACKLIGHT_H 3 | #define _BACKLIGHT_H 4 | 5 | #include 6 | 7 | enum Backlight_Mode 8 | { 9 | BACKLIGHT_MODE_DIM = 0, 10 | BACKLIGHT_MODE_BRIGHT = 1, 11 | BACKLIGHT_MODE_AUTO = 2, 12 | }; 13 | 14 | extern uint8_t backlightLevel_HIGH; 15 | extern uint8_t backlightLevel_LOW; 16 | extern uint8_t backlightMode; 17 | extern bool backlightSupport; 18 | extern int16_t backlightTimer_period; 19 | 20 | #define FORCE_BL_ON_START force_bl_on(true) 21 | #define FORCE_BL_ON_END force_bl_on(false) 22 | 23 | extern void force_bl_on(bool section_start); 24 | extern void backlight_update(); 25 | extern void backlight_init(); 26 | extern void backlight_save(); 27 | extern void backlight_wake(const uint8_t flashNo = 0); 28 | 29 | 30 | #endif //_BACKLIGHT_H 31 | -------------------------------------------------------------------------------- /Firmware/boards.h: -------------------------------------------------------------------------------- 1 | #ifndef BOARDS_H 2 | #define BOARDS_H 3 | 4 | #define BOARD_UNKNOWN -1 5 | 6 | #define BOARD_RAMBO_MINI_1_0 200 // Rambo-mini 1.0 - 200 (orig 102) 7 | #define BOARD_RAMBO_MINI_1_3 203 // Rambo-mini 1.3 - 203 (orig 302) 8 | 9 | #define BOARD_EINSY_1_0a 310 // EINSy 1.0a - 310 (new) 10 | 11 | #define MB(board) (MOTHERBOARD==BOARD_##board) 12 | #define IS_RAMPS (MB(RAMPS_OLD) || MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF)) 13 | 14 | #endif //__BOARDS_H 15 | -------------------------------------------------------------------------------- /Firmware/bootapp.c: -------------------------------------------------------------------------------- 1 | //bootapp.c 2 | #include "bootapp.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #include 9 | 10 | extern void softReset(); 11 | 12 | void bootapp_print_vars(void) 13 | { 14 | printf_P(PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr); 15 | printf_P(PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr); 16 | printf_P(PSTR("boot_copy_size =0x%04x\n"), boot_copy_size); 17 | printf_P(PSTR("boot_reserved =0x%02x\n"), boot_reserved); 18 | printf_P(PSTR("boot_app_flags =0x%02x\n"), boot_app_flags); 19 | printf_P(PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic); 20 | } 21 | 22 | 23 | void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size) 24 | { 25 | cli(); 26 | boot_app_magic = BOOT_APP_MAGIC; 27 | boot_app_flags |= BOOT_APP_FLG_COPY; 28 | boot_app_flags |= BOOT_APP_FLG_ERASE; 29 | boot_copy_size = (uint16_t)size; 30 | boot_src_addr = (uint32_t)rptr; 31 | boot_dst_addr = (uint32_t)fptr; 32 | bootapp_print_vars(); 33 | softReset(); 34 | } 35 | 36 | void bootapp_reboot_user0(uint8_t reserved) 37 | { 38 | cli(); 39 | boot_app_magic = BOOT_APP_MAGIC; 40 | boot_app_flags = BOOT_APP_FLG_USER0; 41 | boot_reserved = reserved; 42 | bootapp_print_vars(); 43 | softReset(); 44 | } 45 | -------------------------------------------------------------------------------- /Firmware/bootapp.h: -------------------------------------------------------------------------------- 1 | //language.h 2 | #ifndef BOOTAPP_H 3 | #define BOOTAPP_H 4 | 5 | #include "config.h" 6 | #include 7 | #include 8 | 9 | 10 | #define RAMSIZE (RAMEND+1-RAMSTART) 11 | #define boot_src_addr (*((uint32_t*)(RAMSIZE - 16))) 12 | #define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12))) 13 | #define boot_copy_size (*((uint16_t*)(RAMSIZE - 8))) 14 | #define boot_reserved (*((uint8_t*)(RAMSIZE - 6))) 15 | #define boot_app_flags (*((uint8_t*)(RAMSIZE - 5))) 16 | #define boot_app_magic (*((uint32_t*)(RAMSIZE - 4))) 17 | #define BOOT_APP_FLG_ERASE 0x01 18 | #define BOOT_APP_FLG_COPY 0x02 19 | #define BOOT_APP_FLG_FLASH 0x04 20 | #define BOOT_APP_FLG_RUN 0x08 21 | 22 | #define BOOT_APP_FLG_USER0 0x80 23 | 24 | #define BOOT_APP_MAGIC 0x55aa55aa 25 | 26 | 27 | #if defined(__cplusplus) 28 | extern "C" { 29 | #endif //defined(__cplusplus) 30 | 31 | extern void bootapp_print_vars(void); 32 | 33 | extern void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size); 34 | 35 | extern void bootapp_reboot_user0(uint8_t reserved); 36 | 37 | #if defined(__cplusplus) 38 | } 39 | #endif //defined(__cplusplus) 40 | 41 | #endif //BOOTAPP_H 42 | -------------------------------------------------------------------------------- /Firmware/fancheck.h: -------------------------------------------------------------------------------- 1 | // fan control and check 2 | #pragma once 3 | 4 | #include "Configuration.h" 5 | #include "config.h" 6 | 7 | #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1)) 8 | enum { 9 | EFCE_OK = 0, //!< normal operation, both fans are ok 10 | EFCE_FIXED, //!< previous fan error was fixed 11 | EFCE_REPORTED //!< fan error detected and reported to LCD and serial 12 | }; 13 | extern volatile uint8_t fan_check_error; 14 | 15 | void readFanTach(); 16 | #endif //(defined(TACH_0)) 17 | 18 | #if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) 19 | void setup_fan_interrupt(); 20 | #endif // (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) 21 | 22 | #ifdef EXTRUDER_ALTFAN_DETECT 23 | extern bool extruder_altfan_detect(); 24 | extern void altfanOverride_toggle(); 25 | extern bool altfanOverride_get(); 26 | #endif //EXTRUDER_ALTFAN_DETECT 27 | 28 | #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) 29 | #ifdef FAN_SOFT_PWM 30 | extern bool fan_measuring; 31 | #endif //FAN_SOFT_PWM 32 | 33 | extern unsigned long extruder_autofan_last_check; 34 | void setExtruderAutoFanState(uint8_t state); 35 | void checkExtruderAutoFans(); 36 | #endif 37 | 38 | void checkFans(); 39 | void resetFanCheck(); // resets the fan measuring state 40 | 41 | void hotendFanSetFullSpeed(); 42 | void hotendDefaultAutoFanState(); 43 | -------------------------------------------------------------------------------- /Firmware/first_lay_cal.h: -------------------------------------------------------------------------------- 1 | //! @file 2 | //! @date Jun 10, 2019 3 | //! @author Marek Bel 4 | 5 | #ifndef FIRMWARE_FIRST_LAY_CAL_H_ 6 | #define FIRMWARE_FIRST_LAY_CAL_H_ 7 | #include 8 | 9 | void lay1cal_wait_preheat(); 10 | [[nodiscard]] bool lay1cal_load_filament(uint8_t filament); 11 | void lay1cal_intro_line(bool skipExtraPurge, float layer_height, float extrusion_width); 12 | void lay1cal_before_meander(); 13 | void lay1cal_meander_start(float layer_height, float extrusion_width); 14 | void lay1cal_meander(float layer_height, float extrusion_width); 15 | void lay1cal_square(uint8_t step, float layer_height, float extrusion_width); 16 | void lay1cal_finish(bool mmu_enabled); 17 | 18 | #endif /* FIRMWARE_FIRST_LAY_CAL_H_ */ 19 | -------------------------------------------------------------------------------- /Firmware/le.sh: -------------------------------------------------------------------------------- 1 | # line ending management script 2 | # CRLF - windows default ('\r\n') 3 | # LF - unix default ('\n') 4 | # arguments: 5 | # ?crlf - print all .cpp and .h files with CRLF line endings 6 | # ?lf - print all .cpp and .h files with LF line endings 7 | # crlf - replace line endings in all .cpp and .h files to CRLF 8 | # lf - replace line endings in all .cpp and .h files to LF 9 | 10 | if [ "$1" == "?crlf" ] || [ $# -eq 0 ]; then 11 | echo 'cpp and h files with CRLF line endings:' 12 | find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g' 13 | elif [ "$1" == "?lf" ]; then 14 | echo 'cpp and h files with LF line endings:' 15 | find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g' 16 | fi 17 | if [ "$1" == "crlf" ]; then 18 | echo 'replacing LF with CRLF in all cpp and h files:' 19 | find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep -v CRLF | sed 's/:.*//g' | while read fn; do 20 | echo "$fn" 21 | sed -i 's/$/\r/g' $fn 22 | done 23 | elif [ "$1" == "lf" ]; then 24 | echo 'replacing CRLF with LF in all cpp and h files:' 25 | find {*.cpp,*.h} -not -type d -exec file "{}" ";" | grep CRLF | sed 's/:.*//g' | while read fn; do 26 | echo "$fn" 27 | sed -i 's/\r\n/\n/g' $fn 28 | done 29 | fi 30 | -------------------------------------------------------------------------------- /Firmware/mmu2/buttons.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // Helper macros to parse the operations from Btns() 5 | #define BUTTON_OP_RIGHT(X) ( ( X & 0xF0 ) >> 4 ) 6 | #define BUTTON_OP_MIDDLE(X) ( X & 0x0F ) 7 | 8 | namespace MMU2 { 9 | 10 | /// Will be mapped onto dialog button responses in the FW 11 | /// Those responses have their unique+translated texts as well 12 | enum class ButtonOperations : uint8_t { 13 | NoOperation = 0, 14 | Retry = 1, 15 | Continue = 2, 16 | ResetMMU = 3, 17 | Unload = 4, 18 | StopPrint = 5, 19 | DisableMMU = 6, 20 | }; 21 | 22 | /// Button codes + extended actions performed on the printer's side 23 | enum Buttons : uint8_t { 24 | Right = 0, 25 | Middle, 26 | Left, 27 | 28 | // performed on the printer's side 29 | ResetMMU, 30 | StopPrint, 31 | DisableMMU, 32 | 33 | NoButton = 0xff // shall be kept last 34 | }; 35 | 36 | 37 | } // namespace MMU2 38 | -------------------------------------------------------------------------------- /Firmware/mmu2_config.h: -------------------------------------------------------------------------------- 1 | /// @file 2 | #pragma once 3 | 4 | // Include the correct MMU2 config based on the printer variant. 5 | #include "Configuration_var.h" 6 | #include MMU_CONFIG_FILE 7 | -------------------------------------------------------------------------------- /Firmware/mmu2_crc.cpp: -------------------------------------------------------------------------------- 1 | /// @file 2 | #include "mmu2_crc.h" 3 | 4 | #ifdef __AVR__ 5 | #include 6 | #endif 7 | 8 | namespace modules { 9 | namespace crc { 10 | 11 | #ifdef __AVR__ 12 | uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) { 13 | return _crc8_ccitt_update(crc, b); 14 | } 15 | #else 16 | uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) { 17 | return CCITT_updateCX(crc, b); 18 | } 19 | #endif 20 | 21 | } // namespace crc 22 | } // namespace modules 23 | -------------------------------------------------------------------------------- /Firmware/mmu2_crc.h: -------------------------------------------------------------------------------- 1 | /// @file 2 | #pragma once 3 | #include 4 | 5 | namespace modules { 6 | 7 | /// Contains all the necessary functions for computation of CRC 8 | namespace crc { 9 | 10 | class CRC8 { 11 | public: 12 | /// Compute/update CRC8 CCIIT from 8bits. 13 | /// Details: https://www.nongnu.org/avr-libc/user-manual/group__util__crc.html 14 | static uint8_t CCITT_update(uint8_t crc, uint8_t b); 15 | 16 | static constexpr uint8_t CCITT_updateCX(uint8_t crc, uint8_t b) { 17 | uint8_t data = crc ^ b; 18 | for (uint8_t i = 0; i < 8; i++) { 19 | if ((data & 0x80U) != 0) { 20 | data <<= 1U; 21 | data ^= 0x07U; 22 | } else { 23 | data <<= 1U; 24 | } 25 | } 26 | return data; 27 | } 28 | 29 | /// Compute/update CRC8 CCIIT from 16bits (convenience wrapper) 30 | static constexpr uint8_t CCITT_updateW(uint8_t crc, uint16_t w) { 31 | union U { 32 | uint8_t b[2]; 33 | uint16_t w; 34 | explicit constexpr inline U(uint16_t w) 35 | : w(w) {} 36 | } u(w); 37 | return CCITT_updateCX(CCITT_updateCX(crc, u.b[0]), u.b[1]); 38 | } 39 | }; 40 | 41 | } // namespace crc 42 | 43 | } // namespace modules 44 | -------------------------------------------------------------------------------- /Firmware/mmu2_fsensor.cpp: -------------------------------------------------------------------------------- 1 | #include "mmu2_fsensor.h" 2 | #include "Filament_sensor.h" 3 | 4 | namespace MMU2 { 5 | 6 | FilamentState WhereIsFilament(){ 7 | return fsensor.getFilamentPresent() ? FilamentState::AT_FSENSOR : FilamentState::NOT_PRESENT; 8 | } 9 | 10 | } // namespace MMU2 11 | -------------------------------------------------------------------------------- /Firmware/mmu2_fsensor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Filament_sensor.h" 4 | 5 | namespace MMU2 { 6 | 7 | /// Possible states of filament from the perspective of presence in various parts of the printer 8 | /// Beware, the numeric codes are important and sent into the MMU 9 | enum class FilamentState : uint_fast8_t { 10 | NOT_PRESENT = 0, ///< filament sensor doesn't see the filament 11 | AT_FSENSOR = 1, ///< filament detected by the filament sensor, but the nozzle has not detected the filament yet 12 | IN_NOZZLE = 2, ///< filament detected by the filament sensor and also loaded in the nozzle 13 | UNAVAILABLE = 3 ///< sensor not available (likely not connected due broken cable) 14 | }; 15 | 16 | FilamentState WhereIsFilament(); 17 | 18 | } // namespace MMU2 19 | -------------------------------------------------------------------------------- /Firmware/mmu2_log.cpp: -------------------------------------------------------------------------------- 1 | #include "mmu2_log.h" 2 | 3 | namespace MMU2 { 4 | 5 | void LogErrorEvent_P(const char *msg){ 6 | SERIAL_ECHO_START; //!@todo Decide MMU errors on serial line 7 | SERIAL_MMU2(); 8 | SERIAL_ECHOLNRPGM(msg); 9 | } 10 | 11 | void LogEchoEvent_P(const char *msg){ 12 | SERIAL_ECHO_START; 13 | SERIAL_MMU2(); 14 | SERIAL_ECHOLNRPGM(msg); 15 | } 16 | 17 | } // namespace MMU2 18 | -------------------------------------------------------------------------------- /Firmware/mmu2_marlin_macros.h: -------------------------------------------------------------------------------- 1 | /// @file 2 | /// This file will not be the same on Marlin1 and Marlin2. 3 | /// Its purpose is to unify different macros in either of Marlin incarnations. 4 | #pragma once 5 | 6 | #ifdef __AVR__ 7 | #include "Marlin.h" 8 | // brings _O and _T macros into MMU 9 | #include "language.h" 10 | #define MARLIN_KEEPALIVE_STATE_IN_PROCESS KEEPALIVE_STATE(IN_PROCESS) 11 | #else 12 | #include "../../gcode/gcode.h" 13 | #define _O(x) x 14 | #define _T(x) x 15 | #define MARLIN_KEEPALIVE_STATE_IN_PROCESS KEEPALIVE_STATE(IN_PROCESS) 16 | #endif 17 | -------------------------------------------------------------------------------- /Firmware/mmu2_power.cpp: -------------------------------------------------------------------------------- 1 | #include "mmu2_power.h" 2 | #include "Configuration_var.h" 3 | #include "pins.h" 4 | #include "fastio.h" 5 | #include 6 | #include "mmu2.h" 7 | #include "eeprom.h" 8 | 9 | namespace MMU2 { 10 | 11 | // sadly, on MK3 we cannot do actual power cycle on HW... 12 | // so we just block the MMU via EEPROM var instead. 13 | void power_on() { 14 | #ifdef MMU_HWRESET 15 | WRITE(MMU_RST_PIN, 1); 16 | SET_OUTPUT(MMU_RST_PIN); // setup reset pin 17 | #endif //MMU_HWRESET 18 | 19 | eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true); 20 | 21 | reset(); 22 | } 23 | 24 | void power_off() { 25 | eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false); 26 | } 27 | 28 | void reset() { 29 | #ifdef MMU_HWRESET // HW - pulse reset pin 30 | WRITE(MMU_RST_PIN, 0); 31 | _delay_us(100); 32 | WRITE(MMU_RST_PIN, 1); 33 | #else 34 | mmu2.Reset(MMU2::Software); // @@TODO needs to be redesigned, this power implementation shall not know anything about the MMU itself 35 | #endif 36 | // otherwise HW reset is not available 37 | } 38 | 39 | } // namespace MMU2 40 | -------------------------------------------------------------------------------- /Firmware/mmu2_power.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace MMU2 { 4 | 5 | void power_on(); 6 | 7 | void power_off(); 8 | 9 | void reset(); 10 | 11 | } // namespace MMU2 12 | -------------------------------------------------------------------------------- /Firmware/mmu2_progress_converter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace MMU2 { 6 | 7 | const char * ProgressCodeToText(uint16_t pc); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Firmware/mmu2_serial.cpp: -------------------------------------------------------------------------------- 1 | #include "mmu2_serial.h" 2 | #include "uart2.h" 3 | 4 | namespace MMU2 { 5 | 6 | void MMU2Serial::begin(uint32_t baud){ 7 | uart2_init(baud); // @@TODO we may skip the baud rate setting in case of 8bit FW ... could save some bytes... 8 | } 9 | 10 | void MMU2Serial::close() { 11 | // @@TODO - probably turn off the UART 12 | } 13 | 14 | int MMU2Serial::read() { 15 | return fgetc(uart2io); 16 | } 17 | 18 | void MMU2Serial::flush() { 19 | // @@TODO - clear the output buffer 20 | } 21 | 22 | void MMU2Serial::write(const uint8_t *buffer, size_t size) { 23 | while(size--){ 24 | fputc(*buffer, uart2io); 25 | ++buffer; 26 | } 27 | } 28 | 29 | MMU2Serial mmu2Serial; 30 | 31 | } // namespace MMU2 32 | -------------------------------------------------------------------------------- /Firmware/mmu2_serial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace MMU2 { 6 | 7 | /// A minimal serial interface for the MMU 8 | class MMU2Serial { 9 | public: 10 | MMU2Serial() = default; 11 | void begin(uint32_t baud); 12 | void close(); 13 | int read(); 14 | void flush(); 15 | void write(const uint8_t *buffer, size_t size); 16 | }; 17 | 18 | extern MMU2Serial mmu2Serial; 19 | 20 | } // namespace MMU2 21 | -------------------------------------------------------------------------------- /Firmware/mmu2_state.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mmu_state.h 3 | * @brief status of mmu 4 | */ 5 | #pragma once 6 | #include 7 | namespace MMU2 { 8 | /// States of a printer with the MMU: 9 | /// - Active 10 | /// - Connecting 11 | /// - Stopped 12 | /// 13 | /// When the printer's FW starts, the MMU mode is either Stopped or NotResponding (based on user's preference). 14 | /// When the MMU successfully establishes communication, the state changes to Active. 15 | enum class xState : uint_fast8_t { 16 | Active, ///< MMU has been detected, connected, communicates and is ready to be worked with. 17 | Connecting, ///< MMU is connected but it doesn't communicate (yet). The user wants the MMU, but it is not ready to be worked with. 18 | Stopped ///< The user doesn't want the printer to work with the MMU. The MMU itself is not powered and does not work at all. 19 | }; 20 | 21 | } // namespace MMU2 22 | -------------------------------------------------------------------------------- /Firmware/mmu2_supported_version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace MMU2 { 5 | 6 | static constexpr uint8_t mmuVersionMajor = 3; 7 | static constexpr uint8_t mmuVersionMinor = 0; 8 | static constexpr uint8_t mmuVersionPatch = 0; 9 | 10 | } // namespace MMU2 11 | -------------------------------------------------------------------------------- /Firmware/optiboot_xflash.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTIBOOT_XFLASH_H 2 | #define OPTIBOOT_XFLASH_H 3 | 4 | extern uint8_t optiboot_xflash_enter(); 5 | 6 | #endif /* OPTIBOOT_XFLASH_H */ 7 | -------------------------------------------------------------------------------- /Firmware/pat9125.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | extern int16_t pat9125_x; 6 | extern int16_t pat9125_y; 7 | extern uint8_t pat9125_b; 8 | extern uint8_t pat9125_s; 9 | 10 | extern uint8_t pat9125_probe(void); // Return non-zero if PAT9125 can be trivially detected 11 | extern uint8_t pat9125_init(void); 12 | extern uint8_t pat9125_update(void); // update all sensor data 13 | extern uint8_t pat9125_update_y(void); // update _y only 14 | extern uint8_t pat9125_update_bs(void); // update _b/_s only 15 | -------------------------------------------------------------------------------- /Firmware/power_panic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum PowerPanicFlag : uint8_t { 4 | NO_PENDING_RECOVERY = 0, 5 | PENDING_RECOVERY = 1, // First power panic, print state is saved in EEPROM 6 | PENDING_RECOVERY_RETRY = 2, // Power outage occured during recovery, print is still saved in EEPROM 7 | }; 8 | 9 | void uvlo_(); 10 | void recover_print(uint8_t automatic); 11 | void setup_uvlo_interrupt(); 12 | -------------------------------------------------------------------------------- /Firmware/qr_solve.h: -------------------------------------------------------------------------------- 1 | #include "Configuration.h" 2 | 3 | #ifdef AUTO_BED_LEVELING_GRID 4 | 5 | void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); 6 | double ddot ( int n, double dx[], int incx, double dy[], int incy ); 7 | double dnrm2 ( int n, double x[], int incx ); 8 | void dqrank ( double a[], int lda, int m, int n, double tol, int *kr, 9 | int jpvt[], double qraux[] ); 10 | void dqrdc ( double a[], int lda, int n, int p, double qraux[], int jpvt[], 11 | double work[], int job ); 12 | int dqrls ( double a[], int lda, int m, int n, double tol, int *kr, double b[], 13 | double x[], double rsd[], int jpvt[], double qraux[], int itask ); 14 | void dqrlss ( double a[], int lda, int m, int n, int kr, double b[], double x[], 15 | double rsd[], int jpvt[], double qraux[] ); 16 | int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[], 17 | double qy[], double qty[], double b[], double rsd[], double ab[], int job ); 18 | void dscal ( int n, double sa, double x[], int incx ); 19 | void dswap ( int n, double x[], int incx, double y[], int incy ); 20 | double *qr_solve ( int m, int n, double a[], double b[] ); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Firmware/rbuf.h: -------------------------------------------------------------------------------- 1 | //rbuf.h 2 | #ifndef _RBUF_H 3 | #define _RBUF_H 4 | 5 | #include 6 | 7 | 8 | #define rbuf_l(ptr) (ptr[0]) 9 | #define rbuf_w(ptr) (ptr[1]) 10 | #define rbuf_r(ptr) (ptr[2]) 11 | #define rbuf_empty(ptr) (ptr[1] == ptr[2]) 12 | 13 | 14 | #if defined(__cplusplus) 15 | extern "C" { 16 | #endif //defined(__cplusplus) 17 | 18 | 19 | extern void rbuf_ini(uint8_t* ptr, uint8_t len); 20 | extern int rbuf_put(uint8_t* ptr, uint8_t val); 21 | extern int rbuf_get(uint8_t* ptr); 22 | 23 | 24 | #if defined(__cplusplus) 25 | } 26 | #endif //defined(__cplusplus) 27 | #endif //_RBUF_H -------------------------------------------------------------------------------- /Firmware/sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define e_SOUND_MODE_NULL 0xFF 5 | typedef enum : uint8_t { 6 | e_SOUND_MODE_LOUD, 7 | e_SOUND_MODE_ONCE, 8 | e_SOUND_MODE_SILENT, 9 | e_SOUND_MODE_BLIND 10 | } eSOUND_MODE; 11 | 12 | #define e_SOUND_MODE_DEFAULT e_SOUND_MODE_LOUD 13 | 14 | typedef enum : uint8_t { 15 | e_SOUND_TYPE_ButtonEcho, 16 | e_SOUND_TYPE_EncoderEcho, 17 | e_SOUND_TYPE_StandardPrompt, 18 | e_SOUND_TYPE_StandardConfirm, 19 | e_SOUND_TYPE_StandardWarning, 20 | e_SOUND_TYPE_StandardAlert, 21 | e_SOUND_TYPE_EncoderMove, 22 | e_SOUND_TYPE_BlindAlert 23 | } eSOUND_TYPE; 24 | 25 | typedef enum : uint8_t { 26 | e_SOUND_CLASS_Echo, 27 | e_SOUND_CLASS_Prompt, 28 | e_SOUND_CLASS_Confirm, 29 | e_SOUND_CLASS_Warning, 30 | e_SOUND_CLASS_Alert 31 | } eSOUND_CLASS; 32 | 33 | extern eSOUND_MODE eSoundMode; 34 | 35 | 36 | extern void Sound_Init(void); 37 | extern void Sound_CycleState(void); 38 | extern void Sound_MakeSound(eSOUND_TYPE eSoundType); 39 | extern void Sound_MakeCustom(uint16_t ms,uint16_t tone_ ,bool critical); 40 | void sound_wait_for_user(); 41 | void sound_wait_for_user_reset(); 42 | 43 | //static void Sound_DoSound_Echo(void); 44 | //static void Sound_DoSound_Prompt(void); 45 | -------------------------------------------------------------------------------- /Firmware/spi.c: -------------------------------------------------------------------------------- 1 | //spi.c - hardware SPI 2 | //#ifdef __SPI 3 | 4 | #include "spi.h" 5 | #include 6 | 7 | 8 | //#endif //__SPI 9 | -------------------------------------------------------------------------------- /Firmware/spi.h: -------------------------------------------------------------------------------- 1 | //spi.h - hardware SPI 2 | #ifndef SPI_H 3 | #define SPI_H 4 | 5 | #include 6 | #include 7 | #include "config.h" 8 | 9 | 10 | #define SPI_SPCR(rat, pha, pol, mst, dor) ((rat & 3) | (pha?(1< 6 | #include "config.h" 7 | 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif //defined(__cplusplus) 12 | 13 | //initialize 14 | extern void swi2c_init(void); 15 | 16 | //deinit pins 17 | extern void swi2c_disable(void); 18 | 19 | //check device address acknowledge 20 | extern uint8_t swi2c_check(uint8_t dev_addr); 21 | 22 | //read write functions - 8bit address (most i2c chips) 23 | #ifdef SWI2C_A8 24 | extern uint8_t swi2c_readByte_A8(uint8_t dev_addr, uint8_t addr, uint8_t* pbyte); 25 | extern uint8_t swi2c_writeByte_A8(uint8_t dev_addr, uint8_t addr, uint8_t* pbyte); 26 | #endif //SWI2C_A8 27 | 28 | //read write functions - 16bit address (e.g. serial eeprom AT24C256) 29 | #ifdef SWI2C_A16 30 | extern uint8_t swi2c_readByte_A16(uint8_t dev_addr, uint16_t addr, uint8_t* pbyte); 31 | extern uint8_t swi2c_writeByte_A16(uint8_t dev_addr, uint16_t addr, uint8_t* pbyte); 32 | #endif //SWI2C_A16 33 | 34 | #if defined(__cplusplus) 35 | } 36 | #endif //defined(__cplusplus) 37 | 38 | #endif //SWI2C_H 39 | -------------------------------------------------------------------------------- /Firmware/thermal_model/e3d_REVO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define THERMAL_MODEL_E3D_REVO_VER 1 // model parameters version 4 | 5 | #define THERMAL_MODEL_E3D_REVO_P 40. // heater power (W) 6 | #define THERMAL_MODEL_E3D_REVO_U -0.0014 // linear temperature coefficient (W/K/power) 7 | #define THERMAL_MODEL_E3D_REVO_V 1.05 // linear temperature intercept (W/power) 8 | 9 | #define THERMAL_MODEL_E3D_REVO_C 8.77 // initial guess for heatblock capacitance (J/K) 10 | #define THERMAL_MODEL_E3D_REVO_R 25.3 // initial guess for heatblock resistance (K/W) 11 | 12 | #define THERMAL_MODEL_E3D_REVO_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) 13 | #define THERMAL_MODEL_E3D_REVO_LAG 270 // sim. response lag (ms, 0-2160) 14 | 15 | #define THERMAL_MODEL_E3D_REVO_W 0.85 // Default warning threshold (K/s) 16 | #define THERMAL_MODEL_E3D_REVO_E 1.23 // Default error threshold (K/s) 17 | 18 | // fall-back resistance vector (R0-15) 19 | #define THERMAL_MODEL_E3D_REVO_Rv {THERMAL_MODEL_E3D_REVO_R, 23.9, 22.5, 19.6, 19.0, 18.3, 17.7, 17.1, 16.8, 16.5, 16.3, 16.0, 15.9, 15.7, 15.6, 15.4} 20 | -------------------------------------------------------------------------------- /Firmware/thermal_model/e3d_REVO_HF_60W.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define THERMAL_MODEL_E3D_REVO_HF_60W_VER 1 // model parameters version 4 | 5 | #define THERMAL_MODEL_E3D_REVO_HF_60W_P 60. // heater power (W) 6 | #define THERMAL_MODEL_E3D_REVO_HF_60W_U -0.0014 // linear temperature coefficient (W/K/power) 7 | #define THERMAL_MODEL_E3D_REVO_HF_60W_V 1.05 // linear temperature intercept (W/power) 8 | 9 | #define THERMAL_MODEL_E3D_REVO_HF_60W_C 9.10 // initial guess for heatblock capacitance (J/K) 10 | #define THERMAL_MODEL_E3D_REVO_HF_60W_R 30.6 // initial guess for heatblock resistance (K/W) 11 | 12 | #define THERMAL_MODEL_E3D_REVO_HF_60W_fS 0.15 // sim. 1st order IIR filter factor (f=100/27) 13 | #define THERMAL_MODEL_E3D_REVO_HF_60W_LAG 270 // sim. response lag (ms, 0-2160) 14 | 15 | #define THERMAL_MODEL_E3D_REVO_HF_60W_W 0.85 // Default warning threshold (K/s) 16 | #define THERMAL_MODEL_E3D_REVO_HF_60W_E 1.23 // Default error threshold (K/s) 17 | 18 | // fall-back resistance vector (R0-15) 19 | #define THERMAL_MODEL_E3D_REVO_HF_60W_Rv {THERMAL_MODEL_E3D_REVO_HF_60W_R, 29.0, 27.5, 24.5, 23.4, 22.3, 21.2, 20.2, 19.8, 19.4, 19.0, 18.6, 18.3, 18.1, 17.9, 17.7} 20 | -------------------------------------------------------------------------------- /Firmware/thermal_model/e3d_v6.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define THERMAL_MODEL_E3D_V6_VER 1 // model parameters version 4 | 5 | #define THERMAL_MODEL_E3D_V6_P 38. // heater power (W) 6 | #define THERMAL_MODEL_E3D_V6_U 0. // linear temperature coefficient (W/K/power) 7 | #define THERMAL_MODEL_E3D_V6_V 1. // linear temperature intercept (W/power) 8 | 9 | #define THERMAL_MODEL_E3D_V6_C 12.1 // initial guess for heatblock capacitance (J/K) 10 | #define THERMAL_MODEL_E3D_V6_R 20.5 // initial guess for heatblock resistance (K/W) 11 | 12 | #define THERMAL_MODEL_E3D_V6_fS 0.065 // sim. 1st order IIR filter factor (f=100/27) 13 | #define THERMAL_MODEL_E3D_V6_LAG 2100 // sim. response lag (ms, 0-2160) 14 | 15 | #define THERMAL_MODEL_E3D_V6_W 1.2 // Default warning threshold (K/s) 16 | #define THERMAL_MODEL_E3D_V6_E 1.74 // Default error threshold (K/s) 17 | 18 | // fall-back resistance vector (R0-15) 19 | #define THERMAL_MODEL_E3D_V6_Rv {THERMAL_MODEL_E3D_V6_R, 18.4, 16.7, 15.2, 14.1, 13.3, 12.7, 12.1, 11.7, 11.3, 11., 10.8, 10.6, 10.4, 10.2, 10.1} 20 | -------------------------------------------------------------------------------- /Firmware/timer02.h: -------------------------------------------------------------------------------- 1 | //timer02.h 2 | // use atmega timer2 as main system timer instead of timer0 3 | // timer0 is used for fast pwm (OC0B output) 4 | // original OVF handler is disabled 5 | #ifndef TIMER02_H 6 | #define TIMER02_H 7 | 8 | #include 9 | 10 | #if defined(__cplusplus) 11 | extern "C" { 12 | #endif //defined(__cplusplus) 13 | 14 | ///! Initializes TIMER0 for fast PWM mode-driven bed heating 15 | extern void timer0_init(void); 16 | 17 | ///! Initializes TIMER2 for time keeping and temperature interrupt 18 | extern void timer2_init(void); 19 | 20 | ///! Reimplemented original millis() using timer2 21 | extern unsigned long millis2(void); 22 | 23 | ///! Reimplemented original micros() using timer2 24 | extern unsigned long micros2(void); 25 | 26 | ///! Reimplemented original delay() using timer2 27 | extern void delay2(unsigned long ms); 28 | 29 | #if defined(__cplusplus) 30 | } 31 | #endif //defined(__cplusplus) 32 | 33 | #endif //TIMER02_H 34 | -------------------------------------------------------------------------------- /Firmware/tone04.h: -------------------------------------------------------------------------------- 1 | //tone04.h 2 | // use atmega timer4 as main tone timer instead of timer2 3 | // timer2 is used for System timer. 4 | #ifndef TIMER04_H 5 | #define TIMER04_H 6 | 7 | #include 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif //defined(__cplusplus) 12 | 13 | extern void timer4_init(void); 14 | 15 | extern void timer4_set_fan0(uint8_t duty); 16 | 17 | extern void tone4(uint8_t _pin, uint16_t frequency); 18 | 19 | extern void noTone4(uint8_t _pin); 20 | 21 | #if defined(__cplusplus) 22 | } 23 | #endif //defined(__cplusplus) 24 | 25 | #endif //TIMER02_H 26 | -------------------------------------------------------------------------------- /Firmware/uart2.h: -------------------------------------------------------------------------------- 1 | //uart2.h 2 | #ifndef _UART2_H 3 | #define _UART2_H 4 | 5 | #include 6 | #include 7 | 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif //defined(__cplusplus) 12 | 13 | 14 | extern FILE _uart2io; 15 | #define uart2io (&_uart2io) 16 | 17 | 18 | extern void uart2_init(uint32_t baudRate); 19 | 20 | extern int8_t uart2_rx_str_P(const char* str); 21 | 22 | 23 | #if defined(__cplusplus) 24 | } 25 | #endif //defined(__cplusplus) 26 | #endif //_UART2_H 27 | -------------------------------------------------------------------------------- /Firmware/xflash_dump.h: -------------------------------------------------------------------------------- 1 | // XFLASH dumper 2 | #pragma once 3 | #include "xflash_layout.h" 4 | 5 | enum class dump_crash_reason : uint8_t 6 | { 7 | manual = 0, 8 | stack_error, 9 | watchdog, 10 | bad_isr, 11 | bad_pullup_temp_isr, 12 | bad_pullup_step_isr, 13 | }; 14 | 15 | #ifdef XFLASH_DUMP 16 | void xfdump_reset(); // reset XFLASH dump state 17 | void xfdump_dump(); // create a new SRAM memory dump 18 | 19 | // return true if a dump is present, save type in "reason" if provided 20 | bool xfdump_check_state(dump_crash_reason* reason = NULL); 21 | 22 | // create a new dump containing registers and SRAM, then reset 23 | void xfdump_full_dump_and_reset(dump_crash_reason crash = dump_crash_reason::manual); 24 | #endif 25 | -------------------------------------------------------------------------------- /Firmware/xyzcal.h: -------------------------------------------------------------------------------- 1 | //xyzcal.h - xyz calibration with image processing 2 | #pragma once 3 | 4 | #include 5 | 6 | #include "mesh_bed_calibration.h" 7 | 8 | extern void xyzcal_measure_enter(void); 9 | extern void xyzcal_measure_leave(void); 10 | 11 | extern bool xyzcal_lineXYZ_to(int16_t x, int16_t y, int16_t z, uint16_t delay_us, int8_t check_pinda); 12 | 13 | extern bool xyzcal_spiral2(int16_t cx, int16_t cy, int16_t z0, int16_t dz, int16_t radius, int16_t rotation, uint16_t delay_us, int8_t check_pinda, uint16_t* pad); 14 | 15 | extern bool xyzcal_spiral8(int16_t cx, int16_t cy, int16_t z0, int16_t dz, int16_t radius, uint16_t delay_us, int8_t check_pinda, uint16_t* pad); 16 | 17 | //extern int8_t xyzcal_measure_pinda_hysteresis(int16_t min_z, int16_t max_z, uint16_t delay_us, uint8_t samples); 18 | 19 | extern BedSkewOffsetDetectionResultType xyzcal_find_bed_induction_sensor_point_xy(); 20 | -------------------------------------------------------------------------------- /cmake/AvrGcc.cmake: -------------------------------------------------------------------------------- 1 | get_filename_component(PROJECT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) 2 | include("${PROJECT_CMAKE_DIR}/Utilities.cmake") 3 | get_dependency_directory("avr-gcc" AVR_TOOLCHAIN_DIR) 4 | include("${PROJECT_CMAKE_DIR}/AnyAvrGcc.cmake") 5 | -------------------------------------------------------------------------------- /cmake/Check_final_lang_bin_size.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | FILE(SIZE ${LANG_FILE} FILE_SIZE) 3 | get_filename_component(FILE_BASE ${LANG_FILE} NAME) 4 | MATH(EXPR PADDED_SIZE "((${FILE_SIZE}+4096-1) / 4096 * 4096 )") 5 | message(STATUS "${FILE_BASE} raw size ${FILE_SIZE} bytes (${PADDED_SIZE} b padded)") 6 | if(${PADDED_SIZE} GREATER ${LANG_MAX_SIZE}) 7 | message(FATAL_ERROR "Language file ${FILE_BASE} (${PADDED_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!") 8 | else() 9 | MATH(EXPR SIZE_PCT "( ${PADDED_SIZE} * 100) / ${LANG_MAX_SIZE} " ) 10 | message(STATUS "Language file ${FILE_BASE} is ${PADDED_SIZE} bytes, ${SIZE_PCT}% of allowed space - OK") 11 | endif() 12 | -------------------------------------------------------------------------------- /cmake/Check_lang_size.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | FILE(SIZE ${LANG_FILE} FILE_SIZE) 3 | get_filename_component(FILE_BASE ${LANG_FILE} NAME) 4 | MATH(EXPR PADDED_SIZE "((${FILE_SIZE}+256-1) / 256 * 256 )") 5 | MATH(EXPR FREE_SPACE "(${LANG_MAX_SIZE}-${FILE_SIZE})") 6 | if(${PADDED_SIZE} GREATER ${LANG_MAX_SIZE}) 7 | message(FATAL_ERROR "Language file ${FILE_BASE} (${PADDED_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!") 8 | else() 9 | MATH(EXPR SIZE_PCT "( ${PADDED_SIZE} * 100) / ${LANG_MAX_SIZE} " ) 10 | message(STATUS "Language file ${FILE_BASE} is ${PADDED_SIZE} (${FILE_SIZE}) bytes, ${SIZE_PCT}% of allowed space. Free bytes ${FREE_SPACE} - OK") 11 | endif() 12 | -------------------------------------------------------------------------------- /lang/fw-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Config 5 | if [ -z "$CONFIG_OK" ]; then source config.sh; fi 6 | if [ -z "$CONFIG_OK" -o "$CONFIG_OK" -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr0)" >&2; exit 1; fi 7 | 8 | # Clean the temporary directory 9 | TMPDIR=$(dirname "$0")/tmp 10 | rm -rf "$TMPDIR" 11 | 12 | # Remove internationalized firmware files 13 | rm -f "${INTLHEX}"*.hex 14 | -------------------------------------------------------------------------------- /lang/iso639-1.txt: -------------------------------------------------------------------------------- 1 | #language codes ISO639-1 2 | # iso english localized 3 | #----------------------- 4 | # en English English 5 | # de German Deutsch 6 | # cs Czech Cestina 7 | # es Spanish Espanol 8 | # fr French Francais 9 | # it Italian Italiano 10 | # pl Polish Polski 11 | -------------------------------------------------------------------------------- /lang/lang-patchsec.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import elftools.elf.elffile 4 | 5 | from lib.io import fatal 6 | 7 | 8 | def main(): 9 | ap = argparse.ArgumentParser() 10 | ap.add_argument('elf', help='Firmware ELF file') 11 | ap.add_argument('cat', help='Binary language catalog file') 12 | ap.add_argument('bin', help='Firmware BIN file') 13 | args = ap.parse_args() 14 | 15 | # get the language table position 16 | elf = elftools.elf.elffile.ELFFile(open(args.elf, "rb")) 17 | symtab = elf.get_section_by_name('.symtab') 18 | lang_table_sym = symtab.get_symbol_by_name('_SEC_LANG')[0] 19 | lang_table_start = lang_table_sym.entry.st_value 20 | lang_table_size = lang_table_sym.entry.st_size 21 | 22 | # read the binary catalog 23 | cat = open(args.cat, "rb").read() 24 | if len(cat) > lang_table_size: 25 | fatal("language catalog too large") 26 | 27 | # patch the symbol 28 | with open(args.bin, "r+b") as fw: 29 | fw.seek(lang_table_start) 30 | fw.write(cat) 31 | 32 | return 0 33 | 34 | if __name__ == '__main__': 35 | exit(main()) 36 | -------------------------------------------------------------------------------- /lang/lib/io.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import ast 4 | 5 | def info(msg): 6 | print(os.path.basename(sys.argv[0]) + ": " + msg) 7 | 8 | def warn(msg): 9 | print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) 10 | 11 | def fatal(msg): 12 | warn(msg) 13 | exit(1) 14 | 15 | 16 | def load_map(path): 17 | fd = open(path, "r") 18 | 19 | # check the header 20 | if fd.readline() != 'OFFSET\tSIZE\tNAME\tID\tSTRING\n': 21 | fatal("invalid map file") 22 | 23 | # parse symbols 24 | syms = [] 25 | for line in fd: 26 | line = line.rstrip('\n') 27 | offset, size, name, tr_id, data = line.split('\t', 4) 28 | data = ast.literal_eval(data) 29 | tr_id = int(tr_id) if len(tr_id) else None 30 | syms.append({'offset': int(offset, 16), 31 | 'size': int(size, 16), 32 | 'id': tr_id, 33 | 'name': name, 34 | 'data': data}) 35 | return syms 36 | -------------------------------------------------------------------------------- /lang/requirements.txt: -------------------------------------------------------------------------------- 1 | polib==1.1.1 2 | pyelftools==0.29 3 | regex==2022.9.13 4 | -------------------------------------------------------------------------------- /lang/update-po.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | FILES=$@ 3 | [ -z "$FILES" ] && FILES=po/*.po 4 | 5 | for file in $FILES; do 6 | # convert the po file to unix to avoid garbage with msgmerge 7 | dos2unix "$file" 8 | 9 | # merge from the template 10 | msgmerge -U -s -N --suffix=".bak" "$file" po/Firmware.pot 11 | 12 | # ... and back 13 | unix2dos "$file" 14 | done 15 | -------------------------------------------------------------------------------- /lang/update-pot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Extract language data in the po subdir to keep the relative paths intact 3 | cp -f po/Firmware.pot po/Firmware.pot.bak 4 | cd po && ../lang-extract.py --no-missing -s -o Firmware.pot ../../Firmware/[a-zA-Z]*.[ch]* ../../Firmware/mmu2/[a-zA-Z]*.[ch]* 5 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT CMAKE_CROSSCOMPILING) 2 | add_subdirectory(Catch2) 3 | endif() 4 | -------------------------------------------------------------------------------- /lib/Catch2/.bazelrc: -------------------------------------------------------------------------------- 1 | build --enable_platform_specific_config 2 | 3 | build:gcc9 --cxxopt=-std=c++2a 4 | build:gcc11 --cxxopt=-std=c++2a 5 | build:clang13 --cxxopt=-std=c++17 6 | build:vs2019 --cxxopt=/std:c++17 7 | build:vs2022 --cxxopt=/std:c++17 8 | 9 | build:windows --config=vs2022 10 | build:linux --config=gcc11 11 | -------------------------------------------------------------------------------- /lib/Catch2/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AccessModifierOffset: '-4' 3 | AlignEscapedNewlines: Left 4 | AllowAllConstructorInitializersOnNextLine: 'true' 5 | BinPackArguments: 'false' 6 | BinPackParameters: 'false' 7 | BreakConstructorInitializers: AfterColon 8 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' 9 | DerivePointerAlignment: 'false' 10 | FixNamespaceComments: 'true' 11 | IncludeBlocks: Regroup 12 | IndentCaseLabels: 'false' 13 | IndentPPDirectives: AfterHash 14 | IndentWidth: '4' 15 | Language: Cpp 16 | NamespaceIndentation: All 17 | PointerAlignment: Left 18 | SpaceBeforeCtorInitializerColon: 'false' 19 | SpaceInEmptyParentheses: 'false' 20 | SpacesInParentheses: 'true' 21 | Standard: Cpp11 22 | TabWidth: '4' 23 | UseTab: Never 24 | 25 | ... 26 | -------------------------------------------------------------------------------- /lib/Catch2/.conan/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2.0) 2 | project(test_package CXX) 3 | 4 | include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") 5 | conan_basic_setup() 6 | 7 | find_package(Catch2 REQUIRED CONFIG) 8 | 9 | add_executable(${PROJECT_NAME} test_package.cpp) 10 | 11 | target_link_libraries(${PROJECT_NAME} Catch2::Catch2WithMain) 12 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) 13 | -------------------------------------------------------------------------------- /lib/Catch2/.conan/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | from conans import ConanFile, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "compiler", "build_type", "arch" 9 | generators = "cmake_find_package_multi", "cmake" 10 | 11 | def build(self): 12 | cmake = CMake(self) 13 | cmake.configure() 14 | cmake.build() 15 | 16 | def test(self): 17 | assert os.path.isfile(os.path.join( 18 | self.deps_cpp_info["catch2"].rootpath, "licenses", "LICENSE.txt")) 19 | bin_path = os.path.join("bin", "test_package") 20 | self.run("%s -s" % bin_path, run_environment=True) 21 | -------------------------------------------------------------------------------- /lib/Catch2/.conan/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Factorial( int number ) { 4 | return number <= 1 ? 1 : Factorial( number - 1 ) * number; 5 | } 6 | 7 | TEST_CASE( "Factorial Tests", "[single-file]" ) { 8 | REQUIRE( Factorial(0) == 1 ); 9 | REQUIRE( Factorial(1) == 1 ); 10 | REQUIRE( Factorial(2) == 2 ); 11 | REQUIRE( Factorial(3) == 6 ); 12 | REQUIRE( Factorial(10) == 3628800 ); 13 | } -------------------------------------------------------------------------------- /lib/Catch2/.gitattributes: -------------------------------------------------------------------------------- 1 | # This sets the default behaviour, overriding core.autocrlf 2 | * text=auto 3 | 4 | # All source files should have unix line-endings in the repository, 5 | # but convert to native line-endings on checkout 6 | *.cpp text 7 | *.h text 8 | *.hpp text 9 | 10 | # Windows specific files should retain windows line-endings 11 | *.sln text eol=crlf 12 | 13 | # Keep executable scripts with LFs so they can be run after being 14 | # checked out on Windows 15 | *.py text eol=lf 16 | 17 | 18 | # Keep the single include header with LFs to make sure it is uploaded, 19 | # hashed etc with LF 20 | single_include/**/*.hpp eol=lf 21 | # Also keep the LICENCE file with LFs for the same reason 22 | LICENCE.txt eol=lf 23 | -------------------------------------------------------------------------------- /lib/Catch2/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: "horenmar" 2 | custom: "https://www.paypal.me/horenmar" 3 | -------------------------------------------------------------------------------- /lib/Catch2/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create an issue that documents a bug 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Expected behavior** 14 | A clear and concise description of what you expected to happen. 15 | 16 | **Reproduction steps** 17 | Steps to reproduce the bug. 18 | 19 | 20 | 21 | **Platform information:** 22 | 23 | - OS: **Windows NT** 24 | - Compiler+version: **GCC v2.9.5** 25 | - Catch version: **v1.2.3** 26 | 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /lib/Catch2/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Create an issue that requests a feature or other improvement 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Description** 11 | Describe the feature/change you request and why do you want it. 12 | 13 | **Additional context** 14 | Add any other context or screenshots about the feature request here. 15 | -------------------------------------------------------------------------------- /lib/Catch2/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ## Description 12 | 18 | 19 | ## GitHub Issues 20 | 29 | -------------------------------------------------------------------------------- /lib/Catch2/.github/workflows/validate-header-guards.yml: -------------------------------------------------------------------------------- 1 | name: Check header guards 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | # Set the type of machine to run on 8 | runs-on: ubuntu-20.04 9 | steps: 10 | 11 | - name: Checkout source code 12 | uses: actions/checkout@v2 13 | 14 | - name: Setup Dependencies 15 | uses: actions/setup-python@v2 16 | with: 17 | python-version: '3.7' 18 | - name: Install checkguard 19 | run: pip install guardonce 20 | 21 | - name: Check that include guards are properly named 22 | run: | 23 | wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper") 24 | if [[ $wrong_files ]]; then 25 | echo "Files with wrong header guard:" 26 | echo $wrong_files 27 | exit 1 28 | fi 29 | 30 | - name: Check that there are no duplicated filenames 31 | run: | 32 | ./tools/scripts/checkDuplicateFilenames.py 33 | 34 | - name: Check that all source files have the correct license header 35 | run: | 36 | ./tools/scripts/checkLicense.py 37 | -------------------------------------------------------------------------------- /lib/Catch2/.gitignore: -------------------------------------------------------------------------------- 1 | *.build 2 | !meson.build 3 | *.pbxuser 4 | *.mode1v3 5 | *.ncb 6 | *.suo 7 | Debug 8 | Release 9 | *.user 10 | *.xcuserstate 11 | .DS_Store 12 | xcuserdata 13 | CatchSelfTest.xcscheme 14 | Breakpoints.xcbkptlist 15 | UpgradeLog.XML 16 | Resources/DWARF 17 | projects/Generated 18 | *.pyc 19 | DerivedData 20 | *.xccheckout 21 | Build 22 | .idea 23 | .vs 24 | .vscode 25 | cmake-build-* 26 | benchmark-dir 27 | .conan/test_package/build 28 | bazel-* 29 | build-fuzzers 30 | debug-build 31 | .vscode 32 | msvc-sln* 33 | # Currently we use Doxygen for dep graphs and the full docs are only slowly 34 | # being filled in, so we definitely do not want git to deal with the docs. 35 | docs/doxygen 36 | *.cache 37 | compile_commands.json 38 | -------------------------------------------------------------------------------- /lib/Catch2/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/catchorg/Catch2 8 | branch = devel 9 | commit = 5df88da16e276f853cc0c45f4b570419be77dd43 10 | parent = edc5d013ddca9613e29f70d87d7b68f64919eda9 11 | method = merge 12 | cmdver = 0.4.5 13 | -------------------------------------------------------------------------------- /lib/Catch2/CMake/Catch2Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | 4 | # Avoid repeatedly including the targets 5 | if(NOT TARGET Catch2::Catch2) 6 | # Provide path for scripts 7 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake) 10 | endif() 11 | -------------------------------------------------------------------------------- /lib/Catch2/CMake/catch2-with-main.pc.in: -------------------------------------------------------------------------------- 1 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 2 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 3 | pkg_version=@Catch2_VERSION@ 4 | 5 | Name: Catch2-With-Main 6 | Description: A modern, C++-native test framework for C++14 and above (links in default main) 7 | Version: ${pkg_version} 8 | Requires: catch2 = ${pkg_version} 9 | Cflags: -I${includedir} 10 | Libs: -L${libdir} -lCatch2Main 11 | -------------------------------------------------------------------------------- /lib/Catch2/CMake/catch2.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: Catch2 7 | Description: A modern, C++-native, test framework for C++14 and above 8 | URL: https://github.com/catchorg/Catch2 9 | Version: @Catch2_VERSION@ 10 | Cflags: -I${includedir} 11 | Libs: -L${libdir} -lCatch2 12 | -------------------------------------------------------------------------------- /lib/Catch2/CMake/llvm-cov-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of CMake-codecov. 4 | # 5 | # Copyright (c) 6 | # 2015-2017 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # See the LICENSE file in the package base directory for details 9 | # 10 | # Written by Alexander Haase, alexander.haase@rwth-aachen.de 11 | # 12 | 13 | if [ -z "$LLVM_COV_BIN" ] 14 | then 15 | echo "LLVM_COV_BIN not set!" >& 2 16 | exit 1 17 | fi 18 | 19 | 20 | # Get LLVM version to find out. 21 | LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ 22 | | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") 23 | 24 | if [ "$1" = "-v" ] 25 | then 26 | echo "llvm-cov-wrapper $LLVM_VERSION" 27 | exit 0 28 | fi 29 | 30 | 31 | if [ -n "$LLVM_VERSION" ] 32 | then 33 | MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1) 34 | MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2) 35 | 36 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ] 37 | then 38 | if [ -f "$1" ] 39 | then 40 | filename=$(basename "$1") 41 | extension="${filename##*.}" 42 | 43 | case "$extension" in 44 | "gcno") exec $LLVM_COV_BIN --gcno="$1" ;; 45 | "gcda") exec $LLVM_COV_BIN --gcda="$1" ;; 46 | esac 47 | fi 48 | fi 49 | 50 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ] 51 | then 52 | exec $LLVM_COV_BIN $@ 53 | fi 54 | fi 55 | 56 | exec $LLVM_COV_BIN gcov $@ 57 | -------------------------------------------------------------------------------- /lib/Catch2/CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "configurePresets": [ 4 | { 5 | "name": "basic-tests", 6 | "displayName": "Basic development build", 7 | "description": "Enables development build with basic tests that are cheap to build and run", 8 | "cacheVariables": { 9 | "CATCH_DEVELOPMENT_BUILD": "ON" 10 | } 11 | }, 12 | { 13 | "name": "all-tests", 14 | "inherits": "basic-tests", 15 | "displayName": "Full development build", 16 | "description": "Enables development build with examples and ALL tests", 17 | "cacheVariables": { 18 | "CATCH_BUILD_EXAMPLES": "ON", 19 | "CATCH_BUILD_EXTRA_TESTS": "ON", 20 | "CATCH_BUILD_SURROGATES": "ON", 21 | "CATCH_ENABLE_CONFIGURE_TESTS": "ON" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /lib/Catch2/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | * Versions 1.x (branch Catch1.x) are no longer supported. 6 | * Versions 2.x (branch v2.x) are currently supported. 7 | * `devel` branch serves for stable-ish development and is supported, 8 | but branches `devel-*` are considered short lived and are not supported separately. 9 | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | Due to its nature as a _unit_ test framework, Catch2 shouldn't interact 14 | with untrusted inputs and there shouldn't be many security vulnerabilities 15 | in it. 16 | 17 | However, if you find one you send email to martin horenovsky 18 | gmail com. If you want to encrypt the email, my pgp key is 19 | `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`. 20 | -------------------------------------------------------------------------------- /lib/Catch2/WORKSPACE.bazel: -------------------------------------------------------------------------------- 1 | workspace(name = "catch2") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | http_archive( 6 | name = "bazel_skylib", 7 | urls = [ 8 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", 9 | "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", 10 | ], 11 | sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", 12 | ) 13 | 14 | load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 15 | bazel_skylib_workspace() 16 | -------------------------------------------------------------------------------- /lib/Catch2/codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: nearest 4 | range: "60...90" 5 | status: 6 | project: 7 | default: 8 | threshold: 2% 9 | patch: 10 | default: 11 | target: 80% 12 | ignore: 13 | - "**/external/clara.hpp" 14 | - "tests" 15 | 16 | 17 | codecov: 18 | branch: devel 19 | max_report_age: off 20 | 21 | comment: 22 | layout: "diff" 23 | -------------------------------------------------------------------------------- /lib/Catch2/data/artwork/catch2-c-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wavexx/Prusa-Firmware/cf0116ea7465f949661a09f9734ad3adc5fcc75f/lib/Catch2/data/artwork/catch2-c-logo.png -------------------------------------------------------------------------------- /lib/Catch2/data/artwork/catch2-hand-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wavexx/Prusa-Firmware/cf0116ea7465f949661a09f9734ad3adc5fcc75f/lib/Catch2/data/artwork/catch2-hand-logo.png -------------------------------------------------------------------------------- /lib/Catch2/data/artwork/catch2-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wavexx/Prusa-Firmware/cf0116ea7465f949661a09f9734ad3adc5fcc75f/lib/Catch2/data/artwork/catch2-logo-small.png -------------------------------------------------------------------------------- /lib/Catch2/docs/commercial-users.md: -------------------------------------------------------------------------------- 1 | 2 | # Commercial users of Catch2 3 | 4 | Catch2 is also widely used in proprietary code bases. This page contains 5 | some of them that are willing to share this information. 6 | 7 | If you want to add your organisation, please check that there is no issue 8 | with you sharing this fact. 9 | 10 | - Bloomberg 11 | - [Bloomlife](https://bloomlife.com) 12 | - [Inscopix Inc.](https://www.inscopix.com/) 13 | - Locksley.CZ 14 | - [Makimo](https://makimo.pl/) 15 | - NASA 16 | - [Nexus Software Systems](https://nexwebsites.com) 17 | - [UX3D](https://ux3d.io) 18 | - [King](https://king.com) 19 | 20 | 21 | --- 22 | 23 | [Home](Readme.md#top) 24 | -------------------------------------------------------------------------------- /lib/Catch2/examples/020-TestCase-1.cpp: -------------------------------------------------------------------------------- 1 | // 020-TestCase-1.cpp 2 | 3 | #include 4 | 5 | TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) { 6 | } 7 | 8 | // ^^^ 9 | // Normally no TEST_CASEs in this file. 10 | // Here just to show there are two source files via option --list-tests. 11 | 12 | // Compile & run: 13 | // - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp 14 | // - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success 15 | // 16 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp 17 | // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success 18 | 19 | // Expected test case listing: 20 | // 21 | // prompt> 020-TestCase --list-tests * 22 | // Matching test cases: 23 | // 1: All test cases reside in other .cpp files (empty) 24 | // [multi-file:1] 25 | // 2: Factorial of 0 is computed (fail) 26 | // [multi-file:2] 27 | // 2: Factorials of 1 and higher are computed (pass) 28 | // [multi-file:2] 29 | // 3 matching test cases 30 | -------------------------------------------------------------------------------- /lib/Catch2/examples/020-TestCase-2.cpp: -------------------------------------------------------------------------------- 1 | // 020-TestCase-2.cpp 2 | 3 | // main() provided by Catch in file 020-TestCase-1.cpp. 4 | 5 | #include 6 | 7 | static int Factorial( int number ) { 8 | return number <= 1 ? number : Factorial( number - 1 ) * number; // fail 9 | // return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass 10 | } 11 | 12 | TEST_CASE( "2: Factorial of 0 is 1 (fail)", "[multi-file:2]" ) { 13 | REQUIRE( Factorial(0) == 1 ); 14 | } 15 | 16 | TEST_CASE( "2: Factorials of 1 and higher are computed (pass)", "[multi-file:2]" ) { 17 | REQUIRE( Factorial(1) == 1 ); 18 | REQUIRE( Factorial(2) == 2 ); 19 | REQUIRE( Factorial(3) == 6 ); 20 | REQUIRE( Factorial(10) == 3628800 ); 21 | } 22 | 23 | // Compile: see 020-TestCase-1.cpp 24 | 25 | // Expected compact output (all assertions): 26 | // 27 | // prompt> 020-TestCase --reporter compact --success 28 | // 020-TestCase-2.cpp:13: failed: Factorial(0) == 1 for: 0 == 1 29 | // 020-TestCase-2.cpp:17: passed: Factorial(1) == 1 for: 1 == 1 30 | // 020-TestCase-2.cpp:18: passed: Factorial(2) == 2 for: 2 == 2 31 | // 020-TestCase-2.cpp:19: passed: Factorial(3) == 6 for: 6 == 6 32 | // 020-TestCase-2.cpp:20: passed: Factorial(10) == 3628800 for: 3628800 (0x375f00) == 3628800 (0x375f00) 33 | // Failed 1 test case, failed 1 assertion. 34 | -------------------------------------------------------------------------------- /lib/Catch2/extras/gdbinit: -------------------------------------------------------------------------------- 1 | # 2 | # This file provides a way to skip stepping into Catch code when debugging with gdb. 3 | # 4 | # With the gdb "skip" command you can tell gdb to skip files or functions during debugging. 5 | # see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example 6 | # 7 | # Basically the following line tells gdb to skip all functions containing the 8 | # regexp "Catch", which matches the complete Catch namespace. 9 | # If you want to skip just some parts of the Catch code you can modify the 10 | # regexp accordingly. 11 | # 12 | # If you want to permanently skip stepping into Catch code copy the following 13 | # line into your ~/.gdbinit file 14 | # 15 | 16 | skip -rfu Catch 17 | -------------------------------------------------------------------------------- /lib/Catch2/extras/lldbinit: -------------------------------------------------------------------------------- 1 | # 2 | # This file provides a way to skip stepping into Catch code when debugging with lldb. 3 | # 4 | # With the setting "target.process.thread.step-avoid-regexp" you can tell lldb 5 | # to skip functions matching the regexp 6 | # 7 | # Basically the following line tells lldb to skip all functions containing the 8 | # regexp "Catch", which matches the complete Catch namespace. 9 | # If you want to skip just some parts of the Catch code you can modify the 10 | # regexp accordingly. 11 | # 12 | # If you want to permanently skip stepping into Catch code copy the following 13 | # line into your ~/.lldbinit file 14 | # 15 | 16 | settings set target.process.thread.step-avoid-regexp Catch -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # License: Boost 1.0 2 | # By Paul Dreik 2020 3 | 4 | # add a library that brings in the main() function from libfuzzer 5 | # and has all the dependencies, so the individual fuzzers can be 6 | # added one line each. 7 | add_library(fuzzhelper NullOStream.h NullOStream.cpp) 8 | target_link_libraries(fuzzhelper PUBLIC Catch2::Catch2) 9 | 10 | # use C++17 so we can get string_view 11 | target_compile_features(fuzzhelper PUBLIC cxx_std_17) 12 | 13 | # This should be possible to set from the outside to be oss-fuzz compatible, 14 | # fix later. For now, target libFuzzer only. 15 | target_link_options(fuzzhelper PUBLIC "-fsanitize=fuzzer") 16 | 17 | foreach(fuzzer TestSpecParser XmlWriter textflow) 18 | add_executable(fuzz_${fuzzer} fuzz_${fuzzer}.cpp) 19 | target_link_libraries(fuzz_${fuzzer} PRIVATE fuzzhelper) 20 | endforeach() 21 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/NullOStream.cpp: -------------------------------------------------------------------------------- 1 | #include "NullOStream.h" 2 | 3 | void NullOStream::avoidOutOfLineVirtualCompilerWarning() 4 | { 5 | } 6 | 7 | int NullStreambuf::overflow(int c){ 8 | setp(dummyBuffer, dummyBuffer + sizeof(dummyBuffer)); 9 | return (c == traits_type::eof()) ? '\0' : c; 10 | } 11 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/NullOStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | // from https://stackoverflow.com/a/8244052 7 | class NullStreambuf : public std::streambuf { 8 | char dummyBuffer[64]; 9 | 10 | protected: 11 | virtual int overflow(int c) override final; 12 | }; 13 | 14 | class NullOStream final : private NullStreambuf, public std::ostream { 15 | public: 16 | NullOStream() : std::ostream(this) {} 17 | NullStreambuf *rdbuf() { return this; } 18 | virtual void avoidOutOfLineVirtualCompilerWarning(); 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/build_fuzzers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Builds the fuzzers 4 | # 5 | # By Paul Dreik 20200923 6 | set -exu 7 | 8 | CATCHROOT=$(readlink -f $(dirname $0)/..) 9 | 10 | 11 | BUILDDIR=$CATCHROOT/build-fuzzers 12 | mkdir -p $BUILDDIR 13 | cd $BUILDDIR 14 | 15 | if which /usr/lib/ccache/clang++ >/dev/null 2>&1 ; then 16 | CXX=/usr/lib/ccache/clang++ 17 | else 18 | CXX=clang++ 19 | fi 20 | 21 | cmake $CATCHROOT \ 22 | -DCMAKE_CXX_COMPILER=$CXX \ 23 | -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -O3 -g" \ 24 | -DCATCH_DEVELOPMENT_BUILD=On \ 25 | -DCATCH_BUILD_EXAMPLES=Off \ 26 | -DCATCH_BUILD_EXTRA_TESTS=Off \ 27 | -DCATCH_BUILD_TESTING=Off \ 28 | -DBUILD_TESTING=Off \ 29 | -DCATCH_ENABLE_WERROR=Off \ 30 | -DCATCH_BUILD_FUZZERS=On 31 | 32 | cmake --build . -j $(nproc) 33 | 34 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/fuzz_TestSpecParser.cpp: -------------------------------------------------------------------------------- 1 | //License: Boost 1.0 2 | //By Paul Dreik 2020 3 | 4 | #include 5 | #include 6 | 7 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 8 | 9 | Catch::TagAliasRegistry tar; 10 | Catch::TestSpecParser tsp(tar); 11 | 12 | std::string buf(Data,Data+Size); 13 | tsp.parse(buf); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/fuzz_XmlWriter.cpp: -------------------------------------------------------------------------------- 1 | //License: Boost 1.0 2 | //By Paul Dreik 2020 3 | 4 | #include 5 | 6 | #include "NullOStream.h" 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 | 10 | std::string buf(Data,Data+Size); 11 | NullOStream nul; 12 | Catch::XmlEncode encode(buf); 13 | encode.encodeTo(nul); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /lib/Catch2/fuzzing/fuzz_textflow.cpp: -------------------------------------------------------------------------------- 1 | //License: Boost 1.0 2 | //By Paul Dreik 2020 3 | 4 | #include 5 | 6 | #include "NullOStream.h" 7 | 8 | #include 9 | #include 10 | 11 | 12 | template 13 | void split(const char *Data, size_t Size, Callback callback) { 14 | 15 | using namespace std::literals; 16 | constexpr auto sep="\n~~~\n"sv; 17 | 18 | std::string_view remainder(Data,Size); 19 | for (;;) { 20 | auto pos=remainder.find(sep); 21 | if(pos==std::string_view::npos) { 22 | //not found. use the remainder and exit 23 | callback(remainder); 24 | return; 25 | } else { 26 | //found. invoke callback on the first part, then proceed with the rest. 27 | callback(remainder.substr(0,pos)); 28 | remainder=remainder.substr(pos+sep.size()); 29 | } 30 | } 31 | } 32 | 33 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 34 | 35 | Catch::TextFlow::Columns columns; 36 | 37 | // break the input on separator 38 | split((const char*)Data,Size,[&](std::string_view word) { 39 | columns+=Catch::TextFlow::Column(std::string(word)); 40 | }); 41 | 42 | NullOStream nul; 43 | nul << columns; 44 | 45 | return 0; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /lib/Catch2/mdsnippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "ReadOnly": false, 3 | "TocLevel": 5, 4 | "Exclude": [ 5 | "cmake-build" 6 | ], 7 | "WriteHeader": false, 8 | "Convention": "InPlaceOverwrite" 9 | } 10 | -------------------------------------------------------------------------------- /lib/Catch2/meson.build: -------------------------------------------------------------------------------- 1 | # Copyright Catch2 Authors 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE_1_0.txt or copy at 4 | # https://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # SPDX-License-Identifier: BSL-1.0 7 | 8 | project( 9 | 'catch2', 10 | 'cpp', 11 | version: '3.1.1', # CML version placeholder, don't delete 12 | license: 'BSL-1.0', 13 | meson_version: '>=0.49.0', 14 | ) 15 | 16 | subdir('src/catch2') 17 | subdir('tests') 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/catch_chronometer.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | namespace Benchmark { 13 | namespace Detail { 14 | ChronometerConcept::~ChronometerConcept() = default; 15 | } // namespace Detail 16 | } // namespace Benchmark 17 | } // namespace Catch 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/catch_clock.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_CLOCK_HPP_INCLUDED 11 | #define CATCH_CLOCK_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | namespace Benchmark { 18 | template 19 | using ClockDuration = typename Clock::duration; 20 | template 21 | using FloatDuration = std::chrono::duration; 22 | 23 | template 24 | using TimePoint = typename Clock::time_point; 25 | 26 | using default_clock = std::chrono::steady_clock; 27 | 28 | template 29 | struct now { 30 | TimePoint operator()() const { 31 | return Clock::now(); 32 | } 33 | }; 34 | 35 | using fp_seconds = std::chrono::duration>; 36 | } // namespace Benchmark 37 | } // namespace Catch 38 | 39 | #endif // CATCH_CLOCK_HPP_INCLUDED 40 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/catch_environment.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_ENVIRONMENT_HPP_INCLUDED 11 | #define CATCH_ENVIRONMENT_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | namespace Benchmark { 18 | template 19 | struct EnvironmentEstimate { 20 | Duration mean; 21 | OutlierClassification outliers; 22 | 23 | template 24 | operator EnvironmentEstimate() const { 25 | return { mean, outliers }; 26 | } 27 | }; 28 | template 29 | struct Environment { 30 | using clock_type = Clock; 31 | EnvironmentEstimate> clock_resolution; 32 | EnvironmentEstimate> clock_cost; 33 | }; 34 | } // namespace Benchmark 35 | } // namespace Catch 36 | 37 | #endif // CATCH_ENVIRONMENT_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/catch_estimate.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_ESTIMATE_HPP_INCLUDED 11 | #define CATCH_ESTIMATE_HPP_INCLUDED 12 | 13 | namespace Catch { 14 | namespace Benchmark { 15 | template 16 | struct Estimate { 17 | Duration point; 18 | Duration lower_bound; 19 | Duration upper_bound; 20 | double confidence_interval; 21 | 22 | template 23 | operator Estimate() const { 24 | return { point, lower_bound, upper_bound, confidence_interval }; 25 | } 26 | }; 27 | } // namespace Benchmark 28 | } // namespace Catch 29 | 30 | #endif // CATCH_ESTIMATE_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED 11 | #define CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED 12 | 13 | namespace Catch { 14 | namespace Benchmark { 15 | struct OutlierClassification { 16 | int samples_seen = 0; 17 | int low_severe = 0; // more than 3 times IQR below Q1 18 | int low_mild = 0; // 1.5 to 3 times IQR below Q1 19 | int high_mild = 0; // 1.5 to 3 times IQR above Q3 20 | int high_severe = 0; // more than 3 times IQR above Q3 21 | 22 | int total() const { 23 | return low_severe + low_mild + high_mild + high_severe; 24 | } 25 | }; 26 | } // namespace Benchmark 27 | } // namespace Catch 28 | 29 | #endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | namespace Benchmark { 13 | namespace Detail { 14 | BenchmarkFunction::callable::~callable() = default; 15 | } // namespace Detail 16 | } // namespace Benchmark 17 | } // namespace Catch 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/detail/catch_measure.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_MEASURE_HPP_INCLUDED 11 | #define CATCH_MEASURE_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Catch { 19 | namespace Benchmark { 20 | namespace Detail { 21 | template 22 | TimingOf measure(Fun&& fun, Args&&... args) { 23 | auto start = Clock::now(); 24 | auto&& r = Detail::complete_invoke(fun, CATCH_FORWARD(args)...); 25 | auto end = Clock::now(); 26 | auto delta = end - start; 27 | return { delta, CATCH_FORWARD(r), 1 }; 28 | } 29 | } // namespace Detail 30 | } // namespace Benchmark 31 | } // namespace Catch 32 | 33 | #endif // CATCH_MEASURE_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_REPEAT_HPP_INCLUDED 11 | #define CATCH_REPEAT_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | namespace Benchmark { 18 | namespace Detail { 19 | template 20 | struct repeater { 21 | void operator()(int k) const { 22 | for (int i = 0; i < k; ++i) { 23 | fun(); 24 | } 25 | } 26 | Fun fun; 27 | }; 28 | template 29 | repeater> repeat(Fun&& fun) { 30 | return { CATCH_FORWARD(fun) }; 31 | } 32 | } // namespace Detail 33 | } // namespace Benchmark 34 | } // namespace Catch 35 | 36 | #endif // CATCH_REPEAT_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Catch { 14 | namespace Benchmark { 15 | namespace Detail { 16 | struct optimized_away_error : std::exception { 17 | const char* what() const noexcept override; 18 | }; 19 | 20 | const char* optimized_away_error::what() const noexcept { 21 | return "could not measure benchmark, maybe it was optimized away"; 22 | } 23 | 24 | void throw_optimized_away_error() { 25 | Catch::throw_exception(optimized_away_error{}); 26 | } 27 | 28 | } // namespace Detail 29 | } // namespace Benchmark 30 | } // namespace Catch 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/benchmark/detail/catch_timing.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | // Adapted from donated nonius code. 9 | 10 | #ifndef CATCH_TIMING_HPP_INCLUDED 11 | #define CATCH_TIMING_HPP_INCLUDED 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace Catch { 19 | namespace Benchmark { 20 | template 21 | struct Timing { 22 | Duration elapsed; 23 | Result result; 24 | int iterations; 25 | }; 26 | template 27 | using TimingOf = Timing, Detail::CompleteType_t>>; 28 | } // namespace Benchmark 29 | } // namespace Catch 30 | 31 | #endif // CATCH_TIMING_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_assertion_info.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED 9 | #define CATCH_ASSERTION_INFO_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | 17 | struct AssertionInfo { 18 | // AssertionInfo() = delete; 19 | 20 | StringRef macroName; 21 | SourceLineInfo lineInfo; 22 | StringRef capturedExpression; 23 | ResultDisposition::Flags resultDisposition; 24 | }; 25 | 26 | } // end namespace Catch 27 | 28 | #endif // CATCH_ASSERTION_INFO_HPP_INCLUDED 29 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_get_random_seed.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | std::uint32_t getSeed() { 16 | return getCurrentContext().getConfig()->rngSeed(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_get_random_seed.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_GET_RANDOM_SEED_HPP_INCLUDED 9 | #define CATCH_GET_RANDOM_SEED_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | //! Returns Catch2's current RNG seed. 15 | std::uint32_t getSeed(); 16 | } 17 | 18 | #endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED 19 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_tag_alias.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TAG_ALIAS_HPP_INCLUDED 9 | #define CATCH_TAG_ALIAS_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | struct TagAlias { 18 | TagAlias(std::string const& _tag, SourceLineInfo _lineInfo): 19 | tag(_tag), 20 | lineInfo(_lineInfo) 21 | {} 22 | 23 | std::string tag; 24 | SourceLineInfo lineInfo; 25 | }; 26 | 27 | } // end namespace Catch 28 | 29 | #endif // CATCH_TAG_ALIAS_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Catch { 14 | 15 | RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { 16 | CATCH_TRY { 17 | getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); 18 | } CATCH_CATCH_ALL { 19 | // Do not throw when constructing global objects, instead register the exception to be processed later 20 | getMutableRegistryHub().registerStartupException(); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED 9 | #define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | 17 | struct RegistrarForTagAliases { 18 | RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); 19 | }; 20 | 21 | } // end namespace Catch 22 | 23 | #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ 24 | CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ 25 | CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ 26 | namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ 27 | CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION 28 | 29 | #endif // CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_timer.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TIMER_HPP_INCLUDED 9 | #define CATCH_TIMER_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | class Timer { 16 | uint64_t m_nanoseconds = 0; 17 | public: 18 | void start(); 19 | auto getElapsedNanoseconds() const -> uint64_t; 20 | auto getElapsedMicroseconds() const -> uint64_t; 21 | auto getElapsedMilliseconds() const -> unsigned int; 22 | auto getElapsedSeconds() const -> double; 23 | }; 24 | 25 | } // namespace Catch 26 | 27 | #endif // CATCH_TIMER_HPP_INCLUDED 28 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_totals.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TOTALS_HPP_INCLUDED 9 | #define CATCH_TOTALS_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | struct Counts { 16 | Counts operator - ( Counts const& other ) const; 17 | Counts& operator += ( Counts const& other ); 18 | 19 | std::uint64_t total() const; 20 | bool allPassed() const; 21 | bool allOk() const; 22 | 23 | std::uint64_t passed = 0; 24 | std::uint64_t failed = 0; 25 | std::uint64_t failedButOk = 0; 26 | }; 27 | 28 | struct Totals { 29 | 30 | Totals operator - ( Totals const& other ) const; 31 | Totals& operator += ( Totals const& other ); 32 | 33 | Totals delta( Totals const& prevTotals ) const; 34 | 35 | Counts assertions; 36 | Counts testCases; 37 | }; 38 | } 39 | 40 | #endif // CATCH_TOTALS_HPP_INCLUDED 41 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/catch_version_macros.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_VERSION_MACROS_HPP_INCLUDED 9 | #define CATCH_VERSION_MACROS_HPP_INCLUDED 10 | 11 | #define CATCH_VERSION_MAJOR 3 12 | #define CATCH_VERSION_MINOR 1 13 | #define CATCH_VERSION_PATCH 1 14 | 15 | #endif // CATCH_VERSION_MACROS_HPP_INCLUDED 16 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/generators/catch_generator_exception.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | 13 | const char* GeneratorException::what() const noexcept { 14 | return m_msg; 15 | } 16 | 17 | } // end namespace Catch 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/generators/catch_generator_exception.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | // Exception type to be thrown when a Generator runs into an error, 16 | // e.g. it cannot initialize the first return value based on 17 | // runtime information 18 | class GeneratorException : public std::exception { 19 | const char* const m_msg = ""; 20 | 21 | public: 22 | GeneratorException(const char* msg): 23 | m_msg(msg) 24 | {} 25 | 26 | const char* what() const noexcept override final; 27 | }; 28 | 29 | } // end namespace Catch 30 | 31 | #endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/generators/catch_generators.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | 16 | IGeneratorTracker::~IGeneratorTracker() = default; 17 | 18 | namespace Generators { 19 | 20 | namespace Detail { 21 | 22 | [[noreturn]] 23 | void throw_generator_exception(char const* msg) { 24 | Catch::throw_exception(GeneratorException{ msg }); 25 | } 26 | } // end namespace Detail 27 | 28 | GeneratorUntypedBase::~GeneratorUntypedBase() = default; 29 | 30 | auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { 31 | return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); 32 | } 33 | 34 | } // namespace Generators 35 | } // namespace Catch 36 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/generators/catch_generators_all.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | /** \file 9 | * This is a convenience header for Catch2's Generator support. It includes 10 | * **all** of Catch2 headers related to generators. 11 | * 12 | * Generally the Catch2 users should use specific includes they need, 13 | * but this header can be used instead for ease-of-experimentation, or 14 | * just plain convenience, at the cost of (significantly) increased 15 | * compilation times. 16 | * 17 | * When a new header is added to either the `generators` folder, 18 | * or to the corresponding internal subfolder, it should be added here. 19 | */ 20 | 21 | #ifndef CATCH_GENERATORS_ALL_HPP_INCLUDED 22 | #define CATCH_GENERATORS_ALL_HPP_INCLUDED 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif // CATCH_GENERATORS_ALL_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/generators/catch_generators_random.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | std::uint32_t Catch::Generators::Detail::getSeed() { return sharedRng()(); } 14 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IResultCapture::~IResultCapture() = default; 13 | } 14 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IConfig::~IConfig() = default; 13 | } 14 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IExceptionTranslator::~IExceptionTranslator() = default; 13 | IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; 14 | } 15 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | 12 | namespace Catch { 13 | namespace Generators { 14 | 15 | bool GeneratorUntypedBase::countedNext() { 16 | auto ret = next(); 17 | if ( ret ) { 18 | m_stringReprCache.clear(); 19 | ++m_currentElementIndex; 20 | } 21 | return ret; 22 | } 23 | 24 | StringRef GeneratorUntypedBase::currentElementAsString() const { 25 | if ( m_stringReprCache.empty() ) { 26 | m_stringReprCache = stringifyImpl(); 27 | } 28 | return m_stringReprCache; 29 | } 30 | 31 | } // namespace Generators 32 | } // namespace Catch 33 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IRegistryHub::~IRegistryHub() = default; 13 | IMutableRegistryHub::~IMutableRegistryHub() = default; 14 | } 15 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IReporterFactory::~IReporterFactory() = default; 13 | EventListenerFactory::~EventListenerFactory() = default; 14 | } 15 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | IReporterRegistry::~IReporterRegistry() = default; 13 | } 14 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED 9 | #define CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | struct TagAlias; 16 | 17 | class ITagAliasRegistry { 18 | public: 19 | virtual ~ITagAliasRegistry(); // = default 20 | // Nullptr if not present 21 | virtual TagAlias const* find( std::string const& alias ) const = 0; 22 | virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; 23 | 24 | static ITagAliasRegistry const& get(); 25 | }; 26 | 27 | } // end namespace Catch 28 | 29 | #endif // CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | ITestInvoker::~ITestInvoker() = default; 13 | ITestCaseRegistry::~ITestCaseRegistry() = default; 14 | } 15 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace Catch { 15 | namespace Detail { 16 | 17 | bool CaseInsensitiveLess::operator()( StringRef lhs, 18 | StringRef rhs ) const { 19 | return std::lexicographical_compare( 20 | lhs.begin(), lhs.end(), 21 | rhs.begin(), rhs.end(), 22 | []( char l, char r ) { return toLower( l ) < toLower( r ); } ); 23 | } 24 | 25 | bool 26 | CaseInsensitiveEqualTo::operator()( StringRef lhs, 27 | StringRef rhs ) const { 28 | return std::equal( 29 | lhs.begin(), lhs.end(), 30 | rhs.begin(), rhs.end(), 31 | []( char l, char r ) { return toLower( l ) == toLower( r ); } ); 32 | } 33 | 34 | } // namespace Detail 35 | } // namespace Catch 36 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED 9 | #define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Detail { 15 | //! Provides case-insensitive `op<` semantics when called 16 | struct CaseInsensitiveLess { 17 | bool operator()( StringRef lhs, 18 | StringRef rhs ) const; 19 | }; 20 | 21 | //! Provides case-insensitive `op==` semantics when called 22 | struct CaseInsensitiveEqualTo { 23 | bool operator()( StringRef lhs, 24 | StringRef rhs ) const; 25 | }; 26 | 27 | } // namespace Detail 28 | } // namespace Catch 29 | 30 | #endif // CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_case_sensitive.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_CASE_SENSITIVE_HPP_INCLUDED 9 | #define CATCH_CASE_SENSITIVE_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | enum class CaseSensitive { Yes, No }; 14 | 15 | } // namespace Catch 16 | 17 | #endif // CATCH_CASE_SENSITIVE_HPP_INCLUDED 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_commandline.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_COMMANDLINE_HPP_INCLUDED 9 | #define CATCH_COMMANDLINE_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | struct ConfigData; 16 | 17 | Clara::Parser makeCommandLineParser( ConfigData& config ); 18 | 19 | } // end namespace Catch 20 | 21 | #endif // CATCH_COMMANDLINE_HPP_INCLUDED 22 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /** \file 10 | * Wrapper for ANDROID_LOGWRITE configuration option 11 | * 12 | * We want to default to enabling it when compiled for android, but 13 | * users of the library should also be able to disable it if they want 14 | * to. 15 | */ 16 | 17 | #ifndef CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED 18 | #define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED 19 | 20 | #include 21 | 22 | #if defined(__ANDROID__) 23 | # define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE 24 | #endif 25 | 26 | 27 | #if defined( CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE ) && \ 28 | !defined( CATCH_CONFIG_NO_ANDROID_LOGWRITE ) && \ 29 | !defined( CATCH_CONFIG_ANDROID_LOGWRITE ) 30 | # define CATCH_CONFIG_ANDROID_LOGWRITE 31 | #endif 32 | 33 | #endif // CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_config_counter.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /** \file 10 | * Wrapper for the CONFIG configuration option 11 | * 12 | * When generating internal unique names, there are two options. Either 13 | * we mix in the current line number, or mix in an incrementing number. 14 | * We prefer the latter, using `__COUNTER__`, but users might want to 15 | * use the former. 16 | */ 17 | 18 | #ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED 19 | #define CATCH_CONFIG_COUNTER_HPP_INCLUDED 20 | 21 | #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) 22 | #define CATCH_INTERNAL_CONFIG_COUNTER 23 | #endif 24 | 25 | #if defined( CATCH_INTERNAL_CONFIG_COUNTER ) && \ 26 | !defined( CATCH_CONFIG_NO_COUNTER ) && \ 27 | !defined( CATCH_CONFIG_COUNTER ) 28 | # define CATCH_CONFIG_COUNTER 29 | #endif 30 | 31 | 32 | #endif // CATCH_CONFIG_COUNTER_HPP_INCLUDED 33 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_config_wchar.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /** \file 10 | * Wrapper for the WCHAR configuration option 11 | * 12 | * We want to support platforms that do not provide `wchar_t`, so we 13 | * sometimes have to disable providing wchar_t overloads through Catch2, 14 | * e.g. the StringMaker specialization for `std::wstring`. 15 | */ 16 | 17 | #ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED 18 | #define CATCH_CONFIG_WCHAR_HPP_INCLUDED 19 | 20 | // We assume that WCHAR should be enabled by default, and only disabled 21 | // for a shortlist (so far only DJGPP) of compilers. 22 | 23 | #if defined(__DJGPP__) 24 | # define CATCH_INTERNAL_CONFIG_NO_WCHAR 25 | #endif // __DJGPP__ 26 | 27 | #if !defined( CATCH_INTERNAL_CONFIG_NO_WCHAR ) && \ 28 | !defined( CATCH_CONFIG_NO_WCHAR ) && \ 29 | !defined( CATCH_CONFIG_WCHAR ) 30 | # define CATCH_CONFIG_WCHAR 31 | #endif 32 | 33 | #endif // CATCH_CONFIG_WCHAR_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_console_width.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED 9 | #define CATCH_CONSOLE_WIDTH_HPP_INCLUDED 10 | 11 | // This include must be kept so that user's configured value for CONSOLE_WIDTH 12 | // is used before we attempt to provide a default value 13 | #include 14 | 15 | #ifndef CATCH_CONFIG_CONSOLE_WIDTH 16 | #define CATCH_CONFIG_CONSOLE_WIDTH 80 17 | #endif 18 | 19 | #endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED 20 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_debug_console.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_DEBUG_CONSOLE_HPP_INCLUDED 9 | #define CATCH_DEBUG_CONSOLE_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | void writeToDebugConsole( std::string const& text ); 15 | } 16 | 17 | #endif // CATCH_DEBUG_CONSOLE_HPP_INCLUDED 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_decomposer.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | 13 | ITransientExpression::~ITransientExpression() = default; 14 | 15 | void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { 16 | if( lhs.size() + rhs.size() < 40 && 17 | lhs.find('\n') == std::string::npos && 18 | rhs.find('\n') == std::string::npos ) 19 | os << lhs << ' ' << op << ' ' << rhs; 20 | else 21 | os << lhs << '\n' << op << '\n' << rhs; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_enforce.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | 14 | namespace Catch { 15 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) 16 | [[noreturn]] 17 | void throw_exception(std::exception const& e) { 18 | Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" 19 | << "The message was: " << e.what() << '\n'; 20 | std::terminate(); 21 | } 22 | #endif 23 | 24 | [[noreturn]] 25 | void throw_logic_error(std::string const& msg) { 26 | throw_exception(std::logic_error(msg)); 27 | } 28 | 29 | [[noreturn]] 30 | void throw_domain_error(std::string const& msg) { 31 | throw_exception(std::domain_error(msg)); 32 | } 33 | 34 | [[noreturn]] 35 | void throw_runtime_error(std::string const& msg) { 36 | throw_exception(std::runtime_error(msg)); 37 | } 38 | 39 | 40 | 41 | } // namespace Catch; 42 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_enum_values_registry.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED 9 | #define CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace Catch { 18 | 19 | namespace Detail { 20 | 21 | Catch::Detail::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); 22 | 23 | class EnumValuesRegistry : public IMutableEnumValuesRegistry { 24 | 25 | std::vector> m_enumInfos; 26 | 27 | EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values) override; 28 | }; 29 | 30 | std::vector parseEnums( StringRef enums ); 31 | 32 | } // Detail 33 | 34 | } // Catch 35 | 36 | #endif // CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_errno_guard.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace Catch { 14 | ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} 15 | ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } 16 | } 17 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_errno_guard.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_ERRNO_GUARD_HPP_INCLUDED 9 | #define CATCH_ERRNO_GUARD_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | //! Simple RAII class that stores the value of `errno` 14 | //! at construction and restores it at destruction. 15 | class ErrnoGuard { 16 | public: 17 | // Keep these outlined to avoid dragging in macros from 18 | 19 | ErrnoGuard(); 20 | ~ErrnoGuard(); 21 | private: 22 | int m_oldErrno; 23 | }; 24 | 25 | } 26 | 27 | #endif // CATCH_ERRNO_GUARD_HPP_INCLUDED 28 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 9 | #define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | 19 | class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { 20 | public: 21 | ~ExceptionTranslatorRegistry() override; 22 | void registerTranslator( Detail::unique_ptr&& translator ); 23 | std::string translateActiveException() const override; 24 | std::string tryTranslators() const; 25 | 26 | private: 27 | ExceptionTranslators m_translators; 28 | }; 29 | } 30 | 31 | #endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED 32 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_floating_point_helpers.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Detail { 15 | 16 | uint32_t convertToBits(float f) { 17 | static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated"); 18 | uint32_t i; 19 | std::memcpy(&i, &f, sizeof(f)); 20 | return i; 21 | } 22 | 23 | uint64_t convertToBits(double d) { 24 | static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated"); 25 | uint64_t i; 26 | std::memcpy(&i, &d, sizeof(d)); 27 | return i; 28 | } 29 | 30 | } // end namespace Detail 31 | } // end namespace Catch 32 | 33 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_lazy_expr.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | 12 | namespace Catch { 13 | 14 | auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& { 15 | if (lazyExpr.m_isNegated) 16 | os << '!'; 17 | 18 | if (lazyExpr) { 19 | if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression()) 20 | os << '(' << *lazyExpr.m_transientExpression << ')'; 21 | else 22 | os << *lazyExpr.m_transientExpression; 23 | } else { 24 | os << "{** error - unchecked empty expression requested **}"; 25 | } 26 | return os; 27 | } 28 | 29 | } // namespace Catch 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_lazy_expr.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_LAZY_EXPR_HPP_INCLUDED 9 | #define CATCH_LAZY_EXPR_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | class ITransientExpression; 16 | 17 | class LazyExpression { 18 | friend class AssertionHandler; 19 | friend struct AssertionStats; 20 | friend class RunContext; 21 | 22 | ITransientExpression const* m_transientExpression = nullptr; 23 | bool m_isNegated; 24 | public: 25 | LazyExpression( bool isNegated ): 26 | m_isNegated(isNegated) 27 | {} 28 | LazyExpression(LazyExpression const& other) = default; 29 | LazyExpression& operator = ( LazyExpression const& ) = delete; 30 | 31 | explicit operator bool() const { 32 | return m_transientExpression != nullptr; 33 | } 34 | 35 | friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; 36 | }; 37 | 38 | } // namespace Catch 39 | 40 | #endif // CATCH_LAZY_EXPR_HPP_INCLUDED 41 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_leak_detector.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #ifdef CATCH_CONFIG_WINDOWS_CRTDBG 14 | #include 15 | 16 | namespace Catch { 17 | 18 | LeakDetector::LeakDetector() { 19 | int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); 20 | flag |= _CRTDBG_LEAK_CHECK_DF; 21 | flag |= _CRTDBG_ALLOC_MEM_DF; 22 | _CrtSetDbgFlag(flag); 23 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 24 | _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 25 | // Change this to leaking allocation's number to break there 26 | _CrtSetBreakAlloc(-1); 27 | } 28 | } 29 | 30 | #else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv 31 | 32 | Catch::LeakDetector::LeakDetector() {} 33 | 34 | #endif // CATCH_CONFIG_WINDOWS_CRTDBG 35 | 36 | Catch::LeakDetector::~LeakDetector() { 37 | Catch::cleanUp(); 38 | } 39 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_leak_detector.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED 9 | #define CATCH_LEAK_DETECTOR_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | struct LeakDetector { 14 | LeakDetector(); 15 | ~LeakDetector(); 16 | }; 17 | 18 | } 19 | #endif // CATCH_LEAK_DETECTOR_HPP_INCLUDED 20 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_list.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_LIST_HPP_INCLUDED 9 | #define CATCH_LIST_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | 17 | namespace Catch { 18 | 19 | class IEventListener; 20 | class Config; 21 | 22 | 23 | struct ReporterDescription { 24 | std::string name, description; 25 | }; 26 | struct ListenerDescription { 27 | StringRef name; 28 | std::string description; 29 | }; 30 | 31 | struct TagInfo { 32 | void add(StringRef spelling); 33 | std::string all() const; 34 | 35 | std::set spellings; 36 | std::size_t count = 0; 37 | }; 38 | 39 | bool list( IEventListener& reporter, Config const& config ); 40 | 41 | } // end namespace Catch 42 | 43 | #endif // CATCH_LIST_HPP_INCLUDED 44 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_message_info.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | namespace Catch { 12 | 13 | MessageInfo::MessageInfo( StringRef _macroName, 14 | SourceLineInfo const& _lineInfo, 15 | ResultWas::OfType _type ) 16 | : macroName( _macroName ), 17 | lineInfo( _lineInfo ), 18 | type( _type ), 19 | sequence( ++globalCount ) 20 | {} 21 | 22 | // This may need protecting if threading support is added 23 | unsigned int MessageInfo::globalCount = 0; 24 | 25 | } // end namespace Catch 26 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_move_and_forward.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_MOVE_AND_FORWARD_HPP_INCLUDED 9 | #define CATCH_MOVE_AND_FORWARD_HPP_INCLUDED 10 | 11 | #include 12 | 13 | //! Replacement for std::move with better compile time performance 14 | #define CATCH_MOVE(...) static_cast&&>(__VA_ARGS__) 15 | 16 | //! Replacement for std::forward with better compile time performance 17 | #define CATCH_FORWARD(...) static_cast(__VA_ARGS__) 18 | 19 | #endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED 20 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_noncopyable.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_NONCOPYABLE_HPP_INCLUDED 9 | #define CATCH_NONCOPYABLE_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | namespace Detail { 13 | 14 | //! Deriving classes become noncopyable and nonmovable 15 | class NonCopyable { 16 | NonCopyable( NonCopyable const& ) = delete; 17 | NonCopyable( NonCopyable&& ) = delete; 18 | NonCopyable& operator=( NonCopyable const& ) = delete; 19 | NonCopyable& operator=( NonCopyable&& ) = delete; 20 | 21 | protected: 22 | NonCopyable() noexcept = default; 23 | }; 24 | 25 | } // namespace Detail 26 | } // namespace Catch 27 | 28 | #endif // CATCH_NONCOPYABLE_HPP_INCLUDED 29 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_platform.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_PLATFORM_HPP_INCLUDED 9 | #define CATCH_PLATFORM_HPP_INCLUDED 10 | 11 | // See e.g.: 12 | // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html 13 | #ifdef __APPLE__ 14 | # include 15 | # if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ 16 | (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) 17 | # define CATCH_PLATFORM_MAC 18 | # elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) 19 | # define CATCH_PLATFORM_IPHONE 20 | # endif 21 | 22 | #elif defined(linux) || defined(__linux) || defined(__linux__) 23 | # define CATCH_PLATFORM_LINUX 24 | 25 | #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) 26 | # define CATCH_PLATFORM_WINDOWS 27 | 28 | # if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP ) 29 | # define CATCH_PLATFORM_WINDOWS_UWP 30 | # endif 31 | #endif 32 | 33 | #endif // CATCH_PLATFORM_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_polyfills.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | #if !defined(CATCH_CONFIG_POLYFILL_ISNAN) 18 | bool isnan(float f) { 19 | return std::isnan(f); 20 | } 21 | bool isnan(double d) { 22 | return std::isnan(d); 23 | } 24 | #else 25 | // For now we only use this for embarcadero 26 | bool isnan(float f) { 27 | return std::_isnan(f); 28 | } 29 | bool isnan(double d) { 30 | return std::_isnan(d); 31 | } 32 | #endif 33 | 34 | } // end namespace Catch 35 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_polyfills.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_POLYFILLS_HPP_INCLUDED 9 | #define CATCH_POLYFILLS_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | bool isnan(float f); 13 | bool isnan(double d); 14 | } 15 | 16 | #endif // CATCH_POLYFILLS_HPP_INCLUDED 17 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED 9 | #define CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED 10 | 11 | #define INTERNAL_CATCH_EXPAND1( param ) INTERNAL_CATCH_EXPAND2( param ) 12 | #define INTERNAL_CATCH_EXPAND2( ... ) INTERNAL_CATCH_NO##__VA_ARGS__ 13 | #define INTERNAL_CATCH_DEF( ... ) INTERNAL_CATCH_DEF __VA_ARGS__ 14 | #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF 15 | 16 | #define INTERNAL_CATCH_REMOVE_PARENS( ... ) \ 17 | INTERNAL_CATCH_EXPAND1( INTERNAL_CATCH_DEF __VA_ARGS__ ) 18 | 19 | #endif // CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED 20 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_random_seed_generation.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | 18 | std::uint32_t generateRandomSeed( GenerateFrom from ) { 19 | switch ( from ) { 20 | case GenerateFrom::Time: 21 | return static_cast( std::time( nullptr ) ); 22 | 23 | case GenerateFrom::Default: 24 | case GenerateFrom::RandomDevice: 25 | // In theory, a platform could have random_device that returns just 26 | // 16 bits. That is still some randomness, so we don't care too much 27 | return static_cast( std::random_device{}() ); 28 | 29 | default: 30 | CATCH_ERROR("Unknown generation method"); 31 | } 32 | } 33 | 34 | } // end namespace Catch 35 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_random_seed_generation.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED 9 | #define CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | enum class GenerateFrom { 16 | Time, 17 | RandomDevice, 18 | //! Currently equivalent to RandomDevice, but can change at any point 19 | Default 20 | }; 21 | 22 | std::uint32_t generateRandomSeed(GenerateFrom from); 23 | 24 | } // end namespace Catch 25 | 26 | #endif // CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED 27 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_result_type.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | namespace Catch { 11 | 12 | bool isOk( ResultWas::OfType resultType ) { 13 | return ( resultType & ResultWas::FailureBit ) == 0; 14 | } 15 | bool isJustInfo( int flags ) { 16 | return flags == ResultWas::Info; 17 | } 18 | 19 | ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { 20 | return static_cast( static_cast( lhs ) | static_cast( rhs ) ); 21 | } 22 | 23 | bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } 24 | bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } 25 | 26 | } // end namespace Catch 27 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_singletons.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | #include 11 | 12 | namespace Catch { 13 | 14 | namespace { 15 | static auto getSingletons() -> std::vector*& { 16 | static std::vector* g_singletons = nullptr; 17 | if( !g_singletons ) 18 | g_singletons = new std::vector(); 19 | return g_singletons; 20 | } 21 | } 22 | 23 | ISingleton::~ISingleton() = default; 24 | 25 | void addSingleton(ISingleton* singleton ) { 26 | getSingletons()->push_back( singleton ); 27 | } 28 | void cleanupSingletons() { 29 | auto& singletons = getSingletons(); 30 | for( auto singleton : *singletons ) 31 | delete singleton; 32 | delete singletons; 33 | singletons = nullptr; 34 | } 35 | 36 | } // namespace Catch 37 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_source_line_info.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Catch { 14 | 15 | bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { 16 | return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); 17 | } 18 | bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { 19 | // We can assume that the same file will usually have the same pointer. 20 | // Thus, if the pointers are the same, there is no point in calling the strcmp 21 | return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); 22 | } 23 | 24 | std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { 25 | #ifndef __GNUG__ 26 | os << info.file << '(' << info.line << ')'; 27 | #else 28 | os << info.file << ':' << info.line; 29 | #endif 30 | return os; 31 | } 32 | 33 | } // end namespace Catch 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_source_line_info.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED 9 | #define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | 16 | struct SourceLineInfo { 17 | 18 | SourceLineInfo() = delete; 19 | constexpr SourceLineInfo( char const* _file, std::size_t _line ) noexcept: 20 | file( _file ), 21 | line( _line ) 22 | {} 23 | 24 | bool operator == ( SourceLineInfo const& other ) const noexcept; 25 | bool operator < ( SourceLineInfo const& other ) const noexcept; 26 | 27 | char const* file; 28 | std::size_t line; 29 | 30 | friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info); 31 | }; 32 | } 33 | 34 | #define CATCH_INTERNAL_LINEINFO \ 35 | ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) 36 | 37 | #endif // CATCH_SOURCE_LINE_INFO_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Catch { 14 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 15 | void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { 16 | CATCH_TRY { 17 | m_exceptions.push_back(exception); 18 | } CATCH_CATCH_ALL { 19 | // If we run out of memory during start-up there's really not a lot more we can do about it 20 | std::terminate(); 21 | } 22 | } 23 | 24 | std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { 25 | return m_exceptions; 26 | } 27 | #endif 28 | 29 | } // end namespace Catch 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED 9 | #define CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED 10 | 11 | 12 | #include 13 | #include 14 | 15 | namespace Catch { 16 | 17 | class StartupExceptionRegistry { 18 | #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 19 | public: 20 | void add(std::exception_ptr const& exception) noexcept; 21 | std::vector const& getExceptions() const noexcept; 22 | private: 23 | std::vector m_exceptions; 24 | #endif 25 | }; 26 | 27 | } // end namespace Catch 28 | 29 | #endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_stdstreams.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch { 16 | 17 | // If you #define this you must implement these functions 18 | #if !defined( CATCH_CONFIG_NOSTDOUT ) 19 | std::ostream& cout() { return std::cout; } 20 | std::ostream& cerr() { return std::cerr; } 21 | std::ostream& clog() { return std::clog; } 22 | #endif 23 | 24 | } // namespace Catch 25 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_stdstreams.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #ifndef CATCH_STDSTREAMS_HPP_INCLUDED 10 | #define CATCH_STDSTREAMS_HPP_INCLUDED 11 | 12 | #include 13 | 14 | namespace Catch { 15 | 16 | std::ostream& cout(); 17 | std::ostream& cerr(); 18 | std::ostream& clog(); 19 | 20 | } // namespace Catch 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_stream_end_stop.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED 9 | #define CATCH_STREAM_END_STOP_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | // Use this in variadic streaming macros to allow 16 | // << +StreamEndStop 17 | // as well as 18 | // << stuff +StreamEndStop 19 | struct StreamEndStop { 20 | StringRef operator+() const { return StringRef(); } 21 | 22 | template 23 | friend T const& operator+( T const& value, StreamEndStop ) { 24 | return value; 25 | } 26 | }; 27 | 28 | } // namespace Catch 29 | 30 | #endif // CATCH_STREAM_END_STOP_HPP_INCLUDED 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED 9 | #define CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace Catch { 18 | struct SourceLineInfo; 19 | 20 | class TagAliasRegistry : public ITagAliasRegistry { 21 | public: 22 | ~TagAliasRegistry() override; 23 | TagAlias const* find( std::string const& alias ) const override; 24 | std::string expandAliases( std::string const& unexpandedTestSpec ) const override; 25 | void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); 26 | 27 | private: 28 | std::map m_registry; 29 | }; 30 | 31 | } // end namespace Catch 32 | 33 | #endif // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED 34 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED 9 | #define CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | 15 | struct TestCaseInfo; 16 | 17 | class TestCaseInfoHasher { 18 | public: 19 | using hash_t = std::uint64_t; 20 | TestCaseInfoHasher( hash_t seed ); 21 | uint32_t operator()( TestCaseInfo const& t ) const; 22 | 23 | private: 24 | hash_t m_seed; 25 | }; 26 | 27 | } // namespace Catch 28 | 29 | #endif /* CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED */ 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_test_failure_exception.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | 13 | //! Used to signal that an assertion macro failed 14 | struct TestFailureException{}; 15 | 16 | } // namespace Catch 17 | 18 | #endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED 19 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_to_string.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_TO_STRING_HPP_INCLUDED 9 | #define CATCH_TO_STRING_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace Catch { 17 | template 18 | std::string to_string(T const& t) { 19 | #if defined(CATCH_CONFIG_CPP11_TO_STRING) 20 | return std::to_string(t); 21 | #else 22 | ReusableStringStream rss; 23 | rss << t; 24 | return rss.str(); 25 | #endif 26 | } 27 | } // end namespace Catch 28 | 29 | #endif // CATCH_TO_STRING_HPP_INCLUDED 30 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | namespace Catch { 17 | bool uncaught_exceptions() { 18 | #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) 19 | return false; 20 | #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 21 | return std::uncaught_exceptions() > 0; 22 | #else 23 | return std::uncaught_exception(); 24 | #endif 25 | } 26 | } // end namespace Catch 27 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 9 | #define CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 10 | 11 | namespace Catch { 12 | bool uncaught_exceptions(); 13 | } // end namespace Catch 14 | 15 | #endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED 16 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_unique_name.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_UNIQUE_NAME_HPP_INCLUDED 9 | #define CATCH_UNIQUE_NAME_HPP_INCLUDED 10 | 11 | #include 12 | #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line 13 | #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) 14 | #ifdef CATCH_CONFIG_COUNTER 15 | # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) 16 | #else 17 | # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) 18 | #endif 19 | 20 | #endif // CATCH_UNIQUE_NAME_HPP_INCLUDED 21 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_void_type.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_VOID_TYPE_HPP_INCLUDED 9 | #define CATCH_VOID_TYPE_HPP_INCLUDED 10 | 11 | 12 | namespace Catch { 13 | namespace Detail { 14 | 15 | template 16 | struct make_void { using type = void; }; 17 | 18 | template 19 | using void_t = typename make_void::type; 20 | 21 | } // namespace Detail 22 | } // namespace Catch 23 | 24 | 25 | #endif // CATCH_VOID_TYPE_HPP_INCLUDED 26 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED 9 | #define CATCH_WILDCARD_PATTERN_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Catch 16 | { 17 | class WildcardPattern { 18 | enum WildcardPosition { 19 | NoWildcard = 0, 20 | WildcardAtStart = 1, 21 | WildcardAtEnd = 2, 22 | WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd 23 | }; 24 | 25 | public: 26 | 27 | WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity ); 28 | bool matches( std::string const& str ) const; 29 | 30 | private: 31 | std::string normaliseString( std::string const& str ) const; 32 | CaseSensitive m_caseSensitivity; 33 | WildcardPosition m_wildcard = NoWildcard; 34 | std::string m_pattern; 35 | }; 36 | } 37 | 38 | #endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED 39 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED 9 | #define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED 10 | 11 | #include 12 | 13 | #if defined(CATCH_PLATFORM_WINDOWS) 14 | 15 | // We might end up with the define made globally through the compiler, 16 | // and we don't want to trigger warnings for this 17 | #if !defined(NOMINMAX) 18 | # define NOMINMAX 19 | #endif 20 | #if !defined(WIN32_LEAN_AND_MEAN) 21 | # define WIN32_LEAN_AND_MEAN 22 | #endif 23 | 24 | #include 25 | 26 | #endif // defined(CATCH_PLATFORM_WINDOWS) 27 | 28 | #endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED 29 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | 10 | #include 11 | 12 | namespace Catch { 13 | namespace Matchers { 14 | 15 | std::string MatcherUntypedBase::toString() const { 16 | if (m_cachedToString.empty()) { 17 | m_cachedToString = describe(); 18 | } 19 | return m_cachedToString; 20 | } 21 | 22 | MatcherUntypedBase::~MatcherUntypedBase() = default; 23 | 24 | } // namespace Matchers 25 | } // namespace Catch 26 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | 12 | namespace Catch { 13 | namespace Matchers { 14 | 15 | std::string IsEmptyMatcher::describe() const { 16 | return "is empty"; 17 | } 18 | 19 | std::string HasSizeMatcher::describe() const { 20 | ReusableStringStream sstr; 21 | sstr << "has size == " << m_target_size; 22 | return sstr.str(); 23 | } 24 | 25 | IsEmptyMatcher IsEmpty() { 26 | return {}; 27 | } 28 | 29 | HasSizeMatcher SizeIs(std::size_t sz) { 30 | return HasSizeMatcher{ sz }; 31 | } 32 | 33 | } // end namespace Matchers 34 | } // end namespace Catch 35 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers_exception.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | namespace Catch { 11 | namespace Matchers { 12 | 13 | bool ExceptionMessageMatcher::match(std::exception const& ex) const { 14 | return ex.what() == m_message; 15 | } 16 | 17 | std::string ExceptionMessageMatcher::describe() const { 18 | return "exception message matches \"" + m_message + '"'; 19 | } 20 | 21 | ExceptionMessageMatcher Message(std::string const& message) { 22 | return ExceptionMessageMatcher(message); 23 | } 24 | 25 | } // namespace Matchers 26 | } // namespace Catch 27 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers_exception.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 9 | #define CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Matchers { 15 | 16 | class ExceptionMessageMatcher final : public MatcherBase { 17 | std::string m_message; 18 | public: 19 | 20 | ExceptionMessageMatcher(std::string const& message): 21 | m_message(message) 22 | {} 23 | 24 | bool match(std::exception const& ex) const override; 25 | 26 | std::string describe() const override; 27 | }; 28 | 29 | //! Creates a matcher that checks whether a std derived exception has the provided message 30 | ExceptionMessageMatcher Message(std::string const& message); 31 | 32 | } // namespace Matchers 33 | } // namespace Catch 34 | 35 | #endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED 36 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) { 12 | if (desc.empty()) { 13 | return "matches undescribed predicate"; 14 | } else { 15 | return "matches predicate: \"" + desc + '"'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | namespace Catch { 11 | namespace Matchers { 12 | std::string AllTrueMatcher::describe() const { return "contains only true"; } 13 | 14 | AllTrueMatcher AllTrue() { return AllTrueMatcher{}; } 15 | 16 | std::string NoneTrueMatcher::describe() const { return "contains no true"; } 17 | 18 | NoneTrueMatcher NoneTrue() { return NoneTrueMatcher{}; } 19 | 20 | std::string AnyTrueMatcher::describe() const { return "contains at least one true"; } 21 | 22 | AnyTrueMatcher AnyTrue() { return AnyTrueMatcher{}; } 23 | } // namespace Matchers 24 | } // namespace Catch 25 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Catch { 15 | 16 | // This is the general overload that takes a any string matcher 17 | // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers 18 | // the Equals matcher (so the header does not mention matchers) 19 | void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { 20 | std::string exceptionMessage = Catch::translateActiveException(); 21 | MatchExpr expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); 22 | handler.handleExpr( expr ); 23 | } 24 | 25 | } // namespace Catch 26 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/reporters/catch_reporter_compact.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #ifndef CATCH_REPORTER_COMPACT_HPP_INCLUDED 9 | #define CATCH_REPORTER_COMPACT_HPP_INCLUDED 10 | 11 | 12 | #include 13 | 14 | 15 | namespace Catch { 16 | 17 | class CompactReporter final : public StreamingReporterBase { 18 | public: 19 | using StreamingReporterBase::StreamingReporterBase; 20 | 21 | ~CompactReporter() override; 22 | 23 | static std::string getDescription(); 24 | 25 | void noMatchingTestCases( StringRef unmatchedSpec ) override; 26 | 27 | void testRunStarting( TestRunInfo const& _testInfo ) override; 28 | 29 | void assertionEnded(AssertionStats const& _assertionStats) override; 30 | 31 | void sectionEnded(SectionStats const& _sectionStats) override; 32 | 33 | void testRunEnded(TestRunStats const& _testRunStats) override; 34 | 35 | }; 36 | 37 | } // end namespace Catch 38 | 39 | #endif // CATCH_REPORTER_COMPACT_HPP_INCLUDED 40 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace Catch { 14 | namespace Detail { 15 | 16 | void registerReporterImpl( std::string const& name, 17 | IReporterFactoryPtr reporterPtr ) { 18 | CATCH_TRY { 19 | getMutableRegistryHub().registerReporter( 20 | name, CATCH_MOVE( reporterPtr ) ); 21 | } 22 | CATCH_CATCH_ALL { 23 | // Do not throw when constructing global objects, instead 24 | // register the exception to be processed later 25 | getMutableRegistryHub().registerStartupException(); 26 | } 27 | } 28 | 29 | } // namespace Detail 30 | } // namespace Catch 31 | -------------------------------------------------------------------------------- /lib/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | #include 9 | 10 | namespace Catch { 11 | 12 | StreamingReporterBase::~StreamingReporterBase() = default; 13 | 14 | void 15 | StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) { 16 | currentTestRunInfo = _testRunInfo; 17 | } 18 | 19 | void StreamingReporterBase::testRunEnded( TestRunStats const& ) { 20 | currentTestCaseInfo = nullptr; 21 | } 22 | 23 | } // end namespace Catch 24 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/ToDo.txt: -------------------------------------------------------------------------------- 1 | Configuration options that are left default and thus are not properly tested 2 | yet: 3 | 4 | CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases 5 | CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows 6 | CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed 7 | CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals 8 | CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap 9 | CATCH_CONFIG_DEFAULT_REPORTER 10 | CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS 11 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace Catch { 14 | [[noreturn]] 15 | void throw_exception(std::exception const& e) { 16 | std::cerr << "====== CUSTOM HANDLER ====== run terminates because an exception was thrown.\n" 17 | << "The message was: " << e.what() << '\n'; 18 | // Avoid abort and other exceptional exits -- there is no way 19 | // to tell CMake that abort is the desired outcome of a test. 20 | exit(1); 21 | } 22 | } 23 | 24 | TEST_CASE("Tests that run") { 25 | // All of these should be run and be reported 26 | CHECK(1 == 2); 27 | CHECK(1 == 1); 28 | CHECK(1 != 3); 29 | CHECK(1 == 4); 30 | } 31 | 32 | 33 | 34 | TEST_CASE("Tests that abort") { 35 | REQUIRE(1 == 1); 36 | REQUIRE(1 != 2); 37 | REQUIRE(1 == 3); 38 | // We should not get here, because the test above aborts 39 | REQUIRE(1 != 4); 40 | } 41 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that when `STATIC_CHECK` is deferred to runtime and fails, it 11 | * does not abort the test case. 12 | */ 13 | 14 | #include 15 | 16 | TEST_CASE("Deferred static checks") { 17 | STATIC_CHECK(1 == 2); 18 | STATIC_CHECK_FALSE(1 != 2); 19 | // This last assertion must be executed too 20 | CHECK(1 == 2); 21 | } 22 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Test that the user can define custom fallbackStringifier 11 | * 12 | * This is done by defining a custom fallback stringifier that prints 13 | * out a specific string, and then asserting (to cause stringification) 14 | * over a type without stringification support. 15 | */ 16 | 17 | #include 18 | 19 | // A catch-all stringifier 20 | template 21 | std::string fallbackStringifier(T const&) { 22 | return "{ !!! }"; 23 | } 24 | 25 | #include 26 | 27 | struct foo { 28 | explicit operator bool() const { 29 | return true; 30 | } 31 | }; 32 | 33 | TEST_CASE("aa") { 34 | REQUIRE(foo{}); 35 | } 36 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X11-DisableStringification.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Test that stringification of original expression can be disabled. 11 | * 12 | * This is a workaround for VS 2017, 2019 issue with Raw String literals 13 | * and preprocessor token pasting. 14 | */ 15 | 16 | 17 | #include 18 | 19 | namespace { 20 | struct Hidden {}; 21 | 22 | bool operator==(Hidden, Hidden) { return true; } 23 | } 24 | 25 | TEST_CASE("DisableStringification") { 26 | REQUIRE( Hidden{} == Hidden{} ); 27 | } 28 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. 11 | */ 12 | 13 | #include 14 | 15 | void custom_debug_break() { 16 | std::cerr << "Pretty please, break into debugger\n"; 17 | } 18 | 19 | #define CATCH_BREAK_INTO_DEBUGGER() custom_debug_break() 20 | 21 | #define CATCH_CONFIG_MAIN 22 | #include 23 | 24 | TEST_CASE("Failing test that breaks into debugger", "[macros]") { 25 | REQUIRE(1 == 2); 26 | } 27 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X30-BazelReporter.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Test the Bazel report functionality with a simple set 11 | * of dummy test cases. 12 | */ 13 | 14 | #include 15 | 16 | TEST_CASE( "Passing test case" ) { REQUIRE( 1 == 1 ); } 17 | TEST_CASE( "Failing test case" ) { REQUIRE( 2 == 1 ); } 18 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that test cases with identical name and tags are reported as error 11 | */ 12 | 13 | #include 14 | 15 | TEST_CASE("A test case with duplicated name and tags", "[tag1][tag2]") {} 16 | TEST_CASE("A test case with duplicated name and tags", "[tag1][tag2]") {} 17 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that test cases with identical name but different tags are 11 | * not reported as an error. 12 | */ 13 | 14 | #include 15 | 16 | TEST_CASE("A test case with duplicated name but different tags", "[tag1]") {} 17 | TEST_CASE("A test case with duplicated name but different tags", "[tag2]") {} 18 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that test case methods with identical class, name and tags are 11 | * reported as error. 12 | */ 13 | 14 | #include 15 | 16 | class TestCaseFixture { 17 | public: 18 | int m_a; 19 | }; 20 | 21 | TEST_CASE_METHOD(TestCaseFixture, "A test case with duplicated name and tags", "[tag1]") {} 22 | TEST_CASE_METHOD(TestCaseFixture, "A test case with duplicated name and tags", "[tag1]") {} 23 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that test case methods with different class, but same name and 11 | * tags name and tags are not reported as error. 12 | */ 13 | 14 | #include 15 | 16 | class TestCaseFixture1 { 17 | public: 18 | int m_a; 19 | }; 20 | 21 | class TestCaseFixture2 { 22 | public: 23 | int m_a; 24 | }; 25 | 26 | TEST_CASE_METHOD(TestCaseFixture1, "A test case with duplicated name and tags", "[tag1]") {} 27 | TEST_CASE_METHOD(TestCaseFixture2, "A test case with duplicated name and tags", "[tag1]") {} 28 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Checks that reporter registration errors are caught and handled as 11 | * startup errors, by causing a registration error by registering multiple 12 | * reporters with the same name. 13 | */ 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | namespace { 21 | //! Trivial custom reporter for registration 22 | class TestReporter : public Catch::StreamingReporterBase { 23 | public: 24 | using StreamingReporterBase::StreamingReporterBase; 25 | 26 | static std::string getDescription() { return "X35 test reporter"; } 27 | }; 28 | } 29 | 30 | CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) 31 | CATCH_REGISTER_REPORTER( "test-reporter", TestReporter ) 32 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Test that the Catch2 header compiles even after including windows.h 11 | * without defining NOMINMAX first. 12 | * 13 | * As an FYI, if you do that, you are wrong. 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") { 20 | SUCCEED(); 21 | } 22 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * This file serves as a simple compilation test against the amalgamated 11 | * version of Catch2. 12 | */ 13 | 14 | #include "catch_amalgamated.hpp" 15 | 16 | TEST_CASE("Just a dummy test") { 17 | auto i = GENERATE(1, 2, 3); 18 | SECTION("a") { 19 | REQUIRE(1 != 4); 20 | } 21 | SECTION("b") { 22 | CHECK(1 != 5); 23 | } 24 | REQUIRE_THAT(1, 25 | Catch::Matchers::Predicate([](int i) { 26 | return i % 2 == 1; 27 | })); 28 | } 29 | 30 | TEMPLATE_TEST_CASE("Trivial template test case", "", char, short) { 31 | STATIC_REQUIRE(sizeof(TestType) <= sizeof(int)); 32 | } 33 | 34 | TEST_CASE("Benchmark test", "[!benchmark]") { 35 | BENCHMARK("Allocation benchmark") { 36 | return std::vector(10); 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /lib/Catch2/tests/ExtraTests/X92-NoTests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | /**\file 10 | * Links into executable with no tests which should fail when run 11 | */ 12 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt: -------------------------------------------------------------------------------- 1 | This would not be caught previously 2 | Nor would this 3 | A string sent directly to stdout 4 | A string sent directly to stderr 5 | A string sent to stderr via clog 6 | Message from section one 7 | Message from section two 8 | loose text artifact 9 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | 13 | TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) { 14 | REQUIRE( Catch::makeStream( "-" )->isConsole() ); 15 | } 16 | 17 | TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) { 18 | REQUIRE( Catch::makeStream( "" )->isConsole() ); 19 | } 20 | 21 | TEST_CASE( "stdout and stderr streams have %-starting name", "[streams]" ) { 22 | REQUIRE( Catch::makeStream( "%stderr" )->isConsole() ); 23 | REQUIRE( Catch::makeStream( "%stdout" )->isConsole() ); 24 | } 25 | 26 | TEST_CASE( "request an unknown %-starting stream fails", "[streams]" ) { 27 | REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ); 28 | } 29 | 30 | TEST_CASE( "makeStream recognizes %debug stream name", "[streams]" ) { 31 | REQUIRE_NOTHROW( Catch::makeStream( "%debug" ) ); 32 | } 33 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/Misc/invalid-test-names.input: -------------------------------------------------------------------------------- 1 | Test with special, characters in \" name 2 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/Misc/plain-old-tests.input: -------------------------------------------------------------------------------- 1 | random SECTION tests 2 | nested SECTION tests 3 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/Misc/special-characters-in-file.input: -------------------------------------------------------------------------------- 1 | Test with special\, characters \"in name 2 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | TEST_CASE( "sleep_for_100ms", "[.min_duration_test][approvals]" ) 15 | { 16 | std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); 17 | CHECK( true ); 18 | } 19 | 20 | TEST_CASE( "sleep_for_1000ms", "[.min_duration_test][approvals]" ) 21 | { 22 | std::this_thread::sleep_for( std::chrono::milliseconds( 1'000 ) ); 23 | CHECK( true ); 24 | } 25 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | #include 11 | 12 | namespace { 13 | 14 | struct truthy { 15 | truthy(bool b):m_value(b){} 16 | operator bool() const { 17 | return false; 18 | } 19 | bool m_value; 20 | }; 21 | 22 | std::ostream& operator<<(std::ostream& o, truthy) { 23 | o << "Hey, its truthy!"; 24 | return o; 25 | } 26 | 27 | } // end anonymous namespace 28 | 29 | #include 30 | 31 | TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") { 32 | CHECK(truthy(false)); 33 | } 34 | 35 | TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition][approvals]") { 36 | FILE* fptr = nullptr; 37 | REQUIRE(fptr == 0); 38 | REQUIRE(fptr == 0l); 39 | } 40 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | #if defined(CATCH_CONFIG_CPP17_BYTE) 12 | 13 | TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) { 14 | using type = std::byte; 15 | REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); 16 | } 17 | 18 | TEST_CASE( "std::vector -> toString", "[toString][byte][approvals]" ) { 19 | using type = std::vector; 20 | REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) ); 21 | } 22 | 23 | #endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE 24 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER 10 | #include 11 | 12 | #if defined(CATCH_CONFIG_CPP17_OPTIONAL) 13 | 14 | TEST_CASE( "std::optional -> toString", "[toString][optional][approvals]" ) { 15 | using type = std::optional; 16 | REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); 17 | REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); 18 | } 19 | 20 | TEST_CASE( "std::optional -> toString", "[toString][optional][approvals]" ) { 21 | using type = std::optional; 22 | REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); 23 | REQUIRE( "\"abc\"" == ::Catch::Detail::stringify( type{ "abc" } ) ); 24 | } 25 | 26 | TEST_CASE( "std::vector > -> toString", "[toString][optional][approvals]" ) { 27 | using type = std::vector >; 28 | REQUIRE( "{ 0, { }, 2 }" == ::Catch::Detail::stringify( type{ 0, {}, 2 } ) ); 29 | } 30 | 31 | #endif // CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL 32 | -------------------------------------------------------------------------------- /lib/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Catch2 Authors 3 | // Distributed under the Boost Software License, Version 1.0. 4 | // (See accompanying file LICENSE_1_0.txt or copy at 5 | // https://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // SPDX-License-Identifier: BSL-1.0 8 | 9 | #include 10 | 11 | 12 | TEST_CASE() 13 | { 14 | SUCCEED( "anonymous test case" ); 15 | } 16 | 17 | TEST_CASE( "Test case with one argument" ) 18 | { 19 | SUCCEED( "no assertions" ); 20 | } 21 | 22 | TEST_CASE( "Variadic macros", "[variadic][sections]" ) 23 | { 24 | SECTION( "Section with one argument" ) 25 | { 26 | SUCCEED( "no assertions" ); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /lib/Catch2/tools/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project(CatchCoverageHelper) 4 | 5 | add_executable(CoverageHelper coverage-helper.cpp) 6 | set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD 11) 7 | set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD_REQUIRED ON) 8 | set_property(TARGET CoverageHelper PROPERTY CXX_EXTENSIONS OFF) 9 | if (MSVC) 10 | target_compile_options( CoverageHelper PRIVATE /W4 /w44265 /WX /w44061 /w44062 ) 11 | endif() 12 | -------------------------------------------------------------------------------- /lib/Catch2/tools/misc/appveyorMergeCoverageScript.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | import glob 4 | import subprocess 5 | 6 | if __name__ == '__main__': 7 | cov_files = list(glob.glob('tests/cov-report*.bin')) 8 | base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files] 9 | subprocess.check_call(base_cmd) 10 | -------------------------------------------------------------------------------- /lib/Catch2/tools/misc/appveyorTestRunScript.bat: -------------------------------------------------------------------------------- 1 | SETLOCAL EnableDelayedExpansion 2 | 3 | rem Disable launching the JIT debugger for ctest.exe 4 | reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList" /v "ctest.ext" /t REG_DWORD /d 1 5 | cd Build 6 | if "%CONFIGURATION%"=="Debug" ( 7 | if "%coverage%"=="1" ( 8 | ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck || exit /b !ERRORLEVEL! 9 | python ..\tools\misc\appveyorMergeCoverageScript.py || exit /b !ERRORLEVEL! 10 | codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% || exit /b !ERRORLEVEL! 11 | ) else ( 12 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! 13 | ) 14 | ) 15 | if "%CONFIGURATION%"=="Release" ( 16 | ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! 17 | ) 18 | -------------------------------------------------------------------------------- /lib/Catch2/tools/misc/installOpenCppCoverage.ps1: -------------------------------------------------------------------------------- 1 | # Downloads are done from the official github release page links 2 | $downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe" 3 | $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe") 4 | 5 | if(-Not (Test-Path $installerPath)) { 6 | Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl) 7 | Start-FileDownload $downloadUrl -FileName $installerPath 8 | } 9 | 10 | Write-Host -ForegroundColor White "About to install OpenCppCoverage..." 11 | 12 | $installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait) 13 | if($installProcess.ExitCode -ne 0) { 14 | throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode) 15 | } 16 | 17 | # Assume standard, boring, installation path of ".../Program Files/OpenCppCoverage" 18 | $installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage") 19 | $env:Path="$env:Path;$installPath" 20 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/approve.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import os 6 | import sys 7 | import shutil 8 | import glob 9 | from scriptCommon import catchPath 10 | 11 | rootPath = os.path.join( catchPath, 'tests/SelfTest/Baselines' ) 12 | 13 | if len(sys.argv) > 1: 14 | files = [os.path.join( rootPath, f ) for f in sys.argv[1:]] 15 | else: 16 | files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) ) 17 | 18 | 19 | def approveFile( approvedFile, unapprovedFile ): 20 | justFilename = unapprovedFile[len(rootPath)+1:] 21 | if os.path.exists( unapprovedFile ): 22 | if os.path.exists( approvedFile ): 23 | os.remove( approvedFile ) 24 | os.rename( unapprovedFile, approvedFile ) 25 | print( "approved " + justFilename ) 26 | else: 27 | print( "approval file " + justFilename + " does not exist" ) 28 | 29 | if files: 30 | for unapprovedFile in files: 31 | approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile ) 32 | else: 33 | print( "no files to approve" ) 34 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/buildAndTest.cmd: -------------------------------------------------------------------------------- 1 | rem Start at the root of the Catch project directory, for example: 2 | rem cd Catch2 3 | 4 | rem begin-snippet: catch2-build-and-test-win 5 | rem 1. Regenerate the amalgamated distribution 6 | python tools\scripts\generateAmalgamatedFiles.py 7 | 8 | rem 2. Configure the full test build 9 | cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON 10 | 11 | rem 3. Run the actual build 12 | cmake --build debug-build 13 | 14 | rem 4. Run the tests using CTest 15 | cd debug-build 16 | ctest -j 4 --output-on-failure -C Debug 17 | rem end-snippet 18 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/buildAndTest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Start at the root of the Catch project directory, for example: 4 | # cd Catch2 5 | 6 | # begin-snippet: catch2-build-and-test 7 | # 1. Regenerate the amalgamated distribution 8 | ./tools/scripts/generateAmalgamatedFiles.py 9 | 10 | # 2. Configure the full test build 11 | cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON 12 | 13 | # 3. Run the actual build 14 | cmake --build debug-build 15 | 16 | # 4. Run the tests using CTest 17 | cd debug-build 18 | ctest -j 4 --output-on-failure -C Debug 19 | # end-snippet 20 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/checkDuplicateFilenames.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | 6 | files_set = set() 7 | 8 | for root, dir, files in os.walk("src/catch2"): 9 | for file in files: 10 | if file not in files_set: 11 | files_set.add(file) 12 | else: 13 | print("File %s is duplicate" % file) 14 | sys.exit(1) 15 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/developBuild.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementBuildNumber() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/majorRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementMajorVersion() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/minorRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementMinorVersion() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/patchRelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import releaseCommon 5 | 6 | v = releaseCommon.Version() 7 | v.incrementPatchNumber() 8 | releaseCommon.performUpdates(v) 9 | 10 | print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) 11 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/scriptCommon.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import subprocess 4 | 5 | 6 | catchPath = os.path.dirname(os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))) 7 | 8 | def getBuildExecutable(): 9 | if os.name == 'nt': 10 | dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest.exe") 11 | return dir 12 | else: 13 | dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest") 14 | return dir 15 | 16 | 17 | def runAndCapture( args ): 18 | child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE) 19 | lines = [] 20 | line = "" 21 | while True: 22 | out = child.stdout.read(1) 23 | if out == '' and child.poll(): 24 | break 25 | if out != '': 26 | if out == '\n': 27 | lines.append( line ) 28 | line = "" 29 | else: 30 | line = line + out 31 | return lines 32 | -------------------------------------------------------------------------------- /lib/Catch2/tools/scripts/updateDocumentSnippets.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from scriptCommon import catchPath 4 | import os 5 | import subprocess 6 | 7 | # --------------------------------------------------- 8 | # Update code examples 9 | # --------------------------------------------------- 10 | # For info on mdsnippets, see https://github.com/SimonCropp/MarkdownSnippets 11 | 12 | # install dotnet SDK from http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 13 | # Then install MarkdownSnippets.Tool with 14 | # dotnet tool install -g MarkdownSnippets.Tool 15 | # To update: 16 | # dotnet tool update -g MarkdownSnippets.Tool 17 | # To uninstall (e.g. to downgrade to a lower version) 18 | # dotnet tool uninstall -g MarkdownSnippets.Tool 19 | 20 | os.chdir(catchPath) 21 | 22 | subprocess.run('dotnet tool update -g MarkdownSnippets.Tool --version 21.2.0', shell=True, check=True) 23 | subprocess.run('mdsnippets', shell=True, check=True) 24 | -------------------------------------------------------------------------------- /prepare_winbuild.ps1: -------------------------------------------------------------------------------- 1 | #This powershell script prepares your Windows 10 64-bit computer to be able to compile your 2 | #Prusa Firmware by installing a Linux Subsystem 3 | #Please run it as administrator 4 | 5 | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 6 | Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu -OutFile Ubuntu.appx -UseBasicParsing -------------------------------------------------------------------------------- /tests/Arduino.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief Mock file to allow test compilation. 4 | * @author Marek Bel 5 | */ 6 | 7 | #ifndef TESTS_ARDUINO_H_ 8 | #define TESTS_ARDUINO_H_ 9 | 10 | extern unsigned long millis(); 11 | 12 | #endif /* TESTS_ARDUINO_H_ */ 13 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # do not build the firmware by default (tests are the focus if not crosscompiling) 2 | project(cmake_test) 3 | 4 | # include catch_discover_tests function from Catch2 5 | include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) 6 | 7 | # Make test executable 8 | set(TEST_SOURCES 9 | Example_test.cpp 10 | PrusaStatistics_test.cpp 11 | #Tests/Timer_test.cpp 12 | #Firmware/Timer.cpp 13 | ) 14 | 15 | add_executable(tests ${TEST_SOURCES}) 16 | target_include_directories(tests PRIVATE tests) 17 | target_link_libraries(tests Catch2::Catch2WithMain) 18 | catch_discover_tests(tests) 19 | -------------------------------------------------------------------------------- /tests/Example_test.cpp: -------------------------------------------------------------------------------- 1 | #include "catch2/catch_test_macros.hpp" 2 | 3 | unsigned int Factorial( unsigned int number ) { 4 | return number <= 1 ? number : Factorial(number-1)*number; 5 | } 6 | 7 | TEST_CASE( "Factorials are computed", "[factorial]" ) { 8 | REQUIRE( Factorial(1) == 1 ); 9 | REQUIRE( Factorial(2) == 2 ); 10 | REQUIRE( Factorial(3) == 6 ); 11 | REQUIRE( Factorial(10) == 3628800 ); 12 | } 13 | -------------------------------------------------------------------------------- /tools/dump_crash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | prg=$(basename "$0") 3 | port="$1" 4 | if [ -z "$port" -o "$port" = "-h" ] 5 | then 6 | echo "usage: $0 " >&2 7 | echo "Connect to and dump the content of last crash using D21 to stdout" >&2 8 | exit 1 9 | fi 10 | 11 | set -e 12 | tmp=$(mktemp) 13 | trap "rm -f \"$tmp\"" EXIT 14 | 15 | echo D21 > "$tmp" 16 | printcore -v "$port" "$tmp" 2>&1 | \ 17 | sed -ne '/^RECV: D21 /,/RECV: ok$/s/^RECV: //p' 18 | -------------------------------------------------------------------------------- /tools/dump_eeprom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | prg=$(basename "$0") 3 | port="$1" 4 | if [ -z "$port" -o "$port" = "-h" ] 5 | then 6 | echo "usage: $0 " >&2 7 | echo "Connect to and dump the content of the EEPROM using D3 to stdout" >&2 8 | exit 1 9 | fi 10 | 11 | set -e 12 | tmp=$(mktemp) 13 | trap "rm -f \"$tmp\"" EXIT 14 | 15 | echo D3 > "$tmp" 16 | printcore -v "$port" "$tmp" 2>&1 | \ 17 | sed -ne '/^RECV: D3 /,/RECV: ok$/s/^RECV: //p' 18 | -------------------------------------------------------------------------------- /tools/dump_sram: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | prg=$(basename "$0") 3 | port="$1" 4 | if [ -z "$port" -o "$port" = "-h" ] 5 | then 6 | echo "usage: $0 " >&2 7 | echo "Connect to and dump the content of the SRAM using D2 to stdout" >&2 8 | exit 1 9 | fi 10 | 11 | set -e 12 | tmp=$(mktemp) 13 | trap "rm -f \"$tmp\"" EXIT 14 | 15 | echo D2 > "$tmp" 16 | printcore -v "$port" "$tmp" 2>&1 | \ 17 | sed -ne '/^RECV: D2 /,/RECV: ok$/s/^RECV: //p' 18 | -------------------------------------------------------------------------------- /tools/lib/avr.py: -------------------------------------------------------------------------------- 1 | SRAM_START = 0x200 2 | SRAM_SIZE = 0x2000 3 | SRAM_OFFSET = 0x800000 4 | EEPROM_OFFSET = 0x810000 5 | -------------------------------------------------------------------------------- /tools/noreset: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | prg=$(basename "$0") 3 | port="$1" 4 | if [ -z "$port" -o "$port" = "-h" ] 5 | then 6 | echo "usage: $0 " >&2 7 | echo "Set TTY flags on to avoid reset-on-connect" >&2 8 | exit 1 9 | fi 10 | 11 | set -e 12 | stty -F "$port" -hup 13 | -------------------------------------------------------------------------------- /tools/update_eeprom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | prg=$(basename "$0") 3 | 4 | # parse arguments 5 | while getopts f:h optname 6 | do 7 | case $optname in 8 | f) port="$OPTARG" ;; 9 | *) help=1 ;; 10 | esac 11 | done 12 | shift `expr $OPTIND - 1` 13 | 14 | old="$1" 15 | new="$2" 16 | 17 | if [ -z "$old" -o "$help" = "-h" -o "$#" -gt 2 ] 18 | then 19 | echo "usage: $0 [-f ] []" >&2 20 | echo "Convert to instructions to update instructions." >&2 21 | echo "With , generate instructions to update EEPROM changes only." >&2 22 | echo "Optionally write such changes directly if if given." >&2 23 | exit 1 24 | fi 25 | 26 | set -e 27 | instr=$(mktemp) 28 | trap "rm -f \"$instr\"" EXIT 29 | 30 | convert() 31 | { 32 | sed -ne 's/^\([0-9a-f]\{4,6\}\) \([0-9a-f ]*\)$/D3 Ax\1 C16 X\2/p' "$@" 33 | } 34 | 35 | if [ -z "$new" ]; then 36 | # convert the instructions to updates 37 | convert "$old" > "$instr" 38 | else 39 | tmp1=$(mktemp) 40 | tmp2=$(mktemp) 41 | trap "rm -f \"$tmp1\" \"$tmp2\"" EXIT 42 | 43 | convert "$old" > "$tmp1" 44 | convert "$new" > "$tmp2" 45 | 46 | comm -13 "$tmp1" "$tmp2" > "$instr" 47 | fi 48 | 49 | # write the instructions if requested 50 | if [ -z "$port" ]; then 51 | cat "$instr" 52 | else 53 | printcore -v "$port" "$instr" 54 | fi 55 | -------------------------------------------------------------------------------- /tools/xfimg2dump: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import struct 4 | import sys 5 | 6 | from lib.dump import DUMP_MAGIC, DUMP_OFFSET, DUMP_SIZE 7 | 8 | 9 | def error(msg): 10 | print(msg, file=sys.stderr) 11 | 12 | def main(): 13 | # parse the arguments 14 | ap = argparse.ArgumentParser(description=""" 15 | Extract a crash dump from an external flash image and output 16 | the same format produced by the D21 g-code. 17 | """) 18 | ap.add_argument('image') 19 | args = ap.parse_args() 20 | 21 | # read the image 22 | off = DUMP_OFFSET 23 | with open(args.image, 'rb') as fd: 24 | fd.seek(off) 25 | data = fd.read(DUMP_SIZE) 26 | if len(data) != DUMP_SIZE: 27 | error('incorrect image size') 28 | return 1 29 | 30 | # check for magic header 31 | magic, = struct.unpack('