aboutsummaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/libcxx/test/config.py1
-rw-r--r--test/libcxx/test/target_info.py2
-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
-rw-r--r--test/support/MoveOnly.h1
7 files changed, 137 insertions, 5 deletions
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index fefbf01ad450..5ab7fcb37401 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -558,6 +558,7 @@ class Configuration(object):
'-fno-sanitize=vptr,function',
'-fno-sanitize-recover']
self.cxx.compile_flags += ['-O3']
+ self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
self.config.available_features.add('ubsan')
elif san == 'Thread':
self.cxx.flags += ['-fsanitize=thread']
diff --git a/test/libcxx/test/target_info.py b/test/libcxx/test/target_info.py
index 667644d2fec6..df216fcb21fa 100644
--- a/test/libcxx/test/target_info.py
+++ b/test/libcxx/test/target_info.py
@@ -62,7 +62,7 @@ class DarwinLocalTI(DefaultTargetInfo):
super(DarwinLocalTI, self).__init__(full_config)
def add_locale_features(self, features):
- add_common_locales(feature, self.full_config.lit_config)
+ add_common_locales(features, self.full_config.lit_config)
def add_cxx_compile_flags(self, flags):
try:
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
}
diff --git a/test/support/MoveOnly.h b/test/support/MoveOnly.h
index e4d9f6495602..ee6ae7c7e5f9 100644
--- a/test/support/MoveOnly.h
+++ b/test/support/MoveOnly.h
@@ -17,6 +17,7 @@
class MoveOnly
{
+ friend class MoveOnly2;
MoveOnly(const MoveOnly&);
MoveOnly& operator=(const MoveOnly&);