summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp')
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index 73f392cad10..030d4681ded 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef std::pair<M::iterator, M::iterator> R;
@@ -95,4 +98,84 @@ int main()
assert(r.first == m.end());
assert(r.second == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ }
+#endif
}
OpenPOWER on IntegriCloud