mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Fixed a few broken tests
This commit is contained in:
parent
125a372c32
commit
3c36b1d025
@ -51,7 +51,7 @@ int From(int, char* [])
|
||||
SQLPP_COMPARE(from(foo.inner_join(bar).on(foo.doubleN > bar.id)),
|
||||
" FROM tab_foo INNER JOIN tab_bar ON tab_foo.double_n > tab_bar.id");
|
||||
SQLPP_COMPARE(from(foo.full_outer_join(bar).on(foo.doubleN > bar.id)),
|
||||
" FROM tab_foo OUTER JOIN tab_bar ON tab_foo.double_n > tab_bar.id");
|
||||
" FROM tab_foo FULL OUTER JOIN tab_bar ON tab_foo.double_n > tab_bar.id");
|
||||
SQLPP_COMPARE(from(foo.left_outer_join(bar).on(foo.doubleN > bar.id)),
|
||||
" FROM tab_foo LEFT OUTER JOIN tab_bar ON tab_foo.double_n > tab_bar.id");
|
||||
SQLPP_COMPARE(from(foo.right_outer_join(bar).on(foo.doubleN > bar.id)),
|
||||
|
@ -61,7 +61,7 @@ int SelectColumns(int, char*[])
|
||||
|
||||
// Optional column manually
|
||||
SQLPP_COMPARE(select(dynamic(true, bar.id)), "SELECT tab_bar.id");
|
||||
SQLPP_COMPARE(select(dynamic(false, bar.id)), "SELECT NULL as id");
|
||||
SQLPP_COMPARE(select(dynamic(false, bar.id)), "SELECT NULL AS id");
|
||||
|
||||
#warning: add more optional column tests
|
||||
|
||||
|
@ -64,7 +64,8 @@ int main(int, char* [])
|
||||
|
||||
// Single declared column
|
||||
SQLPP_COMPARE(group_by(declare_group_by_column(val)), " GROUP BY 17");
|
||||
SQLPP_COMPARE(group_by(declare_group_by_column(foo.id + 17)), " GROUP BY tab_foo.id + 17");
|
||||
#warning: Do we really want these extra parentheses?
|
||||
SQLPP_COMPARE(group_by(declare_group_by_column(foo.id + 17)), " GROUP BY (tab_foo.id + 17)");
|
||||
|
||||
// Mixed declared column
|
||||
SQLPP_COMPARE(group_by(foo.id, declare_group_by_column(val)), " GROUP BY tab_foo.id, 17");
|
||||
|
@ -40,19 +40,19 @@ void test_group_by()
|
||||
using J = decltype(foo.join(bar).on(foo.id == bar.id));
|
||||
static_assert(sqlpp::is_table<J>::value, "");
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_set<test::TabFoo, test::TabBar>>::value, "");
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_vector<sqlpp::table_t<test::TabFoo_>, sqlpp::table_t<test::TabBar_>>>::value, "");
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_set<>>::value, "");
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_vector<>>::value, "");
|
||||
#warning: test the provided dynamic tables of?
|
||||
}
|
||||
|
||||
{
|
||||
using J = decltype(foo.outer_join(bar).on(foo.id == bar.id));
|
||||
using J = decltype(foo.full_outer_join(bar).on(foo.id == bar.id));
|
||||
static_assert(sqlpp::is_table<J>::value, "");
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_set<test::TabFoo, test::TabBar>>::value, "");
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_vector<sqlpp::table_t<test::TabFoo_>, sqlpp::table_t<test::TabBar_>>>::value, "");
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_set<test::TabFoo, test::TabBar>>::value, "");
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_vector<sqlpp::table_t<test::TabFoo_>, sqlpp::table_t<test::TabBar_>>>::value, "");
|
||||
#warning: test the provided dynamic tables of?
|
||||
}
|
||||
|
||||
@ -61,15 +61,17 @@ void test_group_by()
|
||||
using J = decltype(foo.join(dynamic(true, bar)).on(foo.id == bar.id));
|
||||
static_assert(sqlpp::is_table<J>::value, "");
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_set<test::TabFoo, test::TabBar>>::value, "");
|
||||
std::is_same<sqlpp::provided_tables_of_t<J>, sqlpp::detail::type_vector<test::TabFoo, test::TabBar>>::value, "");
|
||||
#warning: OUTER is the wrong term. In a left-outer join, the *right* table is the one with optional rows.
|
||||
static_assert(
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_set<>>::value, "");
|
||||
std::is_same<sqlpp::provided_optional_tables_of_t<J>, sqlpp::detail::type_vector<>>::value, "");
|
||||
#warning: test the provided dynamic tables of?
|
||||
}
|
||||
|
||||
|
||||
#warning: Need to add tests all join types!
|
||||
#warning: Need to add tests with table_as
|
||||
#warning: Need to add tests with verbatim tables
|
||||
#warning: Need to add tests with 3 tables
|
||||
|
||||
#warning: Need to add tests with CTEs
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "Sample.h"
|
||||
#include "MockDb.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
#include <sqlpp11/core/query/query/custom_query.h>
|
||||
#include "../../include/test_helpers.h"
|
||||
|
||||
namespace
|
||||
|
Loading…
Reference in New Issue
Block a user