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

More tests

This commit is contained in:
Roland Bock 2024-08-05 20:26:54 +02:00
parent b0ac371cea
commit cec1eaa768

View File

@ -58,6 +58,15 @@ void test_aggregate_functions(Value v)
static_assert(sqlpp::has_enabled_as<decltype(max(v_not_null))>::value, "");
static_assert(sqlpp::has_enabled_as<decltype(min(v_not_null))>::value, "");
// Aggregate functions have a name
static_assert(sqlpp::has_name<decltype(count(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(max(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(min(v_not_null))>::value, "");
static_assert(sqlpp::name_tag_of_t<decltype(count(v_not_null))>::_alias_t::_literal == sqlpp::string_view("count"), "");
static_assert(sqlpp::name_tag_of_t<decltype(max(v_not_null))>::_alias_t::_literal == sqlpp::string_view("max"), "");
static_assert(sqlpp::name_tag_of_t<decltype(min(v_not_null))>::_alias_t::_literal == sqlpp::string_view("min"), "");
// Aggregate functions enable comparison member functions.
static_assert(sqlpp::has_enabled_comparison<decltype(count(v_not_null))>::value, "");
static_assert(sqlpp::has_enabled_comparison<decltype(max(v_not_null))>::value, "");
@ -97,6 +106,13 @@ void test_numeric_aggregate_functions(Value v)
static_assert(sqlpp::has_enabled_as<decltype(sum(v_not_null))>::value, "");
static_assert(sqlpp::has_enabled_as<decltype(avg(v_not_null))>::value, "");
// Aggregate functions have a name
static_assert(sqlpp::has_name<decltype(sum(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(avg(v_not_null))>::value, "");
static_assert(sqlpp::name_tag_of_t<decltype(sum(v_not_null))>::_alias_t::_literal == sqlpp::string_view("sum"), "");
static_assert(sqlpp::name_tag_of_t<decltype(avg(v_not_null))>::_alias_t::_literal == sqlpp::string_view("avg"), "");
// Aggregate functions enable OVER.
static_assert(sqlpp::has_enabled_over<decltype(sum(v_not_null))>::value, "");
static_assert(sqlpp::has_enabled_over<decltype(avg(v_not_null))>::value, "");