/
UCS
/
sqlite_orm
Обзор
Документация
Войти
/
UCS
/
sqlite_orm
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tests/statement_serializer_tests/statements/remove.cpp
33 строки
1 KB
klaus triendl
Updated to Catch2 v3
15 янв 2023, 22:59
15 янв 2023, 22:59
3154d24
Код
Авторство
О чём код?
#include <sqlite_orm/sqlite_orm.h> #include <catch2/catch_all.hpp> using namespace sqlite_orm; TEST_CASE("statement_serializer remove") { using internal::serialize; struct User { int id = 0; std::string name; }; auto table = make_table("users", make_column("id", &User::id, primary_key()), make_column("name", &User::name)); using db_objects_t = internal::db_objects_tuple<decltype(table)>; db_objects_t dbObjects{table}; using context_t = internal::serializer_context<db_objects_t>; context_t context{dbObjects}; std::string value; decltype(value) expected; auto statement = remove<User>(5); SECTION("with question marks") { context.replace_bindable_with_question = true; expected = R"(DELETE FROM "users" WHERE "id" = ?)"; } SECTION("without question marks") { context.replace_bindable_with_question = false; expected = R"(DELETE FROM "users" WHERE "id" = 5)"; } value = serialize(statement, context); REQUIRE(value == expected); }