summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-11-08 02:31:42 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-11-08 02:31:42 +0000
commitb45e81e87895b62d1c1f6e3acfa9e3f57176a346 (patch)
treef5fef2fa1b0399ba44c2a3157d32b6c568ec331a
parentTest error handling in mock setup (diff)
downloadlibdbpp-b45e81e87895b62d1c1f6e3acfa9e3f57176a346.tar.bz2
libdbpp-b45e81e87895b62d1c1f6e3acfa9e3f57176a346.tar.xz
libdbpp-b45e81e87895b62d1c1f6e3acfa9e3f57176a346.zip
Add boolean column to util test
-rw-r--r--libdbpp/unittests/testUtils.cpp7
-rw-r--r--libdbpp/unittests/util.sql5
2 files changed, 7 insertions, 5 deletions
diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp
index a2ac444..ba09580 100644
--- a/libdbpp/unittests/testUtils.cpp
+++ b/libdbpp/unittests/testUtils.cpp
@@ -21,14 +21,15 @@ BOOST_GLOBAL_FIXTURE( StandardMockDatabase );
BOOST_AUTO_TEST_CASE( forEachRow )
{
auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("pqmock"));
- auto sel = DB::SelectCommandPtr(db->newSelectCommand("SELECT a, b, c, d, e FROM forEachRow ORDER BY a LIMIT 1"));
- sel->forEachRow<int64_t, double, std::string, boost::posix_time::ptime, boost::posix_time::time_duration>(
- [](auto a, auto b, auto c, auto d, auto e) {
+ auto sel = DB::SelectCommandPtr(db->newSelectCommand("SELECT a, b, c, d, e, f FROM forEachRow ORDER BY a LIMIT 1"));
+ sel->forEachRow<int64_t, double, std::string, boost::posix_time::ptime, boost::posix_time::time_duration, bool>(
+ [](auto a, auto b, auto c, auto d, auto e, auto f) {
BOOST_REQUIRE_EQUAL(1, a);
BOOST_REQUIRE_EQUAL(2.3, b);
BOOST_REQUIRE_EQUAL("Some text", c);
BOOST_REQUIRE_EQUAL(boost::posix_time::ptime_from_tm({ 17, 39, 13, 7, 10, 115, 0, 0, 0, 0, 0}), d);
BOOST_REQUIRE_EQUAL(boost::posix_time::time_duration(4, 3, 2), e);
+ BOOST_REQUIRE_EQUAL(true, f);
});
}
diff --git a/libdbpp/unittests/util.sql b/libdbpp/unittests/util.sql
index a3c5ac8..fe98fc9 100644
--- a/libdbpp/unittests/util.sql
+++ b/libdbpp/unittests/util.sql
@@ -3,6 +3,7 @@ CREATE TABLE foreachrow (
b numeric(4,2),
c text,
d timestamp without time zone,
- e interval);
-INSERT INTO foreachrow(a, b, c, d, e) VALUES(1, 2.3, 'Some text', '2015-11-07 13:39:17', '04:03:02');
+ e interval,
+ f boolean);
+INSERT INTO foreachrow(a, b, c, d, e, f) VALUES(1, 2.3, 'Some text', '2015-11-07 13:39:17', '04:03:02', true);