summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-01-08 21:51:18 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2018-01-08 21:51:18 +0100
commit77ad6aa02a73f0b5720b5c2c816cc697ba733aa0 (patch)
tree3d958c8a45840237e5a87abbee81a8aa13a58d6e /vespalib
parent2710414fabfa7f17d88a48fd01c775e1b2b2ddeb (diff)
Add an explicitt test that begin() == end() on empty hashtables.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/stllike/hash_test.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp
index af889754530..94e214e9fb9 100644
--- a/vespalib/src/tests/stllike/hash_test.cpp
+++ b/vespalib/src/tests/stllike/hash_test.cpp
@@ -496,4 +496,11 @@ TEST("test hash table capacity and size") {
EXPECT_EQUAL(2048u, many.capacity());
}
+TEST("test that begin and end are identical with empty hashtables") {
+ hash_set<int> empty;
+ EXPECT_TRUE(empty.begin() == empty.end());
+ hash_set<int> empty_but_reserved(10);
+ EXPECT_TRUE(empty_but_reserved.begin() == empty_but_reserved.end());
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }