summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/utilities')
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp32
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp5
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp5
5 files changed, 35 insertions, 15 deletions
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp
index 3acd2f8c6f2..9f6f1bc75c7 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp
@@ -11,10 +11,11 @@
// shared_ptr
-// template <class U> bool owner_before(shared_ptr<U> const& b) const;
+// template <class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
#include <memory>
#include <cassert>
+#include "test_macros.h"
int main()
{
@@ -25,4 +26,5 @@ int main()
assert(!p2.owner_before(p1));
assert(p1.owner_before(p3) || p3.owner_before(p1));
assert(p3.owner_before(p1) == p3.owner_before(p2));
+ ASSERT_NOEXCEPT(p1.owner_before(p2));
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp
index 33447ba7da0..560293bbedb 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp
@@ -11,10 +11,11 @@
// shared_ptr
-// template <class U> bool owner_before(weak_ptr<U> const& b) const;
+// template <class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
#include <memory>
#include <cassert>
+#include "test_macros.h"
int main()
{
@@ -28,4 +29,5 @@ int main()
assert(!p2.owner_before(w1));
assert(p1.owner_before(w3) || p3.owner_before(w1));
assert(p3.owner_before(w1) == p3.owner_before(w2));
+ ASSERT_NOEXCEPT(p1.owner_before(w2));
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
index 142eba2d964..7ab60da77c7 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
@@ -16,9 +16,9 @@
// : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
// {
// typedef bool result_type;
-// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
-// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
-// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const noexcept;
+// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
// };
//
// template <class T>
@@ -26,22 +26,22 @@
// : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
// {
// typedef bool result_type;
-// bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
-// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
-// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+// bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
// };
//
// Added in C++17
// template<> struct owner_less<void>
// {
// template<class T, class U>
-// bool operator()(shared_ptr<T> const&, shared_ptr<U> const&) const;
+// bool operator()(shared_ptr<T> const&, shared_ptr<U> const&) const noexcept;
// template<class T, class U>
-// bool operator()(shared_ptr<T> const&, weak_ptr<U> const&) const;
+// bool operator()(shared_ptr<T> const&, weak_ptr<U> const&) const noexcept;
// template<class T, class U>
-// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const;
+// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const noexcept;
// template<class T, class U>
-// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const;
+// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const noexcept;
//
// typedef unspecified is_transparent;
// };
@@ -69,16 +69,19 @@ int main()
static_assert((std::is_same<std::shared_ptr<int>, CS::first_argument_type>::value), "" );
static_assert((std::is_same<std::shared_ptr<int>, CS::second_argument_type>::value), "" );
static_assert((std::is_same<bool, CS::result_type>::value), "" );
-
+
assert(!cs(p1, p2));
assert(!cs(p2, p1));
assert(cs(p1 ,p3) || cs(p3, p1));
assert(cs(p3, p1) == cs(p3, p2));
+ ASSERT_NOEXCEPT(cs(p1, p1));
assert(!cs(p1, w2));
assert(!cs(p2, w1));
assert(cs(p1, w3) || cs(p3, w1));
assert(cs(p3, w1) == cs(p3, w2));
+ ASSERT_NOEXCEPT(cs(p1, w1));
+ ASSERT_NOEXCEPT(cs(w1, p1));
}
{
typedef std::owner_less<std::weak_ptr<int> > CS;
@@ -92,11 +95,14 @@ int main()
assert(!cs(w2, w1));
assert(cs(w1, w3) || cs(w3, w1));
assert(cs(w3, w1) == cs(w3, w2));
+ ASSERT_NOEXCEPT(cs(w1, w1));
assert(!cs(w1, p2));
assert(!cs(w2, p1));
assert(cs(w1, p3) || cs(w3, p1));
assert(cs(w3, p1) == cs(w3, p2));
+ ASSERT_NOEXCEPT(cs(w1, p1));
+ ASSERT_NOEXCEPT(cs(p1, w1));
}
#if TEST_STD_VER > 14
{
@@ -111,6 +117,10 @@ int main()
cmp(sp1, sp3);
cmp(wp1, sp1);
cmp(wp1, wp1);
+ ASSERT_NOEXCEPT(cmp(sp1, sp1));
+ ASSERT_NOEXCEPT(cmp(sp1, wp1));
+ ASSERT_NOEXCEPT(cmp(wp1, sp1));
+ ASSERT_NOEXCEPT(cmp(wp1, wp1));
}
{
// test heterogeneous lookups
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
index 4aa49cfe8a2..458f8a11ed1 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
@@ -11,10 +11,11 @@
// weak_ptr
-// template<class U> bool owner_before(const shared_ptr<U>& b);
+// template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
#include <memory>
#include <cassert>
+#include "test_macros.h"
int main()
{
@@ -28,4 +29,6 @@ int main()
assert(!w2.owner_before(p1));
assert(w1.owner_before(p3) || w3.owner_before(p1));
assert(w3.owner_before(p1) == w3.owner_before(p2));
+// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
+ LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2));
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
index 9fe2b6e3903..5cd171a5302 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
@@ -11,10 +11,11 @@
// weak_ptr
-// template<class U> bool owner_before(const weak_ptr<U>& b);
+// template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
#include <memory>
#include <cassert>
+#include "test_macros.h"
int main()
{
@@ -28,4 +29,6 @@ int main()
assert(!w2.owner_before(w1));
assert(w1.owner_before(w3) || w3.owner_before(w1));
assert(w3.owner_before(w1) == w3.owner_before(w2));
+// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
+ LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2));
}
OpenPOWER on IntegriCloud