Enhanced some test descriptions
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user