summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2013-08-13 22:18:47 +0000
committerMarshall Clow <mclow.lists@gmail.com>2013-08-13 22:18:47 +0000
commit2585835c3b5ac959d21ae4edb084f4dc8148a5cc (patch)
tree78fa31f969869bad229302ba71a292c6aa37cf81 /libcxx/test
parent7da504faa497cb04c4fa5682495fa1f1f9da3e6f (diff)
downloadbcm5719-llvm-2585835c3b5ac959d21ae4edb084f4dc8148a5cc.tar.gz
bcm5719-llvm-2585835c3b5ac959d21ae4edb084f4dc8148a5cc.zip
Second half (map/multimap) of N3657
llvm-svn: 188320
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/containers/associative/map/map.access/index_key.pass.cpp29
-rw-r--r--libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp139
-rw-r--r--libcxx/test/containers/associative/map/map.ops/find.pass.cpp74
-rw-r--r--libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp106
-rw-r--r--libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp105
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp83
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp64
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp68
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp68
-rw-r--r--libcxx/test/containers/associative/multiset/equal_range.pass.cpp114
10 files changed, 793 insertions, 57 deletions
diff --git a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
index 7579088784c..5dfdf400e5e 100644
--- a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -73,4 +74,32 @@ int main()
assert(m.size() == 8);
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+
+ assert(m.size() == 7);
+ assert(m[1] == 1.5);
+ assert(m.size() == 7);
+ m[1] = -1.5;
+ assert(m[1] == -1.5);
+ assert(m.size() == 7);
+ assert(m[6] == 0);
+ assert(m.size() == 8);
+ m[6] = 6.5;
+ assert(m[6] == 6.5);
+ assert(m.size() == 8);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp b/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
index dc0d09760a9..b08acb08693 100644
--- a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -295,4 +296,142 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+ {
+ typedef PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp b/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
index a368dc5e7aa..4d1beabc815 100644
--- a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -163,4 +164,77 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> M;
+ typedef M::iterator R;
+
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(6) ] = 6;
+ m [ PC::make(7) ] = 7;
+ m [ PC::make(8) ] = 8;
+ m [ PC::make(9) ] = 9;
+ m [ PC::make(10) ] = 10;
+ m [ PC::make(11) ] = 11;
+ m [ PC::make(12) ] = 12;
+
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
index a1b8e5b3c2e..1ac175327c8 100644
--- a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -227,4 +228,109 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less <>> M;
+ typedef M::iterator R;
+
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
index eee08aee31b..20973e3e163 100644
--- a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -227,4 +228,108 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<>> M;
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::map<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m [ PC::make(5) ] = 5;
+ m [ PC::make(7) ] = 6;
+ m [ PC::make(9) ] = 7;
+ m [ PC::make(11) ] = 8;
+ m [ PC::make(13) ] = 9;
+ m [ PC::make(15) ] = 10;
+ m [ PC::make(17) ] = 11;
+ m [ PC::make(19) ] = 12;
+
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+#endif
}
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 030d4681ded..4632eb1c472 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
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -178,4 +179,86 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> 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 PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+// assert(m.size() == 9);
+ 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
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
index aa22d3971fd..e4dba289d09 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -142,4 +143,67 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> M;
+ typedef 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.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index 508b077b2ee..5ec1210e842 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -150,4 +151,71 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> M;
+ typedef 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.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 6f40c20d997..aa5a525ae54 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../min_allocator.h"
+#include "private_constructor.hpp"
int main()
{
@@ -150,4 +151,71 @@ int main()
}
}
#endif
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::multimap<int, double, std::less<>> M;
+ typedef 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.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+
+ {
+ typedef PrivateConstructor PC;
+ typedef std::multimap<PC, double, std::less<>> M;
+ typedef M::iterator R;
+
+ M m;
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+ m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/equal_range.pass.cpp b/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
index 37acec8f555..6babfa1b9ae 100644
--- a/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
@@ -184,47 +184,47 @@ int main()
{
typedef int V;
typedef std::multiset<V, std::less<>> M;
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == next(m.begin(), 0));
- assert(r.second == next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == next(m.begin(), 0));
- 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 == next(m.begin(), 9));
- assert(r.second == next(m.begin(), 9));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ 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 == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
}
{
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
- typedef std::pair<M::iterator, M::iterator> R;
+ typedef std::pair<M::iterator, M::iterator> R;
M m;
m.insert ( V::make ( 5 ));
@@ -237,27 +237,27 @@ int main()
m.insert ( V::make ( 9 ));
m.insert ( V::make ( 9 ));
- R r = m.equal_range(4);
- assert(r.first == next(m.begin(), 0));
- assert(r.second == next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == next(m.begin(), 0));
- 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 == next(m.begin(), 9));
- assert(r.second == next(m.begin(), 9));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ 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 == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
}
#endif
}
OpenPOWER on IntegriCloud