From c005add2c0a0b59f8351524ae5361d2b2a977085 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sat, 14 Nov 2026 08:10:33 +0900 Subject: [PATCH] 0.8.2: 0.8.1 as released; its tests of bench::each hold whichever calls the machine slowed --- CHANGELOG.md | 7 +++++++ README.md | 2 +- README.zh-CN.md | 2 +- adapters/gtest/mcpp.toml | 2 +- adapters/gtest/src/protocol.cpp | 2 +- capi/mcpp.toml | 2 +- capi/src/mtest.cpp | 2 +- conformance/mcpp.toml | 2 +- engine/mcpp.toml | 2 +- engine/src/commands.cpp | 2 +- engine/src/main.cpp | 4 ++-- engine/src/service.cpp | 2 +- lib/docs/writing-tests.md | 2 +- lib/mcpp.toml | 2 +- lib/src/mtest.cpp | 2 +- lib/tests/companions.cpp | 30 +++++++++++++++++++++--------- manifest/mcpp.toml | 2 +- 17 files changed, 44 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63b3f4a..4706a87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.8.2] - 2026-11-14 + +- 0.8.1 as released: its tag was made and its release was not (a test of `bench::each` held that + the call it had slowed was the slowest of all, which a loaded machine does not grant). The tests + now hold each stated call to what that call said, whichever calls the machine slowed. The library + is 0.8.1's. + ## [0.8.1] - 2026-11-14 - **A measured call says what it was made of** (`bench::each`, `mcpplibs.mtest.bench`). The body's diff --git a/README.md b/README.md index aa0ce1b..c8df32a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ int main() { ```toml [dev-dependencies] -mcpplibs.mtest = "0.8.1" +mcpplibs.mtest = "0.8.2" ``` A failure names its place and both sides (`expected 2, actual 3`). Under a runner the same program diff --git a/README.zh-CN.md b/README.zh-CN.md index 89fcd8f..870381c 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -37,7 +37,7 @@ int main() { ```toml [dev-dependencies] -mcpplibs.mtest = "0.8.1" +mcpplibs.mtest = "0.8.2" ``` 失败时给出位置与两侧的值(`expected 2, actual 3`)。在运行器之下,同一程序按协议报告;单独运行时每个用例输出一行。 diff --git a/adapters/gtest/mcpp.toml b/adapters/gtest/mcpp.toml index f4a187e..d4b9e0e 100644 --- a/adapters/gtest/mcpp.toml +++ b/adapters/gtest/mcpp.toml @@ -13,7 +13,7 @@ [package] namespace = "mcpplibs.mtest" name = "gtest" -version = "0.8.1" +version = "0.8.2" description = "GoogleTest speaking the mtest protocol: a test main that lists, selects and reports GoogleTest's cases" license = "Apache-2.0" diff --git a/adapters/gtest/src/protocol.cpp b/adapters/gtest/src/protocol.cpp index d939a09..7ce7423 100644 --- a/adapters/gtest/src/protocol.cpp +++ b/adapters/gtest/src/protocol.cpp @@ -128,7 +128,7 @@ int mcpplibs_mtest_gtest_main(int argc, char** argv) { {"protocol", 1}, {"level", 1}, {"framework", "googletest"}, - {"version", "0.8.1"}, + {"version", "0.8.2"}, {"isolation", {"process", "case"}}, {"guide", "https://github.com/mcpp-community/mtest/blob/main/adapters/gtest/docs/" "writing-tests.md"}}); diff --git a/capi/mcpp.toml b/capi/mcpp.toml index a05631d..f4209da 100644 --- a/capi/mcpp.toml +++ b/capi/mcpp.toml @@ -4,7 +4,7 @@ [package] namespace = "mcpplibs.mtest" name = "capi" -version = "0.8.1" +version = "0.8.2" description = "mtest's C ABI: the protocol's events for any language with a C FFI" license = "Apache-2.0" diff --git a/capi/src/mtest.cpp b/capi/src/mtest.cpp index 9f3c578..66e4883 100644 --- a/capi/src/mtest.cpp +++ b/capi/src/mtest.cpp @@ -120,7 +120,7 @@ void mtest_init(const char* framework, int level) { {"protocol", 1}, {"level", std::clamp(level, 1, 3)}, {"framework", text(framework)}, - {"version", "0.8.1"}, + {"version", "0.8.2"}, {"isolation", {"process", "case"}}}); } diff --git a/conformance/mcpp.toml b/conformance/mcpp.toml index 446454b..86e302a 100644 --- a/conformance/mcpp.toml +++ b/conformance/mcpp.toml @@ -8,7 +8,7 @@ [package] namespace = "mcpplibs.mtest" name = "conformance" -version = "0.8.1" +version = "0.8.2" description = "The conformance suite of the mtest protocol, for every implementation of its program side" license = "Apache-2.0" diff --git a/engine/mcpp.toml b/engine/mcpp.toml index 4c4240a..d4805c6 100644 --- a/engine/mcpp.toml +++ b/engine/mcpp.toml @@ -10,7 +10,7 @@ [package] namespace = "mtest" name = "mtest" -version = "0.8.1" +version = "0.8.2" description = "The mtest engine: run, schedule, store, explain and analyse tests of any language" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/engine/src/commands.cpp b/engine/src/commands.cpp index 458dd6d..ba6f81b 100644 --- a/engine/src/commands.cpp +++ b/engine/src/commands.cpp @@ -1958,7 +1958,7 @@ json catalog() { plain({{"out", {{"type", "string"}}}, {"argv", {{"type", "array"}, {"items", {{"type", "string"}}}}}}), true); - return {{"schema", "mtest.catalog/1"}, {"version", "0.8.1"}, {"tools", tools}}; + return {{"schema", "mtest.catalog/1"}, {"version", "0.8.2"}, {"tools", tools}}; } } // namespace mcpplibs::mtest::engine diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 37085bc..d2f0ffe 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -98,7 +98,7 @@ const json* tool_named(const json& tools, std::string_view name) { cmdline::App application(const json& tools) { auto app = cmdline::App("mtest") - .version("0.8.1") + .version("0.8.2") .description("run tests of any language, and ask about their runs") .option(cmdline::Option("json").global().help("print the answer's data")); for (const auto& t : tools) @@ -253,7 +253,7 @@ int main(int argc, char** argv) { const std::string name(parsed->subcommand_name()); const auto& sub = parsed->subcommand()->get(); if (name == "version") { - std::println("mtest 0.8.1"); + std::println("mtest 0.8.2"); return 0; } const auto cwd = std::filesystem::current_path(); diff --git a/engine/src/service.cpp b/engine/src/service.cpp index 19aa0ff..a7ba5ef 100644 --- a/engine/src/service.cpp +++ b/engine/src/service.cpp @@ -56,7 +56,7 @@ int serve(const std::filesystem::path& cwd) { {"result", {{"protocolVersion", params.value("protocolVersion", std::string("2025-06-18"))}, {"capabilities", {{"tools", {{"listChanged", false}}}}}, - {"serverInfo", {{"name", "mtest"}, {"version", "0.8.1"}}}, + {"serverInfo", {{"name", "mtest"}, {"version", "0.8.2"}}}, {"instructions", "Run tests and ask about runs: run, plan, explain, history, analyze, graph, " "gate, ci. A test session (test/plan, test/run, test/add, test/cancel, " diff --git a/lib/docs/writing-tests.md b/lib/docs/writing-tests.md index a1b4956..11a852f 100644 --- a/lib/docs/writing-tests.md +++ b/lib/docs/writing-tests.md @@ -53,7 +53,7 @@ E2E cli{"cli", resource{"serial:home"}, timeout{std::chrono::minutes{2}}, [] { / The entry enters the child before any case; the copy runs no case and reports nothing. The files of one directory are then one program (mcpp `[test] programs = "directory"`) however many of them start copies. -- The manifest names the library once: `[dev-dependencies] mcpplibs.mtest = "0.8.1"`. +- The manifest names the library once: `[dev-dependencies] mcpplibs.mtest = "0.8.2"`. - Identifiers are stable: a selection, a history and a shard name a case by them. ## Expectations diff --git a/lib/mcpp.toml b/lib/mcpp.toml index 43d0035..7ecf76f 100644 --- a/lib/mcpp.toml +++ b/lib/mcpp.toml @@ -17,7 +17,7 @@ [package] namespace = "mcpplibs" name = "mtest" -version = "0.8.1" +version = "0.8.2" description = "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 protocol" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/lib/src/mtest.cpp b/lib/src/mtest.cpp index ce6c547..1bc2d31 100644 --- a/lib/src/mtest.cpp +++ b/lib/src/mtest.cpp @@ -324,7 +324,7 @@ void write_program() { {"protocol", 1}, {"level", 3}, {"framework", "mcpplibs.mtest"}, - {"version", "0.8.1"}, + {"version", "0.8.2"}, {"isolation", {"process", "case"}}, {"guide", "https://github.com/mcpp-community/mtest/blob/main/lib/docs/writing-tests.md"}}); } diff --git a/lib/tests/companions.cpp b/lib/tests/companions.cpp index 5f9511f..16f7af8 100644 --- a/lib/tests/companions.cpp +++ b/lib/tests/companions.cpp @@ -92,12 +92,20 @@ int main(int argc, char** argv) { eq(d.values[0].min, 922.0)); expect(eq(d.values[1].calls, std::size_t(10)) && eq(d.values[1].mean, 11.0)) << "over the calls that said it"; - expect(eq(d.slowest.size(), std::size_t(2)) && eq(d.slowest[0].index, std::size_t(7)) && - eq(d.slowest[0].said, std::string("zoom 0.43")) && + // Which calls a loaded machine slows is not this test's to say: each stated call + // carries what that call said, the slowest first. + expect(eq(d.slowest.size(), std::size_t(2)) && ge(d.slowest[0].seconds, d.slowest[1].seconds)); - expect(eq(d.slowest[0].parts.size(), std::size_t(2)) && - ge(d.slowest[0].parts[0].second, 0.0009) && - eq(d.slowest[0].values[0].second, 24570.0)); + for (const bench::slow_call& c : d.slowest) { + const bool slow = c.index == 7; + expect(eq(c.parts.size(), std::size_t(2)) && eq(c.parts[1].second, 0.00005)) + << c.index; + expect(eq(c.values[0].second, slow ? 24570.0 : 922.0) && + eq(c.said, std::string(slow ? "zoom 0.43" : ""))) + << c.index; + expect(eq(c.values.size(), std::size_t(c.index % 2 == 0 ? 2 : 1))) + << "the calls of an even turn said lists"; + } }; "a limit a call: how many passed it, and those are the ones stated; a body ends the run"_test [kind::bench] = [] { @@ -119,10 +127,14 @@ int main(int argc, char** argv) { .warmup = 0, .limit = std::chrono::microseconds{400}}); expect(eq(calls, std::size_t(12)) && eq(d.samples.size(), std::size_t(12))); - expect(eq(d.over, std::size_t(2)) && eq(d.slowest.size(), std::size_t(2)) && - eq(d.limit, 0.0004)); - const std::array late{d.slowest[0].index, d.slowest[1].index}; - expect((late[0] == 4 && late[1] == 9) || (late[0] == 9 && late[1] == 4)); + // The two that spun past the limit are over it, and stated; a loaded machine may put + // others over. + expect(ge(d.over, std::size_t(2)) && + eq(d.slowest.size(), std::min(d.over, 8)) && eq(d.limit, 0.0004)); + if (d.over <= 8) + for (std::size_t late : {std::size_t(4), std::size_t(9)}) + expect(std::ranges::contains(d.slowest, late, &bench::slow_call::index)) + << late; }; "calls that say nothing keep nothing"_test[kind::bench] = [] { auto d = bench::each("quiet", [](bench::lap&) {}, diff --git a/manifest/mcpp.toml b/manifest/mcpp.toml index 8fb71f5..552edd4 100644 --- a/manifest/mcpp.toml +++ b/manifest/mcpp.toml @@ -8,7 +8,7 @@ [package] namespace = "mcpplibs.mtest" name = "manifest" -version = "0.8.1" +version = "0.8.2" description = "The static case manifest of mtest: the cases a source file declares, read without building it" license = "Apache-2.0" authors = ["mcpp-community"]