mcpp index

boost-ext.ut

import

[Boost::ext].UT — C++20 single-header unit testing framework, exposed as the C++23 module boost.ut

import boost.ut;
mcpp add boost-ext.ut@2.3.1

用法

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

// Behavioral test: build two tests under [Boost::ext].UT via `import boost.ut;`,
// then exercise the UDL ("..."_test) and function-call (test("...")) syntaxes.
// Counts test registration by reading ut's `tests_runner` directly is awkward,
// so the test instead just RUNS a passing assertion in each style; if the
// module fails to import or any expect() fails, [Boost::ext].UT reports the
// failure through its test runner and `mcpp test` returns non-zero.
import std;
import boost.ut;

using namespace boost::ut;

int main() {
    "UDL syntax"_test = [] {
        expect(42_i == 42);
    };

    test("function syntax") = [] {
        expect(0_i == 0);
        expect(1u == 1_u);
    };

    return 0;
// …

tests/examples/boost-ext.ut/tests/ut.cpp · 项目 tests/examples/boost-ext.ut

构建

modules
boost.ut
targets
boost_ut (lib)
language
c++23
import std
no
include dirs
*/include/boost

源文件 (1)

  • mcpp_generated/boost.ut.cppm

生成的文件

  • mcpp_generated/boost.ut.cppm

版本

版本平台 镜像sha256
2.3.1 最新 LinuxWindowsmacOS 源站 e51bf1873705…