diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-04-17 19:15:08 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-04-17 19:15:08 +0100 |
commit | a802c57549d0111292eec1b9c0df86377efcf491 (patch) | |
tree | edfe997bfe5d97c84e9ebb555001b9db28eac4b4 /libsqlitepp/unittests | |
parent | Standalone split (diff) | |
download | libdbpp-sqlite-1.2.0.tar.bz2 libdbpp-sqlite-1.2.0.tar.xz libdbpp-sqlite-1.2.0.zip |
C++17libdbpp-sqlite-1.2.0
Updates code largely in-keeping with updates to be C++17 in line with
libadhocutil and libdbpp.
Diffstat (limited to 'libsqlitepp/unittests')
-rw-r--r-- | libsqlitepp/unittests/Jamfile.jam | 1 | ||||
-rw-r--r-- | libsqlitepp/unittests/testsqlite.cpp | 14 |
2 files changed, 5 insertions, 10 deletions
diff --git a/libsqlitepp/unittests/Jamfile.jam b/libsqlitepp/unittests/Jamfile.jam index 91afcae..0eb5b28 100644 --- a/libsqlitepp/unittests/Jamfile.jam +++ b/libsqlitepp/unittests/Jamfile.jam @@ -14,6 +14,7 @@ run <define>BOOST_TEST_DYN_LINK <library>..//dbpp-sqlite <library>dbpptestcore + <library>..//adhocutil <library>boost_utf <library>boost_filesystem <library>boost_system diff --git a/libsqlitepp/unittests/testsqlite.cpp b/libsqlitepp/unittests/testsqlite.cpp index 18707ef..177bdaf 100644 --- a/libsqlitepp/unittests/testsqlite.cpp +++ b/libsqlitepp/unittests/testsqlite.cpp @@ -9,9 +9,9 @@ #include <testCore.h> #include <boost/date_time/posix_time/posix_time.hpp> -class StandardMockDatabase : public SQLite::Mock { +class StandardMockDatabase : public DB::PluginMock<SQLite::Mock> { public: - StandardMockDatabase() : SQLite::Mock("sqlitemock", { + StandardMockDatabase() : DB::PluginMock<SQLite::Mock>("", "sqlitemock", { rootDir / "sqliteschema.sql" }) { } @@ -35,29 +35,25 @@ BOOST_AUTO_TEST_CASE( transactions ) BOOST_REQUIRE_EQUAL(true, ro->inTx()); ro->commitTx(); BOOST_REQUIRE_EQUAL(false, ro->inTx()); - - delete ro; } BOOST_AUTO_TEST_CASE( bindAndSend ) { auto rw = DB::MockDatabase::openConnectionTo("sqlitemock"); - auto mod = rw->newModifyCommand("INSERT INTO test VALUES(?, ?, ?)"); + auto mod = rw->modify("INSERT INTO test VALUES(?, ?, ?)"); mod->bindParamI(0, testInt); mod->bindParamF(1, testDouble); mod->bindParamS(2, testString); mod->execute(); BOOST_REQUIRE_EQUAL(2, rw->insertId()); - delete mod; - delete rw; } BOOST_AUTO_TEST_CASE( bindAndSelect ) { auto ro = DB::MockDatabase::openConnectionTo("sqlitemock"); - auto select = ro->newSelectCommand("SELECT * FROM test WHERE id = ?"); + auto select = ro->select("SELECT * FROM test WHERE id = ?"); select->bindParamI(0, testInt); select->execute(); int rows = 0; @@ -67,9 +63,7 @@ BOOST_AUTO_TEST_CASE( bindAndSelect ) assertColumnValueHelper(*select, 2, testString); rows += 1; } - delete select; BOOST_REQUIRE_EQUAL(1, rows); - delete ro; } BOOST_AUTO_TEST_SUITE_END(); |