renamed basic_types enumerations

This commit is contained in:
2025-12-08 20:04:04 +01:00
parent d4ef97ef5a
commit 108eca4e53
26 changed files with 302 additions and 302 deletions
+12 -12
View File
@@ -22,15 +22,15 @@ TEST_CASE("Generate column definitions from object", "[column][definition][gener
auto columns = attribute_generator::generate<matador::test::product>(repo, obj);
const std::vector expected_columns = {
attribute{"product_name", basic_type::type_varchar, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"supplier_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"category_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"quantity_per_unit", basic_type::type_varchar, null_attributes, null_option_type::NotNull },
attribute{"unit_price", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"units_in_stock", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"units_in_order", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"reorder_level", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"discontinued", basic_type::type_bool, null_attributes, null_option_type::NotNull }
attribute{"product_name", basic_type::Varchar, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"supplier_id", basic_type::UInt32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"category_id", basic_type::UInt32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"quantity_per_unit", basic_type::Varchar, null_attributes, null_option_type::NotNull },
attribute{"unit_price", basic_type::UInt32, null_attributes, null_option_type::NotNull },
attribute{"units_in_stock", basic_type::UInt32, null_attributes, null_option_type::NotNull },
attribute{"units_in_order", basic_type::UInt32, null_attributes, null_option_type::NotNull },
attribute{"reorder_level", basic_type::UInt32, null_attributes, null_option_type::NotNull },
attribute{"discontinued", basic_type::Boolean, null_attributes, null_option_type::NotNull }
};
REQUIRE(!columns.empty());
REQUIRE(columns.size() == expected_columns.size());
@@ -49,9 +49,9 @@ TEST_CASE("Generate columns from object with nullable columns", "[column generat
auto columns = attribute_generator::generate<matador::test::optional>(repo, obj);
const std::vector expected_columns = {
attribute{"id", basic_type::type_uint32, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"name", basic_type::type_varchar, null_attributes, null_option_type::NotNull },
attribute{"age", basic_type::type_uint32, null_attributes, null_option_type::NotNull }
attribute{"id", basic_type::UInt32, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"name", basic_type::Varchar, null_attributes, null_option_type::NotNull },
attribute{"age", basic_type::UInt32, null_attributes, null_option_type::NotNull }
};
REQUIRE(!columns.empty());
REQUIRE(columns.size() == expected_columns.size());
+20 -20
View File
@@ -5,24 +5,24 @@
using namespace matador::utils;
TEST_CASE("Test default data types", "[data_types][type]") {
REQUIRE(data_type_traits<int8_t>::type() == basic_type::type_int8);
REQUIRE(data_type_traits<int16_t>::type() == basic_type::type_int16);
REQUIRE(data_type_traits<int32_t>::type() == basic_type::type_int32);
REQUIRE(data_type_traits<int64_t>::type() == basic_type::type_int64);
REQUIRE(data_type_traits<uint8_t>::type() == basic_type::type_uint8);
REQUIRE(data_type_traits<uint16_t>::type() == basic_type::type_uint16);
REQUIRE(data_type_traits<uint32_t>::type() == basic_type::type_uint32);
REQUIRE(data_type_traits<uint64_t>::type() == basic_type::type_uint64);
REQUIRE(data_type_traits<bool>::type() == basic_type::type_bool);
REQUIRE(data_type_traits<float>::type() == basic_type::type_float);
REQUIRE(data_type_traits<double>::type() == basic_type::type_double);
REQUIRE(data_type_traits<const char*>::type(32) == basic_type::type_varchar);
REQUIRE(data_type_traits<const char*>::type(0) == basic_type::type_text);
REQUIRE(data_type_traits<char*>::type(32) == basic_type::type_varchar);
REQUIRE(data_type_traits<char*>::type(0) == basic_type::type_text);
REQUIRE(data_type_traits<char[]>::type(32) == basic_type::type_varchar);
REQUIRE(data_type_traits<char[]>::type(0) == basic_type::type_text);
REQUIRE(data_type_traits<std::string>::type(32) == basic_type::type_varchar);
REQUIRE(data_type_traits<std::string>::type(0) == basic_type::type_text);
REQUIRE(data_type_traits<blob>::type(0) == basic_type::type_blob);
REQUIRE(data_type_traits<int8_t>::type() == basic_type::Int8);
REQUIRE(data_type_traits<int16_t>::type() == basic_type::Int16);
REQUIRE(data_type_traits<int32_t>::type() == basic_type::Int32);
REQUIRE(data_type_traits<int64_t>::type() == basic_type::Int64);
REQUIRE(data_type_traits<uint8_t>::type() == basic_type::UInt8);
REQUIRE(data_type_traits<uint16_t>::type() == basic_type::UInt16);
REQUIRE(data_type_traits<uint32_t>::type() == basic_type::UInt32);
REQUIRE(data_type_traits<uint64_t>::type() == basic_type::UInt64);
REQUIRE(data_type_traits<bool>::type() == basic_type::Boolean);
REQUIRE(data_type_traits<float>::type() == basic_type::Float);
REQUIRE(data_type_traits<double>::type() == basic_type::Double);
REQUIRE(data_type_traits<const char*>::type(32) == basic_type::Varchar);
REQUIRE(data_type_traits<const char*>::type(0) == basic_type::Text);
REQUIRE(data_type_traits<char*>::type(32) == basic_type::Varchar);
REQUIRE(data_type_traits<char*>::type(0) == basic_type::Text);
REQUIRE(data_type_traits<char[]>::type(32) == basic_type::Varchar);
REQUIRE(data_type_traits<char[]>::type(0) == basic_type::Text);
REQUIRE(data_type_traits<std::string>::type(32) == basic_type::Varchar);
REQUIRE(data_type_traits<std::string>::type(0) == basic_type::Text);
REQUIRE(data_type_traits<blob>::type(0) == basic_type::Blob);
}
+1 -1
View File
@@ -33,7 +33,7 @@ TEST_CASE("Test assign value to identifier", "[identifier][assign]") {
REQUIRE(id.is_valid());
REQUIRE(id.is_integer());
REQUIRE(id.str() == "7");
REQUIRE(id.type() == basic_type::type_int32);
REQUIRE(id.type() == basic_type::Int32);
REQUIRE(id.type_index() == std::type_index(typeid(int)));
id = std::string{"UniqueId"};