Progmasoft Catch3

Catch3 C++ testing beyond assertions.

Catch3 keeps the expressive test-writing model of Catch2 and adds a C++17 library of its own: native property testing, snapshots and structured results.

Catch3 is independently maintained. It is not an official Catch2 release and is not endorsed by Catch2's maintainers.

A first property

#include <Progmasoft/Catch3.hpp>

using namespace Progmasoft::Catch3;

TEST_CASE( "reversing twice gives the original", "[property]" ) {
    CATCH3_CHECK_FOR_ALL(
        Gen::Vectors( Gen::Integers<int>() ),
        []( const std::vector<int>& values ) {
            auto copy = values;
            std::reverse( copy.begin(), copy.end() );
            std::reverse( copy.begin(), copy.end() );
            return copy == values;
        } );
}

What Catch3 adds

Familiar tests

Assertions, sections, reporters, benchmarks and the command line keep working through the Catch2-compatible surface.

Shrinking that always holds

Inputs shrink through their recorded choices, so a smaller counterexample still satisfies every filter and dependency.

Failures that come back

An example database replays failures first on the next run, on every machine that shares it, until they are fixed.

Oracles without expected values

Equivalent, Metamorphic, RoundTrip and Idempotent check properties that need no expected result, and state machines test stateful code.

Search and coverage

Target scores guide the search towards rare inputs, and Cover fails a property that reaches an interesting case too rarely.

Snapshots and results

Text snapshots with explicit files, and a structured result model written as JUnit-style XML.

On the roadmap

  • An independent test runner
  • Mocking
  • Coverage per test
  • Change-impact test selection and prioritization
  • Mutation testing
  • Coverage- and mutation-guided test generation