summaryrefslogtreecommitdiff
path: root/libdbpp/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'libdbpp/unittests')
-rw-r--r--libdbpp/unittests/Jamfile.jam2
m---------libdbpp/unittests/libdbpp-mysql0
m---------libdbpp/unittests/libdbpp-odbc0
m---------libdbpp/unittests/libdbpp-postgresql0
m---------libdbpp/unittests/libdbpp-sqlite0
-rw-r--r--libdbpp/unittests/mockdb.cpp4
-rw-r--r--libdbpp/unittests/testParse.cpp2
-rw-r--r--libdbpp/unittests/testPatch.cpp24
-rw-r--r--libdbpp/unittests/testUtils.cpp27
9 files changed, 28 insertions, 31 deletions
diff --git a/libdbpp/unittests/Jamfile.jam b/libdbpp/unittests/Jamfile.jam
index 915cdf2..61c1e5e 100644
--- a/libdbpp/unittests/Jamfile.jam
+++ b/libdbpp/unittests/Jamfile.jam
@@ -1,5 +1,3 @@
-import testing ;
-
import feature : feature ;
path-constant me : . ;
diff --git a/libdbpp/unittests/libdbpp-mysql b/libdbpp/unittests/libdbpp-mysql
-Subproject 0778234c3ffd82f3b9987bcb64de32f2647aba4
+Subproject 7b56849be41fdd342c8d92c243df6370a53c830
diff --git a/libdbpp/unittests/libdbpp-odbc b/libdbpp/unittests/libdbpp-odbc
-Subproject d046504464cb476be9ff3f810ad93f6c3961c8a
+Subproject dbf98a34e08558b91328cb414447e9961c22203
diff --git a/libdbpp/unittests/libdbpp-postgresql b/libdbpp/unittests/libdbpp-postgresql
-Subproject 30133bd4281d777a6b32fa203fca5c624943507
+Subproject 216c87cbb7228d9130eead5e374dfd7a11a96b9
diff --git a/libdbpp/unittests/libdbpp-sqlite b/libdbpp/unittests/libdbpp-sqlite
-Subproject c58e1ee62175d8babc69bb0ff54b4625725d594
+Subproject 7e5c360a8c8eee8ebe8b1c18e49be5b4af8dac5
diff --git a/libdbpp/unittests/mockdb.cpp b/libdbpp/unittests/mockdb.cpp
index 722592a..30180b9 100644
--- a/libdbpp/unittests/mockdb.cpp
+++ b/libdbpp/unittests/mockdb.cpp
@@ -78,7 +78,7 @@ MockMock::DropDatabase() const
{
}
-FACTORY(MockMock, DB::MockDatabaseFactory);
-FACTORY(MockDb, DB::ConnectionFactory);
+FACTORY(MockMock, DB::MockDatabaseFactory)
+FACTORY(MockDb, DB::ConnectionFactory)
// LCOV_EXCL_STOP
diff --git a/libdbpp/unittests/testParse.cpp b/libdbpp/unittests/testParse.cpp
index 6991242..29ffc38 100644
--- a/libdbpp/unittests/testParse.cpp
+++ b/libdbpp/unittests/testParse.cpp
@@ -10,7 +10,7 @@
#include <vector>
using SQLs = std::vector<std::string>;
-BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(SQLs);
+BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(SQLs)
class RecordingParser : std::fstream, public DB::SqlParse {
public:
diff --git a/libdbpp/unittests/testPatch.cpp b/libdbpp/unittests/testPatch.cpp
index e81f9d7..cc9fd24 100644
--- a/libdbpp/unittests/testPatch.cpp
+++ b/libdbpp/unittests/testPatch.cpp
@@ -48,11 +48,11 @@ public:
}
};
-BOOST_FIXTURE_TEST_SUITE(mock, Mock);
+BOOST_FIXTURE_TEST_SUITE(mock, Mock)
BOOST_AUTO_TEST_CASE(sanityFail)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.src = "source";
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(sanityFail)
BOOST_AUTO_TEST_CASE(noTx)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.src = "source";
@@ -73,12 +73,12 @@ BOOST_AUTO_TEST_CASE(noTx)
BOOST_REQUIRE_THROW(db->patchTable(&tp), DB::TransactionRequired);
}
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(testBasic)
{
Mock mock;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.src = "source";
@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(testBasic)
BOOST_AUTO_TEST_CASE(allKeys)
{
Mock mock;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.src = "source";
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(allKeys)
BOOST_AUTO_TEST_CASE(testOrder)
{
Mock mock;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
OrderByA order;
@@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(testOrder)
BOOST_AUTO_TEST_CASE(testWhere)
{
Mock mock;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
WhereAequals1 where;
@@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(testWhere)
BOOST_AUTO_TEST_CASE(testInstead)
{
Mock mock;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
MarkDeleted mark;
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(testSrcExprTable)
{
Mock mock;
DB::StaticSqlWriter s("source");
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.srcExpr = &s;
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(testSrcExprSelectTable)
{
Mock mock;
DB::StaticSqlWriter s("(SELECT * FROM source)");
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.srcExpr = &s;
@@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(testSrcExprSelectFilteredTable)
{
Mock mock;
BindInt s("(SELECT s.* FROM source s WHERE s.a = ?)", 1);
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
BOOST_REQUIRE(db);
DB::TablePatch tp;
tp.srcExpr = &s;
diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp
index cc5cdc3..8fb0510 100644
--- a/libdbpp/unittests/testUtils.cpp
+++ b/libdbpp/unittests/testUtils.cpp
@@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(stdforOverRowsStructuredBindingOptional)
BOOST_AUTO_TEST_CASE(execute)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
db->execute("UPDATE forEachRow SET a = 2");
}
@@ -123,7 +123,6 @@ BOOST_AUTO_TEST_CASE(columns)
auto sel = db->select("SELECT a, b, c, d, e FROM forEachRow ORDER BY a LIMIT 1");
sel->execute();
BOOST_REQUIRE_THROW((void)(*sel)[5], DB::ColumnIndexOutOfRange);
- BOOST_REQUIRE_THROW((void)(*sel)[-1], DB::ColumnIndexOutOfRange);
BOOST_REQUIRE_EQUAL(0, (*sel)[0].colNo);
BOOST_REQUIRE_EQUAL(4, (*sel)[4].colNo);
BOOST_REQUIRE_EQUAL("c", (*sel)[2].name);
@@ -167,7 +166,7 @@ BOOST_AUTO_TEST_CASE(extract)
BOOST_AUTO_TEST_CASE(bulkLoadStream)
{
std::ifstream in(rootDir / "source.dat");
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
db->beginBulkUpload("bulk1", "");
BOOST_REQUIRE_EQUAL(56, db->bulkUploadData(in));
db->endBulkUpload(nullptr);
@@ -179,7 +178,7 @@ BOOST_AUTO_TEST_CASE(bulkLoadStream)
BOOST_AUTO_TEST_CASE(bulkLoadFile)
{
auto f = fopen((rootDir / "source.dat").c_str(), "r");
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
db->beginBulkUpload("bulk2", "");
BOOST_REQUIRE_EQUAL(56, db->bulkUploadData(f));
db->endBulkUpload(nullptr);
@@ -217,7 +216,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(nullBind, Str, StringTypes)
BOOST_AUTO_TEST_CASE(iceNullBind)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
auto ins = db->modify("INSERT INTO forEachRow VALUES(?, ?, ?, ?, ?, ?)");
ins->bindParamI(0, IceUtil::Optional<int>());
ins->bindParamF(1, IceUtil::Optional<double>());
@@ -238,7 +237,7 @@ BOOST_AUTO_TEST_CASE(iceNullBind)
BOOST_AUTO_TEST_CASE(charStarBindNull)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
db->modify("DELETE FROM forEachRow")->execute();
auto ins = db->modify("INSERT INTO forEachRow(a, c) VALUES(?, ?)");
char * cs = nullptr;
@@ -265,16 +264,16 @@ BOOST_AUTO_TEST_CASE(charStarBindNull)
BOOST_AUTO_TEST_CASE(bind)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
auto m = db->modify("doesn't matter, only testing compile");
- m->bindParamI(0, (unsigned char)1);
- m->bindParamI(0, (char)1);
- m->bindParamI(0, (time_t)1);
+ m->bindParamI(0, static_cast<unsigned char>(1));
+ m->bindParamI(0, static_cast<char>(1));
+ m->bindParamI(0, static_cast<time_t>(1));
}
BOOST_AUTO_TEST_CASE(bindIntPtr)
{
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
db->modify("DELETE FROM forEachRow")->execute();
auto ins = db->modify("INSERT INTO forEachRow(a, b) VALUES(?, ?)");
int * is = nullptr;
@@ -306,7 +305,7 @@ BOOST_AUTO_TEST_CASE(bindIntPtr)
BOOST_FIXTURE_TEST_CASE(traits_bind, DB::TestCore)
{
using namespace std::literals;
- auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
+ auto db = DB::MockDatabase::openConnectionTo("pqmock");
auto cmd = db->select("select x is null, format('%s', x) from (select ? x) d");
auto cmd2 = db->select("select x is null, x from (select ?::bytea x) d");
auto check = [](int line, const auto & v, bool isNull, const auto & testval, auto & cmd) {
@@ -323,12 +322,12 @@ BOOST_FIXTURE_TEST_CASE(traits_bind, DB::TestCore)
check(__LINE__, testInt, false, "43"sv, cmd);
check(__LINE__, std::make_unique<short>(testInt), false, "43"sv, cmd);
check(__LINE__, std::unique_ptr<short>(), true, ""sv, cmd);
- check(__LINE__, (unsigned int)testInt, false, "43"sv, cmd);
+ check(__LINE__, static_cast<unsigned int>(testInt), false, "43"sv, cmd);
check(__LINE__, &testInt, false, "43"sv, cmd);
check(__LINE__, testDouble, false, "3.14"sv, cmd);
check(__LINE__, std::make_shared<float>(testDouble), false, "3.14"sv, cmd);
check(__LINE__, std::shared_ptr<float>(), true, ""sv, cmd);
- check(__LINE__, (float)testDouble, false, "3.14"sv, cmd);
+ check(__LINE__, static_cast<float>(testDouble), false, "3.14"sv, cmd);
check(__LINE__, &testDouble, false, "3.14"sv, cmd);
check(__LINE__, testString, false, testString, cmd);
check(__LINE__, &testString, false, testString, cmd);