Enhanced some test descriptions

This commit is contained in:
sascha 2026-07-06 16:06:09 +02:00
parent 89b795c488
commit 06f6166f05
5 changed files with 43 additions and 43 deletions

View File

@ -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};

View File

@ -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<test::author>("authors");

View File

@ -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<int32_t>();
@ -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<std::string>();
@ -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<int32_t>();
@ -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<int64_t>();
@ -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<uint8_t>();
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<uint32_t>();
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<int32_t>();
@ -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<int32_t>();
@ -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<uint64_t>();
@ -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<std::nullptr_t>(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<int32_t>(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<uint64_t>(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();

View File

@ -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<Receiver>();
@ -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<int> counter{0};
constexpr int numThreads = 8;

View File

@ -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<std::future<int>> 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<std::future<void>> futs;