From 06f6166f051e17a75a5777486e4f3c1825b44313 Mon Sep 17 00:00:00 2001 From: sascha Date: Mon, 6 Jul 2026 16:06:09 +0200 Subject: [PATCH] Enhanced some test descriptions --- test/core/object/ObjectCacheTest.cpp | 6 ++-- test/core/object/ObjectTest.cpp | 2 +- test/core/utils/IdentifierTest.cpp | 50 ++++++++++++++-------------- test/core/utils/MessageBusTest.cpp | 16 ++++----- test/core/utils/ThreadPoolTest.cpp | 12 +++---- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/test/core/object/ObjectCacheTest.cpp b/test/core/object/ObjectCacheTest.cpp index d8b951b..5452536 100644 --- a/test/core/object/ObjectCacheTest.cpp +++ b/test/core/object/ObjectCacheTest.cpp @@ -59,7 +59,7 @@ private: }; } // namespace -TEST_CASE("object_cache: acquire_proxy returns the same proxy instance across threads", "[object][cache][threadsafe]") { +TEST_CASE("ObjectCache: acquire_proxy returns the same proxy instance across threads", "[object][cache][threadsafe]") { matador::utils::message_bus bus; matador::object::object_cache cache(bus); const matador::utils::identifier id{123}; @@ -91,7 +91,7 @@ TEST_CASE("object_cache: acquire_proxy returns the same proxy instance across th } } -TEST_CASE("object_cache: attach_entity makes is_loaded/get_entity reflect presence", "[object][cache]") { +TEST_CASE("ObjectCache: attach_entity makes is_loaded/get_entity reflect presence", "[object][cache]") { matador::utils::message_bus bus; matador::object::object_cache cache(bus); const matador::utils::identifier id{42}; @@ -110,7 +110,7 @@ TEST_CASE("object_cache: attach_entity makes is_loaded/get_entity reflect presen REQUIRE(got->name == "hans"); } -TEST_CASE("object_cache: erase invalidates existing proxies", "[object][cache]") { +TEST_CASE("ObjectCache: erase invalidates existing proxies", "[object][cache]") { matador::utils::message_bus bus; matador::object::object_cache cache(bus); const matador::utils::identifier id{9}; diff --git a/test/core/object/ObjectTest.cpp b/test/core/object/ObjectTest.cpp index 1cf6050..a1702e3 100644 --- a/test/core/object/ObjectTest.cpp +++ b/test/core/object/ObjectTest.cpp @@ -7,7 +7,7 @@ #include "../test/models/author.hpp" #include "../test/models/book.hpp" -TEST_CASE("Generate object from type", "[object][generate]") { +TEST_CASE("Object: Generate object from type", "[object][generate]") { using namespace matador; object::repository repo; auto result = repo.attach("authors"); diff --git a/test/core/utils/IdentifierTest.cpp b/test/core/utils/IdentifierTest.cpp index 4d746f4..f3114a9 100644 --- a/test/core/utils/IdentifierTest.cpp +++ b/test/core/utils/IdentifierTest.cpp @@ -6,7 +6,7 @@ using namespace matador::utils; -TEST_CASE("Test create identifier", "[identifier][create]") { +TEST_CASE("Identifier: Test create identifier", "[identifier][create]") { const identifier id; REQUIRE(id.is_null()); @@ -16,7 +16,7 @@ TEST_CASE("Test create identifier", "[identifier][create]") { REQUIRE(id.str() == "null"); } -TEST_CASE("Test assign value to identifier", "[identifier][assign]") { +TEST_CASE("Identifier: Test assign value to identifier", "[identifier][assign]") { identifier id; REQUIRE(id.is_null()); @@ -48,7 +48,7 @@ TEST_CASE("Test assign value to identifier", "[identifier][assign]") { // REQUIRE(id == identifier{"UniqueId"}); } -TEST_CASE("Test compare identifier", "[identifier][compare]") { +TEST_CASE("Identifier: Test compare identifier", "[identifier][compare]") { identifier id1{6}, id2{7}; REQUIRE(id1 != id2); @@ -68,7 +68,7 @@ identifier create(const int id) { return identifier{id}; } -TEST_CASE("Test copy identifier" "[identifier][copy]") { +TEST_CASE("Identifier: Test copy identifier" "[identifier][copy]") { identifier id1{"Unique"}; REQUIRE(id1.is_valid()); REQUIRE(id1.str() == "Unique"); @@ -92,7 +92,7 @@ TEST_CASE("Test copy identifier" "[identifier][copy]") { id3 = id1; } -TEST_CASE("Test move identifier", "[identifier][move]") { +TEST_CASE("Identifier: Test move identifier", "[identifier][move]") { identifier id1{6}; REQUIRE(id1.is_integer()); @@ -103,7 +103,7 @@ TEST_CASE("Test move identifier", "[identifier][move]") { REQUIRE(id2.is_integer()); } -TEST_CASE("identifier assignment from integer types", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assignment from integer types", "[utils][identifier][assign]") { identifier id; id = int8_t{-5}; @@ -125,7 +125,7 @@ TEST_CASE("identifier assignment from integer types", "[utils][identifier][assig REQUIRE(id.is_valid()); } -TEST_CASE("identifier assignment from string type", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assignment from string type", "[utils][identifier][assign]") { identifier id; id = std::string{"hello"}; @@ -140,7 +140,7 @@ TEST_CASE("identifier assignment from string type", "[utils][identifier][assign] REQUIRE_FALSE(id.is_valid()); } -TEST_CASE("identifier assignment from const char*", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assignment from const char*", "[utils][identifier][assign]") { identifier id; id = "world"; @@ -155,7 +155,7 @@ TEST_CASE("identifier assignment from const char*", "[utils][identifier][assign] REQUIRE_FALSE(id.is_valid()); } -TEST_CASE("identifier assignment from nullptr", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assignment from nullptr", "[utils][identifier][assign]") { identifier id{42}; REQUIRE(id.is_valid()); @@ -168,7 +168,7 @@ TEST_CASE("identifier assignment from nullptr", "[utils][identifier][assign]") { REQUIRE_FALSE(id.is_valid()); } -TEST_CASE("identifier reassignment between types", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier reassignment between types", "[utils][identifier][assign]") { identifier id{uint64_t{7}}; REQUIRE(id.is_integer()); @@ -189,7 +189,7 @@ TEST_CASE("identifier reassignment between types", "[utils][identifier][assign]" REQUIRE(id.str() == "null"); } -TEST_CASE("identifier as() returns exact integer type", "[utils][identifier][as]") { +TEST_CASE("Identifier: Identifier as() returns exact integer type", "[utils][identifier][as]") { identifier id{int32_t{42}}; const auto as_i32 = id.as(); @@ -200,7 +200,7 @@ TEST_CASE("identifier as() returns exact integer type", "[utils][identifier][as] REQUIRE(as_i64.is_error()); } -TEST_CASE("identifier as() returns exact string type", "[utils][identifier][as]") { +TEST_CASE("Identifier: Identifier as() returns exact string type", "[utils][identifier][as]") { identifier id{std::string{"hello"}}; const auto as_string = id.as(); @@ -211,7 +211,7 @@ TEST_CASE("identifier as() returns exact string type", "[utils][identifier][as]" REQUIRE(as_i32.is_error()); } -TEST_CASE("identifier as() returns null type failure for null identifier", "[utils][identifier][as]") { +TEST_CASE("Identifier: Identifier as() returns null type failure for null identifier", "[utils][identifier][as]") { identifier id{nullptr}; const auto as_i32 = id.as(); @@ -221,7 +221,7 @@ TEST_CASE("identifier as() returns null type failure for null identifier", "[uti REQUIRE(as_string.is_error()); } -TEST_CASE("identifier convert() converts between integer types", "[utils][identifier][convert]") { +TEST_CASE("Identifier: Identifier convert() converts between integer types", "[utils][identifier][convert]") { identifier id{int32_t{123}}; const auto as_i64 = id.convert(); @@ -233,21 +233,21 @@ TEST_CASE("identifier convert() converts between integer types", "[utils][identi REQUIRE(*as_u8 == 123); } -TEST_CASE("identifier convert() rejects out of range integer conversion", "[utils][identifier][convert]") { +TEST_CASE("Identifier: Identifier convert() rejects out of range integer conversion", "[utils][identifier][convert]") { identifier id{int32_t{300}}; const auto as_u8 = id.convert(); REQUIRE(as_u8.is_error()); } -TEST_CASE("identifier convert() rejects negative to unsigned conversion", "[utils][identifier][convert]") { +TEST_CASE("Identifier: Identifier convert() rejects negative to unsigned conversion", "[utils][identifier][convert]") { identifier id{int32_t{-1}}; const auto as_u32 = id.convert(); REQUIRE(as_u32.is_error()); } -TEST_CASE("identifier convert() rejects non-integer source types", "[utils][identifier][convert]") { +TEST_CASE("Identifier: Identifier convert() rejects non-integer source types", "[utils][identifier][convert]") { identifier id{std::string{"123"}}; const auto as_i32 = id.convert(); @@ -258,7 +258,7 @@ TEST_CASE("identifier convert() rejects non-integer source types", "[utils][iden REQUIRE(null_to_i64.is_error()); } -TEST_CASE("identifier convert() works with unsigned integer sources", "[utils][identifier][convert]") { +TEST_CASE("Identifier: Identifier convert() works with unsigned integer sources", "[utils][identifier][convert]") { identifier id{uint16_t{500}}; const auto as_i32 = id.convert(); @@ -269,7 +269,7 @@ TEST_CASE("identifier convert() works with unsigned integer sources", "[utils][i REQUIRE(as_u8.is_error()); } -TEST_CASE("identifier as() and convert() behave consistently for same integer type", "[utils][identifier][as][convert]") { +TEST_CASE("Identifier: Identifier as() and convert() behave consistently", "[utils][identifier][as][convert]") { identifier id{uint64_t{77}}; const auto as_u64 = id.as(); @@ -281,7 +281,7 @@ TEST_CASE("identifier as() and convert() behave consistently for same integer ty REQUIRE(*conv_u64 == 77); } -TEST_CASE("identifier assign from value", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assign from value", "[utils][identifier][assign]") { identifier id; value v1{int32_t{17}}; @@ -301,7 +301,7 @@ TEST_CASE("identifier assign from value", "[utils][identifier][assign]") { REQUIRE(r3.is_error()); } -TEST_CASE("identifier assign from value with exact type mapping", "[utils][identifier][assign]") { +TEST_CASE("Identifier: Identifier assign from value with exact type mapping", "[utils][identifier][assign]") { identifier id; SECTION("integer types") { @@ -328,7 +328,7 @@ TEST_CASE("identifier assign from value with exact type mapping", "[utils][ident } } -TEST_CASE("identifier::to_database_type converts internal value to database_type", "[identifier]") { +TEST_CASE("Identifier: Identifier::to_database_type converts internal value", "[identifier][to_database_type]") { SECTION("null identifier becomes nullptr") { identifier id{nullptr}; @@ -337,7 +337,7 @@ TEST_CASE("identifier::to_database_type converts internal value to database_type REQUIRE(std::holds_alternative(db_value)); } - SECTION("signed integral identifier becomes same signed database type") { + SECTION("Identifier: Signed integral identifier becomes same signed database type") { identifier id{int32_t{42}}; const auto db_value = id.to_database_type(); @@ -346,7 +346,7 @@ TEST_CASE("identifier::to_database_type converts internal value to database_type REQUIRE(std::get(db_value) == 42); } - SECTION("unsigned integral identifier becomes same unsigned database type") { + SECTION("Identifier: Unsigned integral identifier becomes same unsigned database type") { identifier id{uint64_t{123456789ULL}}; const auto db_value = id.to_database_type(); @@ -355,7 +355,7 @@ TEST_CASE("identifier::to_database_type converts internal value to database_type REQUIRE(std::get(db_value) == 123456789ULL); } - SECTION("string identifier becomes std::string database type") { + SECTION("Identifier: String identifier becomes std::string database type") { identifier id{std::string{"customer_1"}}; const auto db_value = id.to_database_type(); diff --git a/test/core/utils/MessageBusTest.cpp b/test/core/utils/MessageBusTest.cpp index 9282a83..3fce58b 100644 --- a/test/core/utils/MessageBusTest.cpp +++ b/test/core/utils/MessageBusTest.cpp @@ -18,7 +18,7 @@ public: using namespace matador::utils; -TEST_CASE("Basic publish/subscribe works", "[MessageBus]") { +TEST_CASE("MessageBus: Basic publish/subscribe works", "[MessageBus]") { message_bus bus; int counter = 0; @@ -32,7 +32,7 @@ TEST_CASE("Basic publish/subscribe works", "[MessageBus]") { REQUIRE(counter == 3); } -TEST_CASE("Filtering works", "[MessageBus]") { +TEST_CASE("MessageBus: Filtering works", "[MessageBus]") { message_bus bus; int counter = 0; @@ -49,7 +49,7 @@ TEST_CASE("Filtering works", "[MessageBus]") { REQUIRE(counter == 6); // only 2 + 4 } -TEST_CASE("Member function subscription works", "[MessageBus]") { +TEST_CASE("MessageBus: Member function subscription works", "[MessageBus]") { message_bus bus; Receiver r; @@ -62,7 +62,7 @@ TEST_CASE("Member function subscription works", "[MessageBus]") { REQUIRE(r.received[1] == "world"); } -TEST_CASE("Shared_ptr instance subscription works", "[MessageBus]") { +TEST_CASE("MessageBus: SharedPtr instance subscription works", "[MessageBus]") { message_bus bus; const auto r = std::make_shared(); @@ -73,7 +73,7 @@ TEST_CASE("Shared_ptr instance subscription works", "[MessageBus]") { REQUIRE(r->received[0] == "foo"); } -TEST_CASE("RAII unsubscription works", "[MessageBus]") { +TEST_CASE("MessageBus: RAII unsubscription works", "[MessageBus]") { message_bus bus; int counter = 0; @@ -90,7 +90,7 @@ TEST_CASE("RAII unsubscription works", "[MessageBus]") { REQUIRE(counter == 5); } -TEST_CASE("Type-erased AnyMessage publish works", "[MessageBus]") { +TEST_CASE("MessageBus: Type-erased AnyMessage publish works", "[MessageBus]") { message_bus bus; int counter = 0; @@ -104,7 +104,7 @@ TEST_CASE("Type-erased AnyMessage publish works", "[MessageBus]") { REQUIRE(counter == 10); } -TEST_CASE("Multiple subscribers all receive messages", "[MessageBus]") { +TEST_CASE("MessageBus: Multiple subscribers all receive messages", "[MessageBus]") { message_bus bus; int a = 0, b = 0; @@ -116,7 +116,7 @@ TEST_CASE("Multiple subscribers all receive messages", "[MessageBus]") { REQUIRE(b == 3); } -TEST_CASE("Stress test with multi-threaded publish and subscribe", "[MessageBus][stress]") { +TEST_CASE("MessageBus: Stress test with multi-threaded publish and subscribe", "[MessageBus][stress]") { message_bus bus; std::atomic counter{0}; constexpr int numThreads = 8; diff --git a/test/core/utils/ThreadPoolTest.cpp b/test/core/utils/ThreadPoolTest.cpp index 9acf3da..8bffa87 100644 --- a/test/core/utils/ThreadPoolTest.cpp +++ b/test/core/utils/ThreadPoolTest.cpp @@ -4,21 +4,21 @@ using namespace matador::utils; -TEST_CASE("thread_pool creates and rejects zero-sized construction") { +TEST_CASE("ThreadPool: thread_pool creates and rejects zero-sized construction") { REQUIRE_THROWS(thread_pool(0)); const thread_pool tp(2); REQUIRE(tp.size() == 2); } -TEST_CASE("thread_pool schedules and runs simple tasks") { +TEST_CASE("ThreadPool: thread_pool schedules and runs simple tasks") { thread_pool pool(3); auto fut = pool.schedule([](cancel_token&, const int x) { return x * 10; }, 7); REQUIRE(fut); REQUIRE(fut.value().get() == 70); } -TEST_CASE("thread_pool parallel computation and results") { +TEST_CASE("ThreadPool: thread_pool parallel computation and results") { thread_pool pool(4); std::vector> futs; for (int i = 1; i <= 20; ++i) { @@ -33,7 +33,7 @@ TEST_CASE("thread_pool parallel computation and results") { REQUIRE(sum == 230); // (2+3+...+21) = (21*22/2)-(1) = 231-1 } -TEST_CASE("thread_pool rejects scheduling after shutdown") { +TEST_CASE("ThreadPool: thread_pool rejects scheduling after shutdown") { thread_pool pool(2); pool.shutdown(); auto result = pool.schedule([](cancel_token&) { return 1; }); @@ -41,7 +41,7 @@ TEST_CASE("thread_pool rejects scheduling after shutdown") { REQUIRE(result.err().find("shut down") != std::string::npos); } -TEST_CASE("thread_pool supports cancel_token for not-yet-run task") { +TEST_CASE("ThreadPool: thread_pool supports cancel_token for not-yet-run task") { thread_pool pool(1); std::atomic ran{false}; @@ -73,7 +73,7 @@ TEST_CASE("thread_pool supports cancel_token for not-yet-run task") { // If started before cancel, may be 100 (rare but possible) } -TEST_CASE("thread_pool: shutdown finishes all running tasks") { +TEST_CASE("ThreadPool: thread_pool: shutdown finishes all running tasks") { thread_pool pool(2); std::atomic counter{0}; std::vector> futs;