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…