Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72733 - sandbox/bloom_filter/trunk/libs/bloom_filter/test
From: cpp.cabrera_at_[hidden]
Date: 2011-06-24 04:27:57


Author: alejandro
Date: 2011-06-24 04:27:56 EDT (Fri, 24 Jun 2011)
New Revision: 72733
URL: http://svn.boost.org/trac/boost/changeset/72733

Log:
Added member and global swap test.
Text files modified:
   sandbox/bloom_filter/trunk/libs/bloom_filter/test/regression.cpp | 22 ++++++++++++++++++++++
   1 files changed, 22 insertions(+), 0 deletions(-)

Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/test/regression.cpp
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/test/regression.cpp (original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/test/regression.cpp 2011-06-24 04:27:56 EDT (Fri, 24 Jun 2011)
@@ -182,6 +182,17 @@
   BOOST_CHECK_EQUAL(bloom.count(), 0ul);
 }
 
+BOOST_AUTO_TEST_CASE(memberSwap) {
+ size_t elems[5] = {1,2,3,4,5};
+ bloom_filter<size_t, 8> bloom1(elems, elems+2);
+ bloom_filter<size_t, 8> bloom2(elems+2, elems+5);
+
+ bloom1.swap(bloom2);
+
+ BOOST_CHECK_EQUAL(bloom1.count(), 3ul);
+ BOOST_CHECK_EQUAL(bloom2.count(), 2ul);
+}
+
 BOOST_AUTO_TEST_CASE(testUnion) {
   bloom_filter<size_t, 32> bloom_1;
   bloom_filter<size_t, 32> bloom_2;
@@ -247,6 +258,17 @@
     BOOST_CHECK_EQUAL(bloom_intersect.probably_contains(i), false);
 }
 
+BOOST_AUTO_TEST_CASE(globalSwap) {
+ size_t elems[5] = {1,2,3,4,5};
+ bloom_filter<size_t, 8> bloom1(elems, elems+2);
+ bloom_filter<size_t, 8> bloom2(elems+2, elems+5);
+
+ swap(bloom1, bloom2);
+
+ BOOST_CHECK_EQUAL(bloom1.count(), 3ul);
+ BOOST_CHECK_EQUAL(bloom2.count(), 2ul);
+}
+
 /*
 BOOST_AUTO_TEST_CASE(collisionBenchmark) {
   typedef boost::mpl::vector<


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk