mcpp index

mcpplibs.mtest

import

mcpplibs.mtest: the C++ test library of mtest --- cases, expectations, fixtures, bench, conformance and end-to-end helpers, with no macro and no header, speaking the mtest test protocol

import mcpplibs.mtest;
#include <mtest.h>

Module name read from the upstream `export module` declaration in src/mtest.cppm.

mcpp add mcpplibs.mtest@0.11.3

Usage

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

import std;
import mcpplibs.mtest;
using namespace mcpplibs::mtest;

UTest parsing{"parsing", tag{"fast"}, [] {
    "a comparison holds"_test = [] { expect(eq(1 + 1, 2)); };
    "a failure reports both sides"_test[expect_failure{"shown"}] = [] { expect(eq(std::string("a"), std::string("b"))); };
}};
E2E timed{"a case with a time limit", timeout{std::chrono::seconds{30}}, [] { expect(true); }};
Bench measured{"a metric within its bound", at_most{"ready", 15}, [] { metric("ready", 1.0, "s"); }};

int main() {
    "parameters"_test = values{2, 4, 6} | [](int v) { expect(eq(v % 2, 0)); };
    return report();
}

tests/examples/mtest/tests/cases.cpp · project tests/examples/mtest

Build · upstream manifest

modules
mcpplibs.mtest
targets
mtest (lib), main (entry)
manifest version
0.11.3
dependencies
mcpplibs, nlohmann
source
https://raw.githubusercontent.com/mcpp-community/mtest/v0.11.3/lib/mcpp.toml

Versions

VersionPlatforms Mirrorssha256
0.11.3 latest LinuxWindowsmacOS GLOBAL CN da46a7361a5c…
0.11.2 LinuxWindowsmacOS GLOBAL CN 1236da4c4529…
0.11.1 LinuxWindowsmacOS GLOBAL CN 69c45ff361a9…
0.11.0 LinuxWindowsmacOS GLOBAL CN 457635770e34…
0.10.0 LinuxWindowsmacOS GLOBAL CN 70c81ff6c6ef…
Show all 23 versions
0.9.0 LinuxWindowsmacOS GLOBALCN 686046fff9a8…
0.8.5 LinuxWindowsmacOS GLOBALCN 03629c481d28…
0.8.4 LinuxWindowsmacOS GLOBALCN 842bc6e896e3…
0.8.3 LinuxWindowsmacOS GLOBALCN f61fb09b2dda…
0.8.0 LinuxWindowsmacOS GLOBALCN 6ea516f470ae…
0.7.2 LinuxWindowsmacOS GLOBALCN c4e6e3d526da…
0.7.1 LinuxWindowsmacOS GLOBALCN 4cf903fc8831…
0.7.0 LinuxWindowsmacOS GLOBALCN ab312f844066…
0.6.3 LinuxWindowsmacOS GLOBALCN a41e5001e400…
0.6.0 LinuxWindowsmacOS GLOBALCN eb90f823b4b2…
0.5.2 LinuxWindowsmacOS GLOBALCN e61819239dca…
0.5.1 LinuxWindowsmacOS GLOBALCN 48625c19d548…
0.5.0 LinuxWindowsmacOS GLOBALCN 586d8a2f4fb5…
0.4.1 LinuxWindowsmacOS GLOBALCN c0a769eba5d3…
0.4.0 LinuxWindowsmacOS GLOBALCN 9c90fc7b225a…
0.3.0 LinuxWindowsmacOS GLOBALCN b695022706d5…
0.2.0 LinuxWindowsmacOS GLOBALCN 600f52ff1b55…
0.1.0 LinuxWindowsmacOS GLOBALCN 2e09528d9717…