From 7d3a8e8937af7b96f581744f8217a3c9b01ed1a6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 17 Feb 2017 22:02:06 +0000 Subject: Update SQL_REQUIRE_EQUAL to accept literals and include SQL context --- gentoobrowse-api/unittests/mockDefs.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gentoobrowse-api/unittests/mockDefs.h b/gentoobrowse-api/unittests/mockDefs.h index 5bb1cd5..586079f 100644 --- a/gentoobrowse-api/unittests/mockDefs.h +++ b/gentoobrowse-api/unittests/mockDefs.h @@ -10,6 +10,7 @@ #include #include #include +#include class MockMailServerImpl : public Gentoo::MockMailServer { public: @@ -46,8 +47,13 @@ class DLL_PUBLIC TestClient : public IceTray::DryIceClient { Gentoo::UsersPrx u; }; -#define SQL_REQUIRE_EQUAL(sql, type, expected) \ - db->select(sql)->forEachRow([&expected](const auto & n) { BOOST_REQUIRE_EQUAL(expected, n); }); +#define SQL_REQUIRE_EQUAL(sql, type, expected) BOOST_TEST_CONTEXT(sql) { sqlRequireEqual(db, sql, expected); } +template +void sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected) { + db->select(sql)->forEachRow([expected](const auto & n) { + BOOST_REQUIRE_EQUAL(expected, n); + }); +} #endif -- cgit v1.2.3