aboutsummaryrefslogtreecommitdiff
path: root/test/std
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-06 20:05:20 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-06 20:05:20 +0000
commit722ebc7ad794cf56284863322f8220e769093709 (patch)
treebbd3f7411feb4d23aeedd56ebb9e31f2959c657b /test/std
parentb4c64ad90b81d2a779786b7edb4c5c6dd28cc57d (diff)
downloadsrc-722ebc7ad794cf56284863322f8220e769093709.tar.gz
src-722ebc7ad794cf56284863322f8220e769093709.zip
Vendor import of libc++ trunk r256945:vendor/libc++/r256945
Notes
Notes: svn path=/vendor/libc++/dist/; revision=293255 svn path=/vendor/libc++/r256945/; revision=293256; tag=vendor/libc++/r256945
Diffstat (limited to 'test/std')
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp33
-rw-r--r--test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp38
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp34
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp33
4 files changed, 134 insertions, 4 deletions
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
index 42b41fd7b867..9db1e5c70732 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
@@ -19,6 +19,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -52,7 +53,7 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
@@ -83,5 +84,35 @@ int main()
assert(r->second == 3);
}
#endif
+#if TEST_STD_VER > 14
+ {
+ typedef std::map<int, MoveOnly> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), {2, MoveOnly(2)});
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.end(), {1, MoveOnly(1)});
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.end(), {3, MoveOnly(3)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), {3, MoveOnly(3)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
index a9d3277e6d94..23eb84d687ff 100644
--- a/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
@@ -11,6 +11,7 @@
// class map
+// pair<iterator, bool> insert( value_type&& v); // C++17 and later
// template <class P>
// pair<iterator, bool> insert(P&& p);
@@ -19,6 +20,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -55,7 +57,7 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<M::iterator, bool> R;
@@ -89,5 +91,39 @@ int main()
assert(r.first->second == 3);
}
#endif
+#if TEST_STD_VER > 14
+ {
+ typedef std::map<int, MoveOnly> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert({2, MoveOnly(2)});
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
+
+ r = m.insert({1, MoveOnly(1)});
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
+
+ r = m.insert({3, MoveOnly(3)});
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = m.insert({3, MoveOnly(3)});
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index b44f46429ec8..7035de83f990 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -19,6 +19,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -52,7 +53,7 @@ int main()
assert(r->first == 3);
assert(r->second == 2);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef std::pair<int, MoveOnly> P;
@@ -83,5 +84,36 @@ int main()
assert(r->second == 2);
}
#endif
+#if TEST_STD_VER > 14
+ {
+ typedef std::multimap<int, MoveOnly> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), {2, MoveOnly(2)});
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.cend(), {1, MoveOnly(1)});
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.cend(), {3, MoveOnly(3)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), {3, MoveOnly(2)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index b1c043586d65..825e304f65a8 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -19,6 +19,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -51,7 +52,7 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
typedef M::iterator R;
@@ -81,5 +82,35 @@ int main()
assert(r->second == 3);
}
#endif
+#if TEST_STD_VER > 14
+ {
+ typedef std::multimap<int, MoveOnly> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert({2, MoveOnly(2)});
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert({1, MoveOnly(1)});
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert({3, MoveOnly(3)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert({3, MoveOnly(3)});
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}