1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00
OpenMW/apps/openmw_test_suite/sqlite3/statement.cpp
2022-09-22 21:35:26 +03:00

26 lines
708 B
C++

#include <components/sqlite3/db.hpp>
#include <components/sqlite3/statement.hpp>
#include <gtest/gtest.h>
namespace
{
using namespace testing;
using namespace Sqlite3;
struct Query
{
static std::string_view text() noexcept { return "SELECT 1"; }
static void bind(sqlite3&, sqlite3_stmt&) {}
};
TEST(Sqlite3StatementTest, makeStatementShouldCreateStatementWithPreparedQuery)
{
const auto db = makeDb(":memory:", "CREATE TABLE test ( id INTEGER )");
const Statement statement(*db, Query{});
EXPECT_FALSE(statement.mNeedReset);
EXPECT_NE(statement.mHandle, nullptr);
EXPECT_EQ(statement.mQuery.text(), "SELECT 1");
}
}