mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-04-26 09:29:27 +00:00
Pull in full sqlite_modern_cpp repo for the license as it is not attached to source files
This commit is contained in:
31
common/sqlite_modern_cpp/tests/mov_ctor.cc
Normal file
31
common/sqlite_modern_cpp/tests/mov_ctor.cc
Normal file
@@ -0,0 +1,31 @@
|
||||
// Fixing https://github.com/SqliteModernCpp/sqlite_modern_cpp/issues/63
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <sqlite_modern_cpp.h>
|
||||
#include <memory>
|
||||
#include <catch2/catch.hpp>
|
||||
using namespace sqlite;
|
||||
using namespace std;
|
||||
|
||||
struct dbFront {
|
||||
std::unique_ptr<database_binder> storedProcedure;
|
||||
database db;
|
||||
dbFront(): db(":memory:") {
|
||||
db << "CREATE TABLE tbl (id integer, name string);";
|
||||
// the temporary moved object should not run _execute() function on destruction.
|
||||
storedProcedure = std::make_unique<database_binder>(
|
||||
db << "INSERT INTO tbl VALUES (?, ?);"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST_CASE("database lifecycle", "move_ctor") {
|
||||
|
||||
bool failed = false;
|
||||
try { dbFront dbf; }
|
||||
catch(const sqlite_exception& e) { failed = true; }
|
||||
catch(...) { failed = true; }
|
||||
|
||||
REQUIRE(failed == false);
|
||||
}
|
||||
Reference in New Issue
Block a user