diff options
-rw-r--r-- | libdbpp/unittests/Jamfile.jam | 1 | ||||
-rw-r--r-- | libdbpp/unittests/testUtils.cpp | 18 |
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 |