0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Added some tvin-tests

This commit is contained in:
rbock 2014-07-29 18:18:57 +02:00
parent c818e110b6
commit a62c660ad5

View File

@ -389,5 +389,20 @@ int main()
static_assert(sqlpp::is_alias_t<T>::value, "type requirement"); static_assert(sqlpp::is_alias_t<T>::value, "type requirement");
} }
// test tvin
{
static_assert(std::is_same<decltype(sqlpp::tvin(1)), sqlpp::tvin_arg_t<sqlpp::integral_operand>>::value, "integral values are accepted and wrapped") ;
static_assert(std::is_same<decltype(sqlpp::tvin(false)), sqlpp::tvin_arg_t<sqlpp::boolean_operand>>::value, "bool values are accepted and wrapped") ;
static_assert(std::is_same<decltype(sqlpp::tvin(0.17)), sqlpp::tvin_arg_t<sqlpp::floating_point_operand>>::value, "float values are accepted and wrapped") ;
static_assert(std::is_same<decltype(sqlpp::tvin("test")), sqlpp::tvin_arg_t<sqlpp::text_operand>>::value, "text values are accepted and wrapped") ;
for (const auto& row : db(select(all_of(t)).from(t).where(true)))
{
static_assert(std::is_same<decltype(sqlpp::tvin(row.alpha)), sqlpp::tvin_arg_t<decltype(row.alpha)>>::value, "result fields are accepted and not wrapped") ;
static_assert(std::is_same<decltype(sqlpp::tvin(row.beta)), sqlpp::tvin_arg_t<decltype(row.beta)>>::value, "result fields are accepted and not wrapped") ;
static_assert(std::is_same<decltype(sqlpp::tvin(row.gamma)), sqlpp::tvin_arg_t<decltype(row.gamma)>>::value, "result fields are accepted and not wrapped") ;
}
}
return 0; return 0;
} }