From 328673cfc96e646853d0ae96747ed1160af582f5 Mon Sep 17 00:00:00 2001 From: Yevgeniy Zakharov Date: Fri, 22 Sep 2023 20:05:46 +0600 Subject: [PATCH] format --- .../statement_serializer_tests/ast/match.cpp | 7 ++- tests/statement_serializer_tests/ast/rank.cpp | 12 ++--- .../schema/column.cpp | 54 +++++++++---------- .../schema/using_fts5.cpp | 8 ++- .../schema/virtual_table.cpp | 11 ++-- 5 files changed, 44 insertions(+), 48 deletions(-) diff --git a/tests/statement_serializer_tests/ast/match.cpp b/tests/statement_serializer_tests/ast/match.cpp index 821b36241..0a9cba24b 100644 --- a/tests/statement_serializer_tests/ast/match.cpp +++ b/tests/statement_serializer_tests/ast/match.cpp @@ -4,13 +4,12 @@ using namespace sqlite_orm; TEST_CASE("statement_serializer match") { - struct User { + struct User { int id = 0; std::string name; }; - auto table = make_virtual_table("users", - using_fts5(make_column("id", &User::id), - make_column("name", &User::name))); + auto table = + make_virtual_table("users", using_fts5(make_column("id", &User::id), make_column("name", &User::name))); using db_objects_t = internal::db_objects_tuple; auto dbObjects = db_objects_t{table}; using context_t = internal::serializer_context; diff --git a/tests/statement_serializer_tests/ast/rank.cpp b/tests/statement_serializer_tests/ast/rank.cpp index 3cd8435d7..2e735ceaa 100644 --- a/tests/statement_serializer_tests/ast/rank.cpp +++ b/tests/statement_serializer_tests/ast/rank.cpp @@ -11,14 +11,14 @@ TEST_CASE("statement_serializer rank") { std::string value; std::string expected; SECTION("rank") { - auto node = rank(); - value = serialize(node, context); - expected = "rank"; + auto node = rank(); + value = serialize(node, context); + expected = "rank"; } SECTION("order by rank") { - auto node = order_by(rank()); - value = serialize(node, context); - expected = "ORDER BY rank"; + auto node = order_by(rank()); + value = serialize(node, context); + expected = "ORDER BY rank"; } REQUIRE(value == expected); } diff --git a/tests/statement_serializer_tests/schema/column.cpp b/tests/statement_serializer_tests/schema/column.cpp index 1ecbcc67d..62aca0896 100644 --- a/tests/statement_serializer_tests/schema/column.cpp +++ b/tests/statement_serializer_tests/schema/column.cpp @@ -4,38 +4,38 @@ using namespace sqlite_orm; TEST_CASE("statement_serializer column") { - struct User { - int id = 0; - std::string name; - }; - internal::db_objects_tuple<> storage; - internal::serializer_context> context{storage}; + struct User { + int id = 0; + std::string name; + }; + internal::db_objects_tuple<> storage; + internal::serializer_context> context{storage}; std::string value; std::string expected; SECTION("with types and constraints") { - SECTION("id INTEGER NOT NULL") { - auto column = make_column("id", &User::id); - value = serialize(column, context); - expected = "\"id\" INTEGER NOT NULL"; - } - SECTION("name TEXT NOT NULL") { - auto column = make_column("name", &User::name); - value = serialize(column, context); - expected = "\"name\" TEXT NOT NULL"; - } + SECTION("id INTEGER NOT NULL") { + auto column = make_column("id", &User::id); + value = serialize(column, context); + expected = "\"id\" INTEGER NOT NULL"; + } + SECTION("name TEXT NOT NULL") { + auto column = make_column("name", &User::name); + value = serialize(column, context); + expected = "\"name\" TEXT NOT NULL"; + } } SECTION("without types and constraints") { - auto subContext = internal::make_serializer_context_with_no_types_and_constraints(context); - SECTION("id INTEGER NOT NULL") { - auto column = make_column("id", &User::id); - value = serialize(column, context); - expected = "\"id\""; - } - SECTION("name TEXT NOT NULL") { - auto column = make_column("name", &User::name); - value = serialize(column, context); - expected = "\"name\""; - } + auto subContext = internal::make_serializer_context_with_no_types_and_constraints(context); + SECTION("id INTEGER NOT NULL") { + auto column = make_column("id", &User::id); + value = serialize(column, context); + expected = "\"id\""; + } + SECTION("name TEXT NOT NULL") { + auto column = make_column("name", &User::name); + value = serialize(column, context); + expected = "\"name\""; + } } REQUIRE(value == expected); } diff --git a/tests/statement_serializer_tests/schema/using_fts5.cpp b/tests/statement_serializer_tests/schema/using_fts5.cpp index b48a9d642..cec6b2d9e 100644 --- a/tests/statement_serializer_tests/schema/using_fts5.cpp +++ b/tests/statement_serializer_tests/schema/using_fts5.cpp @@ -4,15 +4,13 @@ using namespace sqlite_orm; TEST_CASE("statement_serializer using_fts5") { - struct Post { + struct Post { std::string title; std::string body; }; - internal::db_objects_tuple<> storage; + internal::db_objects_tuple<> storage; internal::serializer_context> context{storage}; - auto node = using_fts5( - make_column("title", &Post::title), - make_column("body", &Post::body)); + auto node = using_fts5(make_column("title", &Post::title), make_column("body", &Post::body)); auto value = serialize(node, context); REQUIRE(value == "USING FTS5(\"title\", \"body\")"); } diff --git a/tests/statement_serializer_tests/schema/virtual_table.cpp b/tests/statement_serializer_tests/schema/virtual_table.cpp index 5cf64fff8..e64b4d89b 100644 --- a/tests/statement_serializer_tests/schema/virtual_table.cpp +++ b/tests/statement_serializer_tests/schema/virtual_table.cpp @@ -4,15 +4,14 @@ using namespace sqlite_orm; TEST_CASE("statement_serializer FTS5") { - struct Post { + struct Post { std::string title; std::string body; }; internal::db_objects_tuple<> storage; internal::serializer_context> context{storage}; - auto node = make_virtual_table("posts", using_fts5( - make_column("title", &Post::title), - make_column("body", &Post::body))); - auto value = serialize(node, context); - REQUIRE(value == "CREATE VIRTUAL TABLE IF NOT EXISTS \"posts\" USING FTS5(\"title\", \"body\")"); + auto node = + make_virtual_table("posts", using_fts5(make_column("title", &Post::title), make_column("body", &Post::body))); + auto value = serialize(node, context); + REQUIRE(value == "CREATE VIRTUAL TABLE IF NOT EXISTS \"posts\" USING FTS5(\"title\", \"body\")"); }