removed the value field from attribute_definition because it's a definition and should not hold a value.

This commit is contained in:
Sascha Kühl
2025-11-17 13:16:18 +01:00
parent d1731a7f15
commit 9ffcee1317
10 changed files with 53 additions and 105 deletions
+3 -13
View File
@@ -13,15 +13,11 @@ TEST_CASE("Test create empty column", "[column]") {
REQUIRE(c.type() == basic_type::type_null);
REQUIRE(!c.reference_column());
c.set(std::string{"george"}, 255);
c.change_type<std::string>(255);
REQUIRE(c.type() == basic_type::type_varchar);
REQUIRE(c.as<std::string>() == "george");
c.set(7);
c.change_type<int32_t>(7);
REQUIRE(c.type() == basic_type::type_int32);
REQUIRE(c.as<std::string>() == "7");
REQUIRE(c.as<int>() == 7);
REQUIRE(c.str() == "7");
}
TEST_CASE("Test copy and move column", "[column]") {
@@ -30,17 +26,15 @@ TEST_CASE("Test copy and move column", "[column]") {
basic_type::type_varchar,
2,
std::make_shared<attribute_definition>("author", "books", basic_type::type_uint32, constraints::FOREIGN_KEY),
constraints::FOREIGN_KEY,
{255, constraints::FOREIGN_KEY},
null_option::NOT_NULL
);
c.set(std::string{"george"}, 255);
REQUIRE(c.name() == "name");
REQUIRE(c.index() == 2);
REQUIRE(c.reference_column());
REQUIRE(c.reference_column()->name() == "author");
REQUIRE(c.reference_column()->table_name() == "books");
REQUIRE(c.type() == basic_type::type_varchar);
REQUIRE(c.as<std::string>() == "george");
REQUIRE(c.attributes().size() == 255);
auto c2 = c;
@@ -50,7 +44,6 @@ TEST_CASE("Test copy and move column", "[column]") {
REQUIRE(c2.reference_column()->name() == "author");
REQUIRE(c2.reference_column()->table_name() == "books");
REQUIRE(c2.type() == basic_type::type_varchar);
REQUIRE(c2.as<std::string>() == "george");
REQUIRE(c2.attributes().size() == 255);
auto c3 = std::move(c2);
@@ -60,13 +53,10 @@ TEST_CASE("Test copy and move column", "[column]") {
REQUIRE(c3.reference_column()->name() == "author");
REQUIRE(c3.reference_column()->table_name() == "books");
REQUIRE(c3.type() == basic_type::type_varchar);
REQUIRE(c3.as<std::string>() == "george");
REQUIRE(c3.attributes().size() == 255);
REQUIRE(c2.name().empty());
REQUIRE(c2.index() == 2);
REQUIRE(!c2.reference_column());
REQUIRE(c2.type() == basic_type::type_null);
// REQUIRE(!c2.as<std::string>().has_value());
REQUIRE(c2.attributes().size() == 255);
}