How catchorg/catch2 works
Main components
• Library Source Modules
– Core “catch2” functionality
• interfaces
• internal
• matchers
• reporters
• generators
• benchmark
– Third-party integration (e.g. clara.hpp)
• Build & Packaging
– Bazel (BUILD.bazel, MODULE.bazel)
– CMake (CMakeLists.txt, presets, catch2-*.cmake)
– Meson (meson.build, meson_options.txt)
– Conan (conanfile.py, .conan/*)
• Testing Suites
– SelfTest (introspective, usage, timing, misc)
– ExtraTests
– Fuzzing (fuzz_* in fuzzing/)
– TestScripts (Python/C++ helpers under tests/TestScripts)
• Examples
– sample .cpp files in examples/
• Documentation
– docs/ (tutorial, reference, FAQs, guides)
– Doxyfile
• Tooling & Scripts
– tools/scripts (CI helpers, release scripts, snippet extractors)
– tools/misc (coverage helpers, appveyor scripts)
• CI / External Services
– GitHub Actions workflows (.github/workflows/*.yml)
– AppVeyor (appveyor.yml)
– Codecov, Shields badges
– Discord/chat (link)
Relationships & data flows
• Source Modules → Build & Packaging
– The build system (Bazel/CMake/Meson/Conan) compiles core modules into static/shared libraries or single-header amalgamations.
• Build → Testing Suites
– Built library is linked into SelfTest, ExtraTests, Fuzzing executables.
• Build → Examples
– Examples are compiled against the Catch2 library to demonstrate usage.
• Build → Documentation
– Doxygen scans headers to generate API docs; docs snippets updated via tools/scripts.
• CI Workflows → Build & Test → Codecov
– GitHub Actions & AppVeyor invoke build scripts; on success tests run; coverage uploaded to Codecov.
• Tooling → Release Process
– scripts under tools/scripts implement release version bump, snippet extraction, amalgamated file generation.
Architectural patterns & design principles
• Modularity
– Each subfolder (interfaces, internal, matchers, reporters, etc.) is a cohesive component with well-defined responsibilities.
• Multi-build support
– Abstract build logic to support multiple systems, enabling consumers to integrate Catch2 into various C++ ecosystems.
• Single-header vs multi-header options
– Amalgamated header generation (extras/) vs standard multi-header library.
• Extensibility points
– Reporter plugin interfaces, generator adapters, listener hooks, custom assertion macros.
• Decoupled testing
– Tests are structured to self-validate, introspect library internals, and fuzz specific subsystems.