1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:59:56 +00:00
openmw/apps/components_tests/sqlite3/statement.cpp
elsid 7d1cd11ba9
Split openmw_test_suite into openmw and components tests
To avoid duplicated compilation for openmw translation units. Link openmw-lib to
openmw-tests instead.
2024-06-10 23:12:14 +02:00

25 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");
}
}