mcpp index

compat.doctest

#include

doctest — the fastest feature-rich C++ single-header testing framework

#include <doctest/doctest.h>
mcpp add compat.doctest@2.4.12

Usage

From this repository's own test project — built and run by CI, not written for the website.

// Behavioral test — compat.doctest gives a working framework AND its main.
//
// No `import std;` here: doctest.h is a textual header that includes the C++
// standard headers itself, and mixing those with the std module is the one
// thing this index's module packages tell consumers not to do.
//
// A failing REQUIRE makes doctest return a non-zero exit code, which is how
// `mcpp test` sees it — so the assertions below are the test, and the runner
// needs no adapter.
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

#include <string>
#include <vector>

static unsigned factorial(unsigned n) { return n <= 1 ? 1 : n * factorial(n - 1); }

TEST_CASE("factorial") {
    CHECK(factorial(0) == 1);
    CHECK(factorial(5) == 120);
}

// …

tests/examples/doctest/tests/suite.cpp · project tests/examples/doctest

openkal

targetresultenvironmenttest projectfirst diagnostic
x86_64-linux-gnurunsposixdoctest
x86_64-windows-muslrunsposixdoctest

How this was measured

Measured 2026-09-23 by tests/openkal/compat.py with openkal-llvm-runtime 0.15.1, llvm@22.1.8, mcpp 2026.9.21.3. The test project selects no platform dependency of its own. The badge above is a summary of the strictest measured target -- the table above states each target's own environment.

Build

targets
doctest (lib)
language
c++23
C standard
c11
import std
no
include dirs
*

Sources (1)

  • mcpp_generated/doctest_anchor.c

Generated files

  • mcpp_generated/doctest_anchor.c

Versions

VersionPlatforms Mirrorssha256
2.4.12 latest LinuxWindowsmacOS CN GLOBAL 73381c7aa4de…