|
@@ -21,6 +21,7 @@
|
|
|
#include <cstddef>
|
|
|
|
|
|
#include "test_macros.h"
|
|
|
+#include "../../../check_consecutive.h"
|
|
|
#include "../../../test_compare.h"
|
|
|
#include "../../../test_hash.h"
|
|
|
#include "test_allocator.h"
|
|
@@ -53,18 +54,10 @@ int main(int, char**)
|
|
|
C c = c0;
|
|
|
LIBCPP_ASSERT(c.bucket_count() == 7);
|
|
|
assert(c.size() == 6);
|
|
|
- C::const_iterator i = c.cbegin();
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 3);
|
|
|
- ++i;
|
|
|
- assert(*i == 4);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
|
|
|
assert(c.hash_function() == test_hash<std::hash<int> >(8));
|
|
|
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
|
|
|
assert(c.get_allocator() == test_allocator<int>(10));
|
|
@@ -100,18 +93,10 @@ int main(int, char**)
|
|
|
C c = c0;
|
|
|
LIBCPP_ASSERT(c.bucket_count() == 7);
|
|
|
assert(c.size() == 6);
|
|
|
- C::const_iterator i = c.cbegin();
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 3);
|
|
|
- ++i;
|
|
|
- assert(*i == 4);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
|
|
|
assert(c.hash_function() == test_hash<std::hash<int> >(8));
|
|
|
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
|
|
|
assert(c.get_allocator() == other_allocator<int>(-2));
|
|
@@ -146,18 +131,10 @@ int main(int, char**)
|
|
|
C c = c0;
|
|
|
LIBCPP_ASSERT(c.bucket_count() == 7);
|
|
|
assert(c.size() == 6);
|
|
|
- C::const_iterator i = c.cbegin();
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 1);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 2);
|
|
|
- ++i;
|
|
|
- assert(*i == 3);
|
|
|
- ++i;
|
|
|
- assert(*i == 4);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
|
|
|
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
|
|
|
assert(c.hash_function() == test_hash<std::hash<int> >(8));
|
|
|
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
|
|
|
assert(c.get_allocator() == min_allocator<int>());
|