summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 19:14:35 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 19:14:35 +0100
commit0fea68b2516749e44b69851e16c8288499196ac1 (patch)
tree61b9749a52dcc8dce1a5effec5f0ab8591ddadbf
parentExpose stream << Blob operator in test lib (diff)
downloadlibdbpp-1.1.3.tar.bz2
libdbpp-1.1.3.tar.xz
libdbpp-1.1.3.zip
Add tests over blob operator==libdbpp-1.1.3
-rw-r--r--libdbpp/unittests/Jamfile.jam1
-rw-r--r--libdbpp/unittests/testUtils.cpp18
2 files changed, 19 insertions, 0 deletions
diff --git a/libdbpp/unittests/Jamfile.jam b/libdbpp/unittests/Jamfile.jam
index d27a0a2..f43c909 100644
--- a/libdbpp/unittests/Jamfile.jam
+++ b/libdbpp/unittests/Jamfile.jam
@@ -85,6 +85,7 @@ run
<define>ROOT=\"$(me)\"
<define>BOOST_TEST_DYN_LINK
<library>..//dbppcore
+ <library>..//dbpptestcore
<library>..//adhocutil
<library>dbpp-local-postgresql
<library>boost_utf
diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp
index aea70b6..2dca88e 100644
--- a/libdbpp/unittests/testUtils.cpp
+++ b/libdbpp/unittests/testUtils.cpp
@@ -11,6 +11,7 @@
#include <boost/date_time/posix_time/posix_time_io.hpp>
#include <IceUtil/Exception.h>
#include <IceUtil/Optional.h>
+#include <testCore.h>
class StandardMockDatabase : public PQ::Mock {
public:
@@ -304,6 +305,23 @@ BOOST_AUTO_TEST_CASE( testBlobVecStruct )
BOOST_REQUIRE_EQUAL(vec.len, 20 * 16);
}
+BOOST_AUTO_TEST_CASE( testBlobCompare )
+{
+ std::vector<S> buf1(20, {4, 8});
+ DB::Blob vec1(buf1);
+
+ std::vector<S> buf2(buf1);
+ DB::Blob vec2(buf2);
+
+ std::vector<S> buf3(buf2);
+ buf3.pop_back();
+ DB::Blob vec3(buf3);
+
+ BOOST_REQUIRE_EQUAL(vec1, vec2);
+ BOOST_REQUIRE(!(vec1 == vec3));
+ BOOST_REQUIRE(!(vec2 == vec3));
+}
+
// These just compile time support, actual data extraction should be tested by the implementing connector.
template<typename T>
void