From 35509d27416ef83942f67e1e196bb045213a8d47 Mon Sep 17 00:00:00 2001 From: Sahid Orentino Ferdjaoui Date: Mon, 2 Jun 2014 11:53:33 +0200 Subject: [PATCH] bloom_filter, add test to validate assignement operator Adds a test to ensure the good behavior of the operator assignement. Signed-off-by: Sahid Orentino Ferdjaoui --- src/test/common/test_bloom_filter.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/common/test_bloom_filter.cc b/src/test/common/test_bloom_filter.cc index 5b059c02e2a45..033fd00a7ecb7 100644 --- a/src/test/common/test_bloom_filter.cc +++ b/src/test/common/test_bloom_filter.cc @@ -289,3 +289,17 @@ TEST(BloomFilter, SequenceDouble) { } #endif + +TEST(BloomFilter, Assignement) { + bloom_filter bf1(10, .1, .1), bf2; + + bf1.insert("foo"); + bf2 = bf1; + bf1.insert("bar"); + + ASSERT_TRUE(bf2.contains("foo")); + ASSERT_FALSE(bf2.contains("bar")); + + ASSERT_EQ(2, bf1.element_count()); + ASSERT_EQ(1, bf2.element_count()); +} -- 2.39.5