TEST(MakeDescriptionOfDescriptionTest, TimestampTypes) { SQLSMALLINT const type = SQL_TYPE_TIMESTAMP; cpp_odbc::column_description column_description = {name, type, 0, 0, supports_null_values}; auto const description = make_description(column_description); ASSERT_TRUE(dynamic_cast<turbodbc::timestamp_description const *>(description.get())); assert_custom_name_and_nullable_support(*description); }
TEST(MakeDescriptionOfTypeTest, FromUnicodeProvidesExtraSpaceForLargeStrings) { std::string large_string("this is a relatively large string"); auto description = make_description(type_code::unicode, large_string.size()); auto as_unicode_description = dynamic_cast<turbodbc::unicode_description const *>(description.get()); ASSERT_TRUE( as_unicode_description != nullptr ); EXPECT_GT(as_unicode_description->element_size(), 2 * (large_string.size() + 1)); }
TEST(MakeDescriptionOfDescriptionTest, BitType) { SQLSMALLINT const type = SQL_BIT; cpp_odbc::column_description column_description = {name, type, 0, 0, supports_null_values}; auto const description = make_description(column_description); ASSERT_TRUE(dynamic_cast<turbodbc::boolean_description const *>(description.get())); assert_custom_name_and_nullable_support(*description); }
TEST(MakeDescriptionOfTypeTest, FromUnicodeProvidesMinimumLength) { std::size_t const small_size = 2; auto description = make_description(type_code::unicode, small_size); auto as_unicode_description = dynamic_cast<turbodbc::unicode_description const *>(description.get()); ASSERT_TRUE( as_unicode_description != nullptr ); std::size_t const minimum_length = 10; EXPECT_EQ(as_unicode_description->element_size(), 2 * (minimum_length + 1)); }
TEST(MakeDescriptionOfTypeTest, FromTimestamp) { auto description = make_description(type_code::timestamp, size_not_important); ASSERT_TRUE( dynamic_cast<turbodbc::timestamp_description const *>(description.get()) ); }
TEST(MakeDescriptionOfTypeTest, FromBool) { auto description = make_description(type_code::boolean, size_not_important); ASSERT_TRUE( dynamic_cast<turbodbc::boolean_description const *>(description.get()) ); }
TEST(MakeDescriptionOfTypeTest, FromDouble) { auto description = make_description(type_code::floating_point, size_not_important); ASSERT_TRUE( dynamic_cast<turbodbc::floating_point_description const *>(description.get()) ); }