-
-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
300 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/statement_serializer_tests/column_constraints/unindexed.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <sqlite_orm/sqlite_orm.h> | ||
#include <catch2/catch_all.hpp> | ||
|
||
using namespace sqlite_orm; | ||
|
||
TEST_CASE("statement_serializer unindexed") { | ||
internal::db_objects_tuple<> storage; | ||
internal::serializer_context<internal::db_objects_tuple<>> context{storage}; | ||
auto node = unindexed(); | ||
auto value = serialize(node, context); | ||
REQUIRE(value == "UNINDEXED"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <sqlite_orm/sqlite_orm.h> | ||
#include <catch2/catch_all.hpp> | ||
|
||
using namespace sqlite_orm; | ||
|
||
TEST_CASE("statement_serializer table_t") { | ||
struct User { | ||
int id = 0; | ||
std::string name; | ||
}; | ||
std::string value; | ||
std::string expected; | ||
SECTION("simple") { | ||
auto table = make_table("users", make_column("id", &User::id), make_column("name", &User::name)); | ||
using db_objects_t = internal::db_objects_tuple<decltype(table)>; | ||
auto dbObjects = db_objects_t{table}; | ||
using context_t = internal::serializer_context<db_objects_t>; | ||
context_t context{dbObjects}; | ||
value = internal::serialize(table, context); | ||
expected = "CREATE TABLE \"users\" (\"id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL)"; | ||
} | ||
SECTION("without_rowid") { | ||
auto table = | ||
make_table("users", make_column("id", &User::id), make_column("name", &User::name)).without_rowid(); | ||
using db_objects_t = internal::db_objects_tuple<decltype(table)>; | ||
auto dbObjects = db_objects_t{table}; | ||
using context_t = internal::serializer_context<db_objects_t>; | ||
context_t context{dbObjects}; | ||
value = internal::serialize(table, context); | ||
expected = "CREATE TABLE \"users\" (\"id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL) WITHOUT ROWID"; | ||
} | ||
REQUIRE(value == expected); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.