diff options
-rw-r--r-- | gentoobrowse-api/unittests/mockDefs.h | 10 |
1 files 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 <notifications.h> #include <mocks.h> #include <selectcommandUtil.impl.h> +#include <boost/test/tools/context.hpp> 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<type>([&expected](const auto & n) { BOOST_REQUIRE_EQUAL(expected, n); }); +#define SQL_REQUIRE_EQUAL(sql, type, expected) BOOST_TEST_CONTEXT(sql) { sqlRequireEqual<type>(db, sql, expected); } +template<typename T> +void sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected) { + db->select(sql)->forEachRow<T>([expected](const auto & n) { + BOOST_REQUIRE_EQUAL(expected, n); + }); +} #endif |