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

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// 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 · 项目 tests/examples/doctest

openkal

目标结果环境测试项目首条诊断
x86_64-linux-gnurunsposixdoctest
x86_64-windows-muslrunsposixdoctest

测量方式

2026-09-23 由 tests/openkal/compat.py 测得,使用 openkal-llvm-runtime 0.15.1、llvm@22.1.8、mcpp 2026.9.21.3。测试项目没有自行选择平台依赖。 上方徽章是所有已测目标里最严格那个的结果 —— 上表列出每个目标各自的环境。

构建

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

源文件 (1)

  • mcpp_generated/doctest_anchor.c

生成的文件

  • mcpp_generated/doctest_anchor.c

版本

版本平台 镜像sha256
2.4.12 最新 LinuxWindowsmacOS CN GLOBAL 73381c7aa4de…