diff options
| author | Leitwolf11 | 2026-09-24 23:54:59 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-09-24 23:54:59 +0300 |
| commit | e6a9c459d033ff5e79ff4d7928e419b032e6f717 (patch) | |
| tree | 7fac13cbbdc5d62d62a837049b13a36de75268c7 | |
| parent | 26c62baa07c158079a1695bcfe70ad541031fec3 (diff) | |
| download | catch3-e6a9c459d033ff5e79ff4d7928e419b032e6f717.tar.gz | |
Refresh Catch3 README, logo, and C++ formatting profile
| -rw-r--r-- | .clang-format | 150 | ||||
| -rw-r--r-- | README.md | 153 | ||||
| -rw-r--r-- | data/artwork/catch3-logo-full-with-background.svg (renamed from data/artwork/catch2-logo-full-with-background.svg) | 10 | ||||
| -rw-r--r-- | data/artwork/catch3-logo-full.svg (renamed from data/artwork/catch2-logo-full.svg) | 10 | ||||
| -rw-r--r-- | tools/misc/SelfTest.vcxproj.user | 23 |
5 files changed, 206 insertions, 140 deletions
diff --git a/.clang-format b/.clang-format index 9efb854d..907da4cb 100644 --- a/.clang-format +++ b/.clang-format @@ -1,45 +1,123 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1 + --- +# Visual X# C++20 format profile, pinned to LLVM/Clang 23.1.0. +# Naming is intentionally outside clang-format and remains governed by the +# existing Visual X# PascalCase/camelCase conventions. Language: Cpp -Standard: c++14 +BasedOnStyle: LLVM +Standard: c++20 + +UseTab: Never +IndentWidth: 4 +ContinuationIndentWidth: 4 +ConstructorInitializerIndentWidth: 4 +AccessModifierOffset: -4 +IndentAccessModifiers: false + +# Keep formatted C++ source within the agreed 80-column width. +ColumnLimit: 80 + +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterExternBlock: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false + +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: None +AllowShortLoopsOnASingleLine: false +AllowShortNamespacesOnASingleLine: false +AllowShortRecordOnASingleLine: Never + +# Function declarations and definitions keep the return type on its own line. +BreakAfterReturnType: All + +PackArguments: + BinPack: OnePerLine +PackParameters: + BinPack: OnePerLine +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false + +BreakBeforeBinaryOperators: All +BreakBeforeTernaryOperators: true +AlignOperands: Align + +BreakConstructorInitializers: BeforeComma +PackConstructorInitializers: Never +BreakInheritanceList: BeforeComma + +PointerAlignment: Right +DerivePointerAlignment: false +QualifierAlignment: Leave + +SpaceBeforeParens: ControlStatements +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCtorInitializerColon: false +SpaceBeforeInheritanceColon: false +SpaceBeforeCpp11BracedList: false +SpacesInAngles: Never +SpacesInSquareBrackets: false +SpacesInParens: Never +SpaceInEmptyBraces: Never -# Note that we cannot use IncludeIsMainRegex functionality, because it -# does not support includes in angle brackets (<>) -SortIncludes: true +Cpp11BracedListStyle: Block + +SpaceAfterTemplateKeyword: false +BreakTemplateDeclarations: Yes + +IndentCaseLabels: true +IndentCaseBlocks: false + +NamespaceIndentation: All +FixNamespaceComments: true +ShortNamespaceLines: 0 +CompactNamespaces: false + +IndentPPDirectives: AfterHash +PPIndentWidth: 4 + +# System headers precede project headers, with alphabetical ordering per group. IncludeBlocks: Regroup +SortIncludes: CaseSensitive +IncludeIsMainRegex: '$^' IncludeCategories: - - Regex: <catch2/.*\.hpp> + - Regex: '^<.*>$' Priority: 1 - - Regex: <.*/.*\.hpp> + SortPriority: 1 + - Regex: '^".*"$' Priority: 2 - - Regex: <.*> - Priority: 3 + SortPriority: 2 + +MaxEmptyLinesToKeep: 1 +KeepEmptyLines: + AtStartOfBlock: false -AllowShortBlocksOnASingleLine: Always -AllowShortEnumsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLambdasOnASingleLine: Inline - -AccessModifierOffset: "-4" -AlignEscapedNewlines: Left -AllowAllConstructorInitializersOnNextLine: "true" -BinPackArguments: "false" -BinPackParameters: "false" -BreakConstructorInitializers: AfterColon -ConstructorInitializerAllOnOneLineOrOnePerLine: "true" -DerivePointerAlignment: "false" -FixNamespaceComments: "true" -IndentCaseLabels: "false" -IndentPPDirectives: AfterHash -IndentWidth: "4" -NamespaceIndentation: All -PointerAlignment: Left -SpaceBeforeCtorInitializerColon: "false" -SpaceInEmptyParentheses: "false" -SpacesInParentheses: "true" -TabWidth: "4" -UseTab: Never -AlwaysBreakTemplateDeclarations: Yes -SpaceAfterTemplateKeyword: true -SortUsingDeclarations: true ReflowComments: true +SortUsingDeclarations: Lexicographic + +# Match the dominant line-ending convention of each input file. +LineEnding: DeriveLF +InsertNewlineAtEOF: true +... @@ -1,94 +1,97 @@ <a id="top"></a> - -> **Progmasoft Catch3 is an independently maintained Catch2-derived project.** -> It currently keeps Catch2 3.16.0's test runner and compatibility API as its -> engine, and adds a separate C++20 property-testing layer. Catch2-originated -> files retain their upstream license; new Progmasoft APIs use the terms stated -> in each file. Catch3 is not an official Catch2 release or endorsed by Catch2's -> maintainers. [Why Catch3 exists and how it differs](docs/why-catch3.md). + + +# Progmasoft Catch3 + +An independently maintained C++ test framework: Catch3 keeps the practical, +expressive test-writing model that developers expect, while adding a separately +owned C++20 library for property checks, snapshots, structured results, and XML +serialization. + +> Catch3 is not an official Catch2 release and is not endorsed by Catch2's +> maintainers. Its current compatibility engine is based on Catch2 3.16.0; +> upstream-originated files keep their upstream license. Progmasoft-authored +> additions have their own licensing terms. See [the project scope and +> compatibility notes](docs/why-catch3.md). + +## What Catch3 provides + +- **Familiar test authoring and execution.** The existing test runner, + assertions, sections, reporters, benchmarks, and command-line behavior remain + available through the Catch2 compatibility surface. +- **Deterministic property testing.** Generate values from a reproducible seed, + check a predicate over multiple trials, and shrink a failing input to a + smaller counterexample. +- **Text snapshots.** Compare generated output against explicitly located + snapshot files, with opt-in creation or replacement modes. +- **Structured results and XML output.** Build a runner-neutral result model and + serialize it as deterministic JUnit-style XML. +- **A compiled library, not a header-only package.** Snapshot I/O and result/XML + serialization are compiled C++20 implementations; templates and assertion + macros remain in headers where needed. + +Catch3 is in an early development stage. The Catch2-compatible runner is still +its execution engine; Catch3 does not yet provide an independent runner. The +property API currently checks one generated value per property and uses bounded, +deterministic greedy shrinking. See [current capabilities and limitations](docs/why-catch3.md) +before adopting it in a production project. + +## Property-test example - -## What is Catch2? - -Catch2 is mainly a unit testing framework for C++, but it also -provides basic micro-benchmarking features, and simple BDD macros. - -Catch2's main advantage is that using it is both simple and natural. -Test names do not have to be valid identifiers, assertions look like -normal C++ boolean expressions, and sections provide a nice and local way -to share set-up and tear-down code in tests. - -**Example unit test** ```cpp -#include <catch2/catch_test_macros.hpp> - -#include <cstdint> - -uint32_t factorial( uint32_t number ) { - return number <= 1 ? number : factorial(number-1) * number; -} - -TEST_CASE( "Factorials are computed", "[factorial]" ) { - REQUIRE( factorial( 1) == 1 ); - REQUIRE( factorial( 2) == 2 ); - REQUIRE( factorial( 3) == 6 ); - REQUIRE( factorial(10) == 3'628'800 ); +#include <Progmasoft/Catch3.hpp> + +TEST_CASE("generated integers stay within their requested domain", "[property]") { + CATCH3_CHECK_PROPERTY( + Progmasoft::Catch3::Integer<int>(1, 100), + [](int value) { return value > 0; }, + Progmasoft::Catch3::PropertyOptions{ + .Trials = 250, + .Seed = 0xC0FFEE, + .MaxShrinkSteps = 200}); } ``` -**Example microbenchmark** -```cpp -#include <catch2/catch_test_macros.hpp> -#include <catch2/benchmark/catch_benchmark.hpp> - -#include <cstdint> - -uint64_t fibonacci(uint64_t number) { - return number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2); -} +The root seed and trial-index derivation are stable, so a reported failing trial +can be replayed. Generators can provide their own generation and shrinking +behavior. See the [property-testing guide](docs/progmasoft-catch3.md#property-testing) +for the API, seed guarantees, and shrinking contract. -TEST_CASE("Benchmark Fibonacci", "[!benchmark]") { - REQUIRE(fibonacci(5) == 5); +## Build and test - REQUIRE(fibonacci(20) == 6'765); - BENCHMARK("fibonacci 20") { - return fibonacci(20); - }; +Bazel is the primary build and validation path. From the repository root: - REQUIRE(fibonacci(25) == 75'025); - BENCHMARK("fibonacci 25") { - return fibonacci(25); - }; -} +```sh +bazel test //tests/Progmasoft:property_tests ``` -_Note that benchmarks are not run by default, so you need to run it explicitly -with the `[!benchmark]` tag._ - +The same suite is also available through the maintained CMake, Meson, Xmake, +and Premake project files. Their setup details and toolchain requirements are +in the [build guide](docs/progmasoft-catch3.md#build-quick-start). -## Project status +For a CMake consumer of the installed libraries: -This repository is based on Catch2's v3 development line and currently identifies -its compatibility engine as version 3.16.0. It is an early-stage fork: existing -Catch2 functionality remains the foundation, while Progmasoft additions are -being introduced in their own namespace and include tree. See the -[compatibility and difference notes](docs/why-catch3.md) before treating this as -a drop-in replacement in production. +```cmake +find_package(Catch2 3.16 CONFIG REQUIRED) +find_package(ProgmasoftCatch3 3.16 CONFIG REQUIRED) +target_link_libraries(MyTests PRIVATE + Progmasoft::Catch3 + Catch2::Catch2WithMain) +``` -## How to use it -This documentation comprises these three parts: +The Catch2 target supplies the compatibility runner and `main`; link +`Progmasoft::Catch3` for the compiled Catch3 additions. The two targets retain +their separate language baselines and licensing boundaries. -* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top) -* [Tutorial](docs/tutorial.md#top) - getting started -* [Reference section](docs/Readme.md#top) - all the details +## Documentation +- [Catch3 additions: properties, snapshots, results, and XML](docs/progmasoft-catch3.md) +- [Project scope, compatibility policy, and limitations](docs/why-catch3.md) +- [Catch2-compatible runner tutorial](docs/tutorial.md) +- [Catch2-compatible API reference](docs/Readme.md) +- [Catch2 upstream project and source history](https://github.com/catchorg/Catch2) -## More -* Catch3 differences and current limitations: [docs/why-catch3.md](docs/why-catch3.md) -* Progmasoft property-testing API and integration: [docs/progmasoft-catch3.md](docs/progmasoft-catch3.md) -* Catch2 upstream history and migration reference: [Catch2's repository](https://github.com/catchorg/Catch2) -* Issues and bugs for this fork can be raised on the [Progmasoft/Catch3 issue tracker](https://github.com/Progmasoft/catch3/issues) -* Catch2's upstream documentation on [open-source users](docs/opensource-users.md#top) -or [commercially](docs/commercial-users.md#top). +Issues and feature requests for Progmasoft Catch3 belong in the +[Progmasoft/Catch3 issue tracker](https://github.com/Progmasoft/catch3/issues). diff --git a/data/artwork/catch2-logo-full-with-background.svg b/data/artwork/catch3-logo-full-with-background.svg index fce859d7..235f52b6 100644 --- a/data/artwork/catch2-logo-full-with-background.svg +++ b/data/artwork/catch3-logo-full-with-background.svg @@ -9,7 +9,7 @@ id="svg1" xml:space="preserve" inkscape:version="1.4-beta (62f545ba5e, 2024-04-22)" - sodipodi:docname="catch2-logo-full-with-background.svg" + sodipodi:docname="catch3-logo-full-with-background.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -70,10 +70,14 @@ id="path16" sodipodi:nodetypes="ccccccccccccc" /><path d="m 164.85789,130.59556 c 0.4642,-0.42537 1.08982,-0.66203 1.62919,-1.08343 1.9002,-1.4847 5.14786,-4.48328 4.44823,-6.80658 -0.26492,-0.87983 -1.26145,-1.35951 -2.21547,-1.29658 -0.98523,0.0649 -1.98724,0.50977 -2.64007,0.84484 -0.6864,0.35231 -1.37265,0.32755 -1.59243,0.87281 -0.30817,0.76454 0.49873,1.79683 1.28659,1.69784 0.23602,-0.0295 0.4698,-0.14082 0.56812,-0.35185 0.21882,-0.46933 0.58753,-0.58023 1.34113,-0.93846 0.73235,-0.34812 1.52921,-0.50494 1.03038,0.7483 -0.71596,1.79868 -3.74234,3.95101 -5.65111,5.2911 0,0 -0.87845,0.57891 -1.09797,0.6564 -0.47551,0.16781 -0.91536,0.19794 -0.84393,0.67269 0.0807,0.5363 0.64891,1.04684 1.12086,1.12458 1.12086,0.18468 1.25286,0.0172 3.02378,0.34516 0.68608,0.12686 1.73627,0.72085 2.01516,0.71659 0.4288,-0.006 0.91785,-2e-4 1.19241,-0.36589 0.38604,-0.51416 0.0632,-1.40966 -0.46279,-1.70348 -0.7765,-0.43372 -2.62935,-0.31806 -3.15208,-0.42404" - style="display:inline;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" + style="display:none;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" id="path1-4" inkscape:label="path2" - sodipodi:nodetypes="csssssssssssssssssc" /><circle + sodipodi:nodetypes="csssssssssssssssssc" /><path + d="M 163.4,121.8 C 165.5,120.4 169.5,120.7 170.7,122.3 C 172,124 169.8,126 167.2,127 C 169.5,127 171.1,128.4 170.9,130.3 C 170.5,132.8 167.6,133.6 164.9,132.9 C 163.2,132.4 162.2,131.6 162.7,130.7 C 163.1,130 163.9,130.4 164.7,130.8 C 166.5,131.7 168.9,131.4 169.2,130 C 169.5,128.6 167.4,128.1 164.9,128.7 C 164,128.9 163.5,128.1 164.4,127.4 C 166.2,126.3 169.2,124.8 169,123.5 C 168.8,122.2 166.9,122 165.1,122.9 C 164.1,123.4 163.5,124 162.8,123.5 C 162.1,123 162.6,122.3 163.4,121.8 Z" + style="display:inline;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" + id="catch3-digit" + inkscape:label="3" /><circle style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0366197;stroke-linecap:round" id="path20" cx="88.551903" diff --git a/data/artwork/catch2-logo-full.svg b/data/artwork/catch3-logo-full.svg index 03bf15b0..4995d132 100644 --- a/data/artwork/catch2-logo-full.svg +++ b/data/artwork/catch3-logo-full.svg @@ -8,7 +8,7 @@ version="1.1" id="svg1" inkscape:version="1.4-beta (62f545ba5e, 2024-04-22)" - sodipodi:docname="catch2-logo.svg" + sodipodi:docname="catch3-logo-full.svg" xml:space="preserve" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" @@ -53,10 +53,14 @@ id="path16" sodipodi:nodetypes="ccccccccccccc" /><path d="m 165.04975,130.34614 c 0.4642,-0.42537 1.08982,-0.66203 1.62919,-1.08343 1.9002,-1.4847 5.14786,-4.48328 4.44823,-6.80658 -0.26492,-0.87983 -1.26145,-1.35951 -2.21547,-1.29658 -0.98523,0.0649 -1.98724,0.50977 -2.64007,0.84484 -0.6864,0.35231 -1.37265,0.32755 -1.59243,0.87281 -0.30817,0.76454 0.49873,1.79683 1.28659,1.69784 0.23602,-0.0295 0.4698,-0.14082 0.56812,-0.35185 0.21882,-0.46933 0.58753,-0.58023 1.34113,-0.93846 0.73235,-0.34812 1.52921,-0.50494 1.03038,0.7483 -0.71596,1.79868 -3.74234,3.95101 -5.65111,5.2911 0,0 -0.87845,0.57891 -1.09797,0.6564 -0.47551,0.16781 -0.91536,0.19794 -0.84393,0.67269 0.0807,0.5363 0.64891,1.04684 1.12086,1.12458 1.12086,0.18468 1.25286,0.0172 3.02378,0.34516 0.68608,0.12686 1.73627,0.72085 2.01516,0.71659 0.4288,-0.006 0.91785,-2e-4 1.19241,-0.36589 0.38604,-0.51416 0.0632,-1.40966 -0.46279,-1.70348 -0.7765,-0.43372 -2.62935,-0.31806 -3.15208,-0.42404" - style="display:inline;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" + style="display:none;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" id="path1-4" inkscape:label="path2" - sodipodi:nodetypes="csssssssssssssssssc" /><circle + sodipodi:nodetypes="csssssssssssssssssc" /><path + d="M 163.4,121.8 C 165.5,120.4 169.5,120.7 170.7,122.3 C 172,124 169.8,126 167.2,127 C 169.5,127 171.1,128.4 170.9,130.3 C 170.5,132.8 167.6,133.6 164.9,132.9 C 163.2,132.4 162.2,131.6 162.7,130.7 C 163.1,130 163.9,130.4 164.7,130.8 C 166.5,131.7 168.9,131.4 169.2,130 C 169.5,128.6 167.4,128.1 164.9,128.7 C 164,128.9 163.5,128.1 164.4,127.4 C 166.2,126.3 169.2,124.8 169,123.5 C 168.8,122.2 166.9,122 165.1,122.9 C 164.1,123.4 163.5,124 162.8,123.5 C 162.1,123 162.6,122.3 163.4,121.8 Z" + style="display:inline;fill:#ff2500;fill-opacity:1;stroke:none;stroke-width:0.384847" + id="catch3-digit" + inkscape:label="3" /><circle style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0366197;stroke-linecap:round" id="path20" cx="88.743759" diff --git a/tools/misc/SelfTest.vcxproj.user b/tools/misc/SelfTest.vcxproj.user deleted file mode 100644 index ffffc575..00000000 --- a/tools/misc/SelfTest.vcxproj.user +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <UseFullPaths>false</UseFullPaths> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <UseFullPaths>false</UseFullPaths> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <UseFullPaths>false</UseFullPaths> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <UseFullPaths>false</UseFullPaths> - </ClCompile> - </ItemDefinitionGroup> -</Project> |