diff --git a/tests/core/serialize/CustomQuery.cpp b/tests/core/serialize/CustomQuery.cpp index 2f3ca056..c99a3083 100644 --- a/tests/core/serialize/CustomQuery.cpp +++ b/tests/core/serialize/CustomQuery.cpp @@ -58,7 +58,7 @@ int CustomQuery(int, char*[]) sqlpp::limit(7u), sqlpp::offset(3u)), "SELECT DISTINCT tab_foo.double_n FROM tab_foo INNER JOIN tab_bar ON tab_foo.double_n = tab_bar.id WHERE " "tab_bar.id > 17 GROUP BY tab_foo.double_n HAVING AVG(tab_bar.id) > 19 ORDER BY tab_foo.double_n " - "ASC,tab_foo.u_int_n DESC LIMIT 7 OFFSET 3"); + "ASC, tab_foo.u_int_n DESC LIMIT 7 OFFSET 3"); // A pragma query/query for sqlite SQLPP_COMPARE( diff --git a/tests/core/serialize/From.cpp b/tests/core/serialize/From.cpp index 0f1d2d71..4cfc9b98 100644 --- a/tests/core/serialize/From.cpp +++ b/tests/core/serialize/From.cpp @@ -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)), diff --git a/tests/core/serialize/Insert.cpp b/tests/core/serialize/Insert.cpp index 7fce7a48..c4f556d0 100644 --- a/tests/core/serialize/Insert.cpp +++ b/tests/core/serialize/Insert.cpp @@ -44,14 +44,14 @@ int Insert(int, char* []) SQLPP_COMPARE(insert_into(bar).default_values(), "INSERT INTO tab_bar DEFAULT VALUES"); SQLPP_COMPARE(insert_into(bar).set(bar.textN = "cheesecake", bar.boolNn = true), - "INSERT INTO tab_bar (text_n,bool_nn) VALUES('cheesecake'," + getTrue() + ")"); + "INSERT INTO tab_bar (text_n, bool_nn) VALUES('cheesecake', " + getTrue() + ")"); SQLPP_COMPARE(insert_into(bar).set(bar.textN = ::sqlpp::nullopt, bar.boolNn = true), - "INSERT INTO tab_bar (text_n,bool_nn) VALUES(NULL," + getTrue() + ")"); + "INSERT INTO tab_bar (text_n, bool_nn) VALUES(NULL, " + getTrue() + ")"); ::sqlpp::string_view cheeseCake = "cheesecake"; SQLPP_COMPARE(insert_into(bar).set(bar.textN = std::string(cheeseCake), bar.boolNn = true), - "INSERT INTO tab_bar (text_n,bool_nn) VALUES('cheesecake'," + getTrue() + ")"); + "INSERT INTO tab_bar (text_n, bool_nn) VALUES('cheesecake', " + getTrue() + ")"); SQLPP_COMPARE(insert_into(bar).set(bar.textN = ::sqlpp::string_view(cheeseCake), bar.boolNn = true), - "INSERT INTO tab_bar (text_n,bool_nn) VALUES('cheesecake'," + getTrue() + ")"); + "INSERT INTO tab_bar (text_n, bool_nn) VALUES('cheesecake', " + getTrue() + ")"); return 0; } diff --git a/tests/core/serialize/SelectAs.cpp b/tests/core/serialize/SelectAs.cpp index 624c15f3..34719e8f 100644 --- a/tests/core/serialize/SelectAs.cpp +++ b/tests/core/serialize/SelectAs.cpp @@ -42,7 +42,7 @@ int SelectAs(int, char*[]) #warning: The select itself should not offer an "as" that yields a value. #warning: The id_count should offer the alias that offers the value. SQLPP_COMPARE(select(foo.doubleN, select(count(bar.id).as(id_count)).from(bar).unconditionally().as(cheese)), - "SELECT tab_foo.double_n,(SELECT COUNT(tab_bar.id) AS id_count FROM tab_bar) AS cheese"); + "SELECT tab_foo.double_n, (SELECT COUNT(tab_bar.id) AS id_count FROM tab_bar) AS cheese"); return 0; } diff --git a/tests/core/serialize/SelectColumns.cpp b/tests/core/serialize/SelectColumns.cpp index 2343ffec..3ca504ae 100644 --- a/tests/core/serialize/SelectColumns.cpp +++ b/tests/core/serialize/SelectColumns.cpp @@ -38,30 +38,30 @@ int SelectColumns(int, char*[]) SQLPP_COMPARE(select(foo.doubleN), "SELECT tab_foo.double_n"); // Two columns - SQLPP_COMPARE(select(foo.doubleN, bar.id), "SELECT tab_foo.double_n,tab_bar.id"); + SQLPP_COMPARE(select(foo.doubleN, bar.id), "SELECT tab_foo.double_n, tab_bar.id"); // All columns of a table SQLPP_COMPARE(select(all_of(foo)), - "SELECT tab_foo.id,tab_foo.text_nn_d,tab_foo.int_n,tab_foo.double_n,tab_foo.u_int_n,tab_foo.blob_n,tab_foo.bool_n"); + "SELECT tab_foo.id, tab_foo.text_nn_d, tab_foo.int_n, tab_foo.double_n, tab_foo.u_int_n, tab_foo.blob_n, tab_foo.bool_n"); // All columns of a table plus one more SQLPP_COMPARE(select(all_of(foo), bar.id), - "SELECT tab_foo.id,tab_foo.text_nn_d,tab_foo.int_n,tab_foo.double_n,tab_foo.u_int_n,tab_foo.blob_n,tab_foo.bool_n,tab_bar.id"); + "SELECT tab_foo.id, tab_foo.text_nn_d, tab_foo.int_n, tab_foo.double_n, tab_foo.u_int_n, tab_foo.blob_n, tab_foo.bool_n, tab_bar.id"); // One more, plus all columns of a table SQLPP_COMPARE(select(bar.id, all_of(foo)), - "SELECT tab_bar.id,tab_foo.id,tab_foo.text_nn_d,tab_foo.int_n,tab_foo.double_n,tab_foo.u_int_n,tab_foo.blob_n,tab_foo.bool_n"); + "SELECT tab_bar.id, tab_foo.id, tab_foo.text_nn_d, tab_foo.int_n, tab_foo.double_n, tab_foo.u_int_n, tab_foo.blob_n, tab_foo.bool_n"); // Column and aggregate function - SQLPP_COMPARE(select(foo.doubleN, count(bar.id).as(id_count)), "SELECT tab_foo.double_n,COUNT(tab_bar.id) AS id_count"); + SQLPP_COMPARE(select(foo.doubleN, count(bar.id).as(id_count)), "SELECT tab_foo.double_n, COUNT(tab_bar.id) AS id_count"); // Column aliases SQLPP_COMPARE(select(foo.doubleN.as(sqlpp::alias::o), count(bar.id).as(sqlpp::alias::a)), - "SELECT tab_foo.double_n AS o,COUNT(tab_bar.id) AS a"); + "SELECT tab_foo.double_n AS o, COUNT(tab_bar.id) AS a"); // 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 diff --git a/tests/core/serialize/clause/group_by.cpp b/tests/core/serialize/clause/group_by.cpp index 4bf45b65..b0c2ca62 100644 --- a/tests/core/serialize/clause/group_by.cpp +++ b/tests/core/serialize/clause/group_by.cpp @@ -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"); diff --git a/tests/core/types/basic/join.cpp b/tests/core/types/basic/join.cpp index 1f7b1906..f110c41f 100644 --- a/tests/core/types/basic/join.cpp +++ b/tests/core/types/basic/join.cpp @@ -40,19 +40,19 @@ void test_group_by() using J = decltype(foo.join(bar).on(foo.id == bar.id)); static_assert(sqlpp::is_table::value, ""); static_assert( - std::is_same, sqlpp::detail::type_set>::value, ""); + std::is_same, sqlpp::detail::type_vector, sqlpp::table_t>>::value, ""); static_assert( - std::is_same, sqlpp::detail::type_set<>>::value, ""); + std::is_same, 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::value, ""); static_assert( - std::is_same, sqlpp::detail::type_set>::value, ""); + std::is_same, sqlpp::detail::type_vector, sqlpp::table_t>>::value, ""); static_assert( - std::is_same, sqlpp::detail::type_set>::value, ""); + std::is_same, sqlpp::detail::type_vector, sqlpp::table_t>>::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::value, ""); static_assert( - std::is_same, sqlpp::detail::type_set>::value, ""); + std::is_same, sqlpp::detail::type_vector>::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::detail::type_set<>>::value, ""); + std::is_same, 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 diff --git a/tests/core/usage/CustomQuery.cpp b/tests/core/usage/CustomQuery.cpp index a0d21a69..e12860fc 100644 --- a/tests/core/usage/CustomQuery.cpp +++ b/tests/core/usage/CustomQuery.cpp @@ -27,7 +27,6 @@ #include "Sample.h" #include "MockDb.h" #include -#include #include "../../include/test_helpers.h" namespace