[libcxx-commits] [libcxx] 9f4f012 - [libcxx][test] Attempt to make debug mode tests more bulletproof
Kristina Bessonova via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 18 05:53:30 PDT 2021
Author: Kristina Bessonova
Date: 2021-05-18T14:52:34+02:00
New Revision: 9f4f012c10266c2117f80b7c7eb699aadef0589d
URL: https://github.com/llvm/llvm-project/commit/9f4f012c10266c2117f80b7c7eb699aadef0589d
DIFF: https://github.com/llvm/llvm-project/commit/9f4f012c10266c2117f80b7c7eb699aadef0589d.diff
LOG: [libcxx][test] Attempt to make debug mode tests more bulletproof
The problem with debug mode tests is that it isn't known which particular
_LIBCPP_ASSERT causes the test to exit, and as shown by
https://reviews.llvm.org/D100029 and 2908eb20ba7 it might be not the
expected one.
The patch adds TEST_LIBCPP_ASSERT_FAILURE macro that allows checking
_LIBCPP_ASSERT message to ensure we caught an expected failure.
Reviewed By: Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D100595
Added:
libcxx/test/support/debug_macros.h
Modified:
libcxx/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_rvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/db_swap_1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_rvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/db_swap_1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_insert_hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/db_swap_1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_insert_hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_10.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_7.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_8.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_9.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/db_swap_1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/max_load_factor.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/back.const.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/back.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/front.const.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/front.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/index.const.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.access/index.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_iter_iter_db1.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
index c9e8167203f4e..9b94c80521b58 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
@@ -10,20 +10,20 @@
// pop_back() more than the number of elements in a deque
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+// UNSUPPORTED: libcxx-no-debug-mode
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#include <cstdlib>
#include <deque>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**) {
std::deque<int> q;
q.push_back(0);
q.pop_back();
- q.pop_back();
- std::exit(1);
+ TEST_LIBCPP_ASSERT_FAILURE(q.pop_back(), "deque::pop_back called on an empty deque");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
index 236833b1f7f9a..ade2fd45eb05d 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
@@ -13,13 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
@@ -27,8 +25,7 @@ int main(int, char**)
l1.push_back(1); l1.push_back(2); l1.push_back(3);
std::list<int>::iterator i = l1.begin();
std::list<int> l2 = l1;
- l2.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l2.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
index a38bb20d8649d..1963b6ae7fd41 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp
@@ -14,35 +14,25 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
-class A
-{
- int i_;
- double d_;
-
- A(const A&);
- A& operator=(const A&);
-public:
- A(int i, double d)
- : i_(i), d_(d) {}
-
- int geti() const {return i_;}
- double getd() const {return d_;}
+struct A {
+ explicit A(int i, double d) {
+ (void)i;
+ (void)d;
+ }
};
int main(int, char**)
{
std::list<A> c1;
std::list<A> c2;
- std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.emplace(c2.cbegin(), 2, 3.5),
+ "list::emplace(iterator, args...) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
index 53d4187f451ca..46890bfd93718 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
@@ -13,21 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with a non-dereferenceable iterator");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
index ca26688364ef3..46ada6d7a0947 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
@@ -13,13 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
@@ -27,8 +25,7 @@ int main(int, char**)
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
index de7ad4207f71c..990358718f098 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
index c9c96ae64560d..a27441e2f2f6e 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
index 31f3d1762f218..ff7ee5027c2c0 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
index 2faa1872f869d..b84f3b7735639 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable list::const_iterator");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
index 46b0281116ef8..bbc651a1867e4 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp
@@ -14,13 +14,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
+
#include "test_macros.h"
-#include "test_iterators.h"
+#include "debug_macros.h"
int main(int, char**)
{
@@ -28,11 +26,8 @@ int main(int, char**)
std::list<int> v(100);
std::list<int> v2(100);
int a[] = {1, 2, 3, 4, 5};
- const int N = sizeof(a)/sizeof(a[0]);
- std::list<int>::iterator i = v.insert(next(v2.cbegin(), 10),
- cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a+N));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(v.insert(v2.cbegin(), a, a + 5),
+ "list::insert(iterator, range) called with an iterator not referring to this list");
}
return 0;
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
index 04d6506eeb4b0..9a3495487b88f 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::list<int> v1(3);
std::list<int> v2(3);
- v1.insert(v2.begin(), 4);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(v1.insert(v2.begin(), 4),
+ "list::insert(iterator, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
index b5ece8cadb38d..f1479f8694993 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::list<int> c1(100);
std::list<int> c2;
- std::list<int>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.insert(c2.cbegin(), 5, 1),
+ "list::insert(iterator, n, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
index 1751ebc36c09d..ff61fd9d98bd6 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp
@@ -13,22 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**)
{
std::list<int> v1(3);
std::list<int> v2(3);
int i = 4;
- v1.insert(v2.begin(), i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(v1.insert(v2.begin(), i),
+ "list::insert(iterator, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
index ccc92132c913c..934d02d502a30 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
@@ -13,13 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
@@ -31,8 +30,7 @@ int main(int, char**)
assert(c == std::list<int>(a, a+1));
c.pop_back();
assert(c.empty());
- c.pop_back(); // operation under test
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "list::pop_back() called on an empty list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
index a3e0b0b9fcbf3..dd75774642d8b 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
{
std::list<int> v1(3);
std::list<int> v2(3);
- v1.splice(v2.begin(), v2);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(v1.splice(v2.begin(), v2),
+ "list::splice(iterator, list) called with an iterator not referring to this list");
}
return 0;
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
index d399a980f76e2..327a8bbd2419d 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
{
std::list<int> v1(3);
std::list<int> v2(3);
- v1.splice(v1.begin(), v2, v1.begin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.splice(v1.begin(), v2, v1.begin()),
+ "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument");
}
return 0;
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
index 1c3d2564131a3..a7c73aea7063a 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <list>
-#include <cstdlib>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
{
- std::list<int> v1(3);
- std::list<int> v2(3);
- v1.splice(v1.begin(), v2, v2.begin(), v1.end());
- assert(false);
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.splice(v1.begin(), v2, v2.begin(), v1.end()),
+ "list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument");
}
return 0;
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp
index 5f5ab3a1d58cc..80058412d3918 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_back.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -29,8 +26,7 @@ int main(int, char**) {
C c(1);
assert(c.back() == 0);
c.clear();
- assert(c.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp
index 1c1656b5dc545..99c0e73714fd3 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_back_2.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
C c(1);
assert(c.back() == 0);
c.clear();
- assert(c.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
index 868ad0a9de686..4301dc26a55e6 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
@@ -13,22 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
const C c;
- assert(c.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp
index 9f307b6a151a8..d01e440b374a8 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cback_2.pass.cpp
@@ -13,14 +13,10 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+#include "debug_macros.h"
#include "test_macros.h"
#include "min_allocator.h"
@@ -28,8 +24,7 @@ int main(int, char**) {
typedef int T;
typedef std::vector<T, min_allocator<T> > C;
const C c;
- assert(c.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.back(), "back() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
index 742b02d679f11..73fc4a231bd18 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
@@ -13,22 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
const C c;
- assert(c.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp
index adb223b85533c..6d0585f0cf009 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cfront_2.pass.cpp
@@ -13,14 +13,10 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+#include "debug_macros.h"
#include "test_macros.h"
#include "min_allocator.h"
@@ -28,8 +24,7 @@ int main(int, char**) {
typedef int T;
typedef std::vector<T, min_allocator<T> > C;
const C c;
- assert(c.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
index ddf5a91099ea0..d41d38d863896 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
@@ -13,14 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+#include "debug_macros.h"
#include "test_macros.h"
int main(int, char**)
@@ -29,8 +26,7 @@ int main(int, char**)
typedef std::vector<T> C;
const C c(1);
assert(c[0] == 0);
- assert(c[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp
index 2a9e4036eb689..1fa2dca620175 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_cindex_2.pass.cpp
@@ -13,11 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
+#include "debug_macros.h"
#include "test_macros.h"
#include "min_allocator.h"
@@ -26,8 +26,7 @@ int main(int, char**) {
typedef std::vector<T, min_allocator<T> > C;
const C c(1);
assert(c[0] == 0);
- assert(c[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp
index e0d8189b19b9a..bb2d46e0c97f1 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_front.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -29,8 +26,7 @@ int main(int, char**) {
C c(1);
assert(c.front() == 0);
c.clear();
- assert(c.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp
index 441bd2b50c08b..17840aff04728 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_front_2.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
C c(1);
assert(c.front() == 0);
c.clear();
- assert(c.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.front(), "front() called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp
index ad4ba72e7d331..4f1658e0b444d 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_index.pass.cpp
@@ -13,24 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
C c(1);
assert(c[0] == 0);
- c.clear();
- assert(c[0] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp
index 551fc1b0733cf..687db6c3dff62 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_index_2.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,9 +26,7 @@ int main(int, char**) {
typedef std::vector<T, min_allocator<T> > C;
C c(1);
assert(c[0] == 0);
- c.clear();
- assert(c[0] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c[1], "vector[] index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp
index c49cd8c34e755..f654dcaef253b 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_10.pass.cpp
@@ -13,15 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,9 +25,7 @@ int main(int, char**) {
typedef std::vector<T, min_allocator<T> > C;
C c1;
C c2;
- int i = c1.begin() - c2.begin();
- (void)i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.begin() - c2.begin(), "Attempted to subtract incompatible iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp
index 98d7cecaf60dd..dc1a589ab170b 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_11.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
C c(1);
C::iterator i = c.begin();
assert(i[0] == 0);
- assert(i[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i[1], "Attempted to subscript an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp
index 0cb183f49d728..b7eb3574c9b5f 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_12.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -32,8 +29,7 @@ int main(int, char**) {
i += 1;
assert(i == c.end());
i = c.begin();
- i += 2;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i + 2, "Attempted to add/subtract an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp
index dddf1776b310d..8a069b11c2c2d 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_13.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +28,7 @@ int main(int, char**) {
C::iterator i = c.end();
--i;
assert(i == c.begin());
- --i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(--i, "Attempted to decrement a non-decrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp
index 8b66949666461..9800610cb26af 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_14.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +28,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp
index 07508dac24d84..d585fb328c7b8 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_15.pass.cpp
@@ -13,15 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,9 +25,7 @@ int main(int, char**) {
typedef std::vector<T, min_allocator<T> > C;
C c(1);
C::iterator i = c.end();
- T j = *i;
- (void)j;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
index 50fdfbb8f1f9d..8d12f27fe4cca 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
C c1;
C c2;
- bool b = c1.begin() < c2.begin();
- (void)b;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.begin() < c2.begin(), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
index 7577bbc5b8675..8cf0535101954 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
C c1;
C c2;
- int i = c1.begin() - c2.begin();
- (void)i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.begin() - c2.begin(), "Attempted to subtract incompatible iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
index b8c9c3faf0020..1b466cb9c15f7 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -29,8 +26,7 @@ int main(int, char**) {
C c(1);
C::iterator i = c.begin();
assert(i[0] == 0);
- assert(i[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i[1], "Attempted to subscript an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
index ad3dcd5657459..44ec064242a79 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -31,8 +28,7 @@ int main(int, char**) {
i += 1;
assert(i == c.end());
i = c.begin();
- i += 2;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i + 2, "Attempted to add/subtract an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
index 94607573443d4..4ef8f42219289 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -30,8 +27,7 @@ int main(int, char**) {
C::iterator i = c.end();
--i;
assert(i == c.begin());
- --i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(--i, "Attempted to decrement a non-decrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
index f93fab3ea12e5..7a55985b1e6e4 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -30,8 +27,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
index ab4f76cc7a1e3..9fce0ce162716 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::vector<T> C;
C c(1);
C::iterator i = c.end();
- T j = *i;
- (void)j;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp
index 384fdb25d1f4a..ccdbf486bfd47 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/db_iterators_9.pass.cpp
@@ -13,15 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <vector>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,9 +25,7 @@ int main(int, char**) {
typedef std::vector<T, min_allocator<T> > C;
C c1;
C c2;
- bool b = c1.begin() < c2.begin();
- (void)b;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c1.begin() < c2.begin(), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
index 14bb8289cf78d..cfca9fd9989c6 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
@@ -13,20 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#include <cstdlib>
#include <vector>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**) {
std::vector<int> v;
v.push_back(0);
v.pop_back();
- v.pop_back();
- std::exit(1);
+ TEST_LIBCPP_ASSERT_FAILURE(v.pop_back(), "vector::pop_back called on an empty vector");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/bucket_size.pass.cpp
index fa366a056e614..cdadd45706bab 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/bucket_size.pass.cpp
@@ -17,19 +17,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
C c;
- (void) c.bucket_size(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_bucket.pass.cpp
index e7f896c8973f8..5c4bb4cbac22b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_bucket.pass.cpp
@@ -13,19 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
C c;
- (void) c.bucket(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_const_lvalue.pass.cpp
index cbda10194837c..00328a9182149 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_const_lvalue.pass.cpp
@@ -13,23 +13,28 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<double, int> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
P v(3.5, 3);
- R r = c.insert(e, v);
- assert(false);
+#if TEST_STD_VER < 11
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_map::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_map");
+#else
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_map::insert(const_iterator, value_type&&) called with an iterator not referring to this unordered_map");
+#endif
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_rvalue.pass.cpp
index e108190ca01fc..e716e6157ba4e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_insert_hint_rvalue.pass.cpp
@@ -17,22 +17,21 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<double, int> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
- R r = c.insert(e, P(3.5, 3));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, P(3.5, 3)),
+ "unordered_map::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_map");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_10.pass.cpp
index b5996a08cf4e6..6690f8a1a7879 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_10.pass.cpp
@@ -14,15 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <functional>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +28,7 @@ int main(int, char**) {
C c;
c.insert(std::make_pair(1, "one"));
C::iterator i = c.end();
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
index f73ee57153656..dfb0acb407a47 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
@@ -13,14 +13,13 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <cassert>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
@@ -29,8 +28,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
index 838e55d821a18..7f16d65c65157 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
@@ -13,22 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
C c;
c.insert(std::make_pair(1, "one"));
C::iterator i = c.end();
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_9.pass.cpp
index c9afc3bf31afc..59dc2f3ef0ed0 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_iterators_9.pass.cpp
@@ -14,15 +14,13 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <cassert>
-#include <functional>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -33,8 +31,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_10.pass.cpp
index 8448206522487..3eb7c6c1059d5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_10.pass.cpp
@@ -14,14 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <functional>
#include <string>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,8 +27,7 @@ int main(int, char**) {
min_allocator<std::pair<const int, std::string>>> C;
C c(1);
C::local_iterator i = c.end(0);
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
index 762551d264b87..7cf17924dcc7b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
@@ -13,13 +13,13 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
@@ -30,8 +30,7 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
index 1c8206bf643b9..96e6ce9367dbe 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
C c(1);
C::local_iterator i = c.end(0);
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_9.pass.cpp
index e0d3eacc0d96d..8b748591d49bb 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_9.pass.cpp
@@ -14,14 +14,13 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <functional>
#include <string>
+#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -33,8 +32,7 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_swap_1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_swap_1.pass.cpp
index 25c75cde49547..6735611a81a1d 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/db_swap_1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/db_swap_1.pass.cpp
@@ -17,12 +17,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
@@ -34,10 +33,8 @@ int main(int, char**) {
std::unordered_map<int, int>::iterator i2 = c2.begin();
swap(c1, c2);
c1.erase(i2);
- c2.erase(i1);
- std::unordered_map<int, int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/max_load_factor.pass.cpp
index c1f868ca6ebd8..1386bf83239b3 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/max_load_factor.pass.cpp
@@ -18,19 +18,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_map<int, std::string> C;
C c;
- c.max_load_factor(0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
index 123c62f5eb46d..2463a57dfc8ff 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_map<int, int> l1(a1, a1+3);
std::unordered_map<int, int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
index 66979fe6978ef..f671be5b8d509 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
@@ -13,13 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
@@ -27,8 +25,8 @@ int main(int, char**) {
std::unordered_map<int, int> l1(a1, a1+3);
std::unordered_map<int, int> l2(a1, a1+3);
std::unordered_map<int, int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
index 775b2e455383b..90f50a43585f2 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_map<int, int> l1(a1, a1+3);
std::unordered_map<int, int> l2(a1, a1+3);
- std::unordered_map<int, int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
index 1c9ba88d482cb..00802050040d8 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_map<int, int> l1(a1, a1+3);
std::unordered_map<int, int> l2(a1, a1+3);
- std::unordered_map<int, int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
index 45318d1222d49..5f3ec8301e3cd 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_map<int, int> l1(a1, a1+3);
std::unordered_map<int, int> l2(a1, a1+3);
- std::unordered_map<int, int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
index dc48098ab00d3..6404cf1d0da41 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/bucket.pass.cpp
index 25fff087b9e98..d956ac542fef2 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/bucket.pass.cpp
@@ -17,19 +17,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
C c;
- (void) c.bucket(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/bucket_size.pass.cpp
index dcd2fb31a86d2..1f8e8ff9a7791 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/bucket_size.pass.cpp
@@ -17,19 +17,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
C c;
- (void) c.bucket_size(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_const_lvalue.pass.cpp
index d5e0149a52c8e..623ba1c190a7e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_const_lvalue.pass.cpp
@@ -13,23 +13,22 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<double, int> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
P v(3.5, 3);
- R r = c.insert(e, v);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_rvalue.pass.cpp
index 127cb1808efa9..8641cecfd2232 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_insert_hint_rvalue.pass.cpp
@@ -17,22 +17,21 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<double, int> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
- R r = c.insert(e, P(3.5, 3));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, P(3.5, 3)),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_10.pass.cpp
index 8044ce371de4b..42cec3100807b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_10.pass.cpp
@@ -14,15 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#include <cassert>
-#include <functional>
#include <string>
#include <unordered_map>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +28,7 @@ int main(int, char**) {
C c;
c.insert(std::make_pair(1, "one"));
C::iterator i = c.end();
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_7.pass.cpp
index 773676578701f..c9be4ccae701d 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_7.pass.cpp
@@ -13,14 +13,13 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <cassert>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
@@ -29,8 +28,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_8.pass.cpp
index 4c9e77b9f9e27..dc9a0b6f0dc8d 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_8.pass.cpp
@@ -13,22 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#include <cassert>
#include <string>
#include <unordered_map>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
C c;
c.insert(std::make_pair(1, "one"));
C::iterator i = c.end();
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_9.pass.cpp
index 02a04d23b0a09..b1d0de934278f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_iterators_9.pass.cpp
@@ -14,15 +14,13 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <cassert>
-#include <functional>
#include <string>
#include <unordered_map>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -33,8 +31,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_10.pass.cpp
index ec675d2567ea1..3658082fd255a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_10.pass.cpp
@@ -14,15 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <functional>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
min_allocator<std::pair<const int, std::string>>> C;
C c(1);
C::local_iterator i = c.end(0);
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
index 4f48b6c8ed00e..d521a9a47fa90 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_7.pass.cpp
@@ -13,13 +13,13 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <cassert>
#include <string>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
@@ -30,8 +30,7 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
index 7b4a2f7e8fa4f..4cc131758cd0c 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_8.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
#include <string>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
C c(1);
C::local_iterator i = c.end(0);
- C::value_type j = *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_9.pass.cpp
index dede94cd6897b..fd1c1e11adefe 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_local_iterators_9.pass.cpp
@@ -14,15 +14,13 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <cassert>
-#include <functional>
#include <string>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -35,8 +33,7 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_swap_1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_swap_1.pass.cpp
index dee5841d96dad..d8bf7fef14363 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_swap_1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/db_swap_1.pass.cpp
@@ -17,13 +17,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
@@ -36,10 +34,8 @@ int main(int, char**)
std::unordered_multimap<int, int>::iterator i2 = c2.begin();
swap(c1, c2);
c1.erase(i2);
- c2.erase(i1);
- std::unordered_multimap<int, int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/max_load_factor.pass.cpp
index 57e9c2b895177..6f95c956d47a1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/max_load_factor.pass.cpp
@@ -18,19 +18,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multimap<int, std::string> C;
C c;
- c.max_load_factor(0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db1.pass.cpp
index a7aa49ca19047..acfefc51da8f9 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db1.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_multimap<int, int> l1(a1, a1+3);
std::unordered_multimap<int, int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db2.pass.cpp
index 4b016c153363e..4b62979b12681 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_db2.pass.cpp
@@ -13,13 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
@@ -27,8 +25,8 @@ int main(int, char**) {
std::unordered_multimap<int, int> l1(a1, a1+3);
std::unordered_multimap<int, int> l2(a1, a1+3);
std::unordered_multimap<int, int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db1.pass.cpp
index 332170d5301ca..edcaf969e595f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db1.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_multimap<int, int> l1(a1, a1+3);
std::unordered_multimap<int, int> l2(a1, a1+3);
- std::unordered_multimap<int, int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db2.pass.cpp
index 0bc0c1dfb03f9..c33b515e780a6 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db2.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_multimap<int, int> l1(a1, a1+3);
std::unordered_multimap<int, int> l2(a1, a1+3);
- std::unordered_multimap<int, int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db3.pass.cpp
index fc1e95db09d01..a50ab9b058a44 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db3.pass.cpp
@@ -13,21 +13,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_multimap<int, int> l1(a1, a1+3);
std::unordered_multimap<int, int> l2(a1, a1+3);
- std::unordered_multimap<int, int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db4.pass.cpp
index 8ee67b9a058f6..cc1a83667ab32 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/erase_iter_iter_db4.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_map>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::pair<int, int> P;
P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/bucket.pass.cpp
index 5bab6ed867ae5..ac543d1e8d03f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/bucket.pass.cpp
@@ -17,18 +17,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multiset<int> C;
C c;
- (void) c.bucket(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/bucket_size.pass.cpp
index ef64bcf65054e..7910713b76ac5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/bucket_size.pass.cpp
@@ -17,18 +17,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multiset<int> C;
C c;
- (void) c.bucket_size(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_insert_hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_insert_hint_const_lvalue.pass.cpp
index ffe833b696cec..88108de960372 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_insert_hint_const_lvalue.pass.cpp
@@ -13,23 +13,22 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multiset<double> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
P v(3.5);
- R r = c.insert(e, v);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_10.pass.cpp
index be24f155265bf..6f632a0667607 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_10.pass.cpp
@@ -14,13 +14,11 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -28,8 +26,7 @@ int main(int, char**) {
typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1);
C::iterator i = c.end();
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_7.pass.cpp
index 2fc397a020a31..591e898fee4bc 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_7.pass.cpp
@@ -13,12 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -29,8 +29,7 @@ int main(int, char**) {
assert(i != c.end());
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_8.pass.cpp
index d07f58db7dd88..50a837295bb8a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_8.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::unordered_multiset<T> C;
C c(1);
C::iterator i = c.end();
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_9.pass.cpp
index 29ca4a6768179..0d6f6b0287dfd 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_iterators_9.pass.cpp
@@ -14,13 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +30,7 @@ int main(int, char**) {
assert(i != c.end());
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_10.pass.cpp
index a592758e2d652..a1a1f206183a5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_10.pass.cpp
@@ -14,13 +14,11 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -28,8 +26,8 @@ int main(int, char**) {
typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1);
C::local_iterator i = c.end(0);
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
index bef45d405ec0b..bc9438d3045ec 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_7.pass.cpp
@@ -13,12 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -30,8 +30,8 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i,
+ "Attempted to increment a non-incrementable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
index 6811b60a1f3b2..f597f6a12b87b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_8.pass.cpp
@@ -13,20 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::unordered_multiset<T> C;
C c(1);
C::local_iterator i = c.end(0);
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_9.pass.cpp
index 9fbc69a446262..dce0d772c3394 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_local_iterators_9.pass.cpp
@@ -14,13 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -32,8 +31,8 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i,
+ "Attempted to increment a non-incrementable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_swap_1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_swap_1.pass.cpp
index 241af364be1cb..a7f3d84e39bf2 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_swap_1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/db_swap_1.pass.cpp
@@ -17,12 +17,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 3, 7, 9, 10};
@@ -33,10 +32,8 @@ int main(int, char**) {
std::unordered_multiset<int>::iterator i2 = c2.begin();
swap(c1, c2);
c1.erase(i2);
- c2.erase(i1);
- std::unordered_multiset<int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db1.pass.cpp
index 0b0ef5696382d..7b37704b0fcb5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db1.pass.cpp
@@ -13,19 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
std::unordered_multiset<int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db2.pass.cpp
index c5e596fc800c8..bfa8d8d09765e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_db2.pass.cpp
@@ -13,20 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
std::unordered_multiset<int> l2(a1, a1+3);
std::unordered_multiset<int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db1.pass.cpp
index 826c56d6fd38d..c468f6bdfbcae 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db1.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
std::unordered_multiset<int> l2(a1, a1+3);
- std::unordered_multiset<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db2.pass.cpp
index 0515d80100575..626ae924ac5f7 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db2.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
std::unordered_multiset<int> l2(a1, a1+3);
- std::unordered_multiset<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db3.pass.cpp
index 92ece199ce9df..195d8a6a55adf 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db3.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
std::unordered_multiset<int> l2(a1, a1+3);
- std::unordered_multiset<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db4.pass.cpp
index 0b9fba9ea75bb..d4aa964af9c00 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/erase_iter_iter_db4.pass.cpp
@@ -13,18 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/max_load_factor.pass.cpp
index aeadce5c95ae8..37c6e0b51a7b9 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/max_load_factor.pass.cpp
@@ -18,18 +18,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_multiset<int> C;
C c;
- c.max_load_factor(0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/bucket.pass.cpp
index ab12c9d473854..8abe885466466 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/bucket.pass.cpp
@@ -17,18 +17,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_set<int> C;
C c;
- (void) c.bucket(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/bucket_size.pass.cpp
index 903fc5c7e1ac5..e83440edb7519 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/bucket_size.pass.cpp
@@ -17,18 +17,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_set<int> C;
C c;
- (void) c.bucket_size(3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_insert_hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_insert_hint_const_lvalue.pass.cpp
index 8a329332a53ca..4c00e28bc6b0b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_insert_hint_const_lvalue.pass.cpp
@@ -13,23 +13,22 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_set<double> C;
- typedef C::iterator R;
typedef C::value_type P;
C c;
C c2;
C::const_iterator e = c2.end();
P v(3.5);
- R r = c.insert(e, v);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_set::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_set");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_10.pass.cpp
index 18bc81bc73fd3..3d5acd39e7011 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_10.pass.cpp
@@ -14,13 +14,11 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -28,8 +26,7 @@ int main(int, char**) {
typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1);
C::iterator i = c.end();
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_7.pass.cpp
index 03d1727b813c1..a894b76490f50 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_7.pass.cpp
@@ -13,12 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -29,8 +29,7 @@ int main(int, char**) {
assert(i != c.end());
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_8.pass.cpp
index 2216541d8255c..c874de8d80aa2 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_8.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::unordered_set<T> C;
C c(1);
C::iterator i = c.end();
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_9.pass.cpp
index 7ea8a06c724b4..aaa366925e206 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_iterators_9.pass.cpp
@@ -14,13 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +30,7 @@ int main(int, char**) {
assert(i != c.end());
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_10.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_10.pass.cpp
index 7fe62a9082db1..8cb01cdd9abd1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_10.pass.cpp
@@ -14,13 +14,11 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -28,8 +26,8 @@ int main(int, char**) {
typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1);
C::local_iterator i = c.end(0);
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_7.pass.cpp
index 5fa9983c79303..0082d836a24ec 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_7.pass.cpp
@@ -13,12 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
@@ -30,8 +30,8 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i,
+ "Attempted to increment a non-incrementable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_8.pass.cpp
index edc79b997f9c6..b5ea94061b5bf 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_8.pass.cpp
@@ -13,20 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef int T;
typedef std::unordered_set<T> C;
C c(1);
C::local_iterator i = c.end(0);
- (void) *i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_9.pass.cpp
index 89fc71aacf053..70a4140914db3 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_local_iterators_9.pass.cpp
@@ -14,13 +14,12 @@
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
#include <cassert>
-#include <functional>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -32,8 +31,8 @@ int main(int, char**) {
assert(i != c.end(b));
++i;
assert(i == c.end(b));
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i,
+ "Attempted to increment a non-incrementable unordered container const_local_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_swap_1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_swap_1.pass.cpp
index d8ef9e9f132d4..ec66313275a27 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/db_swap_1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/db_swap_1.pass.cpp
@@ -17,12 +17,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 3, 7, 9, 10};
@@ -33,10 +32,8 @@ int main(int, char**) {
std::unordered_set<int>::iterator i2 = c2.begin();
swap(c1, c2);
c1.erase(i2);
- c2.erase(i1);
- std::unordered_set<int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db1.pass.cpp
index 9e13f7daff272..0aca919026fe7 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db1.pass.cpp
@@ -13,19 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
std::unordered_set<int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db2.pass.cpp
index 37c1038dde80b..694bde8135f11 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_db2.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
std::unordered_set<int> l2(a1, a1+3);
std::unordered_set<int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
index 7b0da871cc657..5d7b104c1a102 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
std::unordered_set<int> l2(a1, a1+3);
- std::unordered_set<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
index 5c3426d5795cd..9e06601a6daf2 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
std::unordered_set<int> l2(a1, a1+3);
- std::unordered_set<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
index 20c6829ac5ee7..7bd88ebfaef43 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
@@ -13,19 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
std::unordered_set<int> l2(a1, a1+3);
- std::unordered_set<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
index 03ce934e79f52..b9c404377c74c 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
@@ -13,18 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
int a1[] = {1, 2, 3};
std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/max_load_factor.pass.cpp
index 762bf111c10a6..c4514d110ad24 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/max_load_factor.pass.cpp
@@ -18,18 +18,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::unordered_set<int> C;
C c;
- c.max_load_factor(-0.5f);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(-0.5f),
+ "unordered container::max_load_factor(lf) called with lf <= 0");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/back.const.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/back.const.pass.cpp
index 786d5edfd32da..640a7639d8b49 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/back.const.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/back.const.pass.cpp
@@ -13,16 +13,14 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string const s;
- (void) s.back();
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/back.pass.cpp
index 66a50d9678448..b6c33b0d35f72 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/back.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/back.pass.cpp
@@ -13,16 +13,14 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string s;
- (void) s.back();
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp
index f5be358a2848f..ab9e19696ac15 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_back.pass.cpp
@@ -13,23 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
S s(1, '\0');
assert(s.back() == 0);
s.clear();
- assert(s.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp
index a200b21e84ade..bb47d4889e1c7 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_back_2.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,8 +26,7 @@ int main(int, char**) {
S s(1, '\0');
assert(s.back() == 0);
s.clear();
- assert(s.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp
index 3a68ad26d931e..ce6181b38d33a 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback.pass.cpp
@@ -13,21 +13,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
const S s;
- assert(s.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp
index 8c3b344742ced..eb5f22b282fbd 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cback_2.pass.cpp
@@ -13,22 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+#include "debug_macros.h"
#include "test_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
const S s;
- assert(s.back() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "string::back(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp
index fd6aa9a937d40..8eed44c0a4f96 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront.pass.cpp
@@ -13,21 +13,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
const S s;
- assert(s.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp
index 0138e1750b977..cb8ca79a4f2d8 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cfront_2.pass.cpp
@@ -13,22 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+#include "debug_macros.h"
#include "test_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
const S s;
- assert(s.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp
index 16ac79c4cf086..3f572af89c21e 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex.pass.cpp
@@ -13,22 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
const S s;
assert(s[0] == 0);
- assert(s[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp
index a8e2dfd065327..738aac1eb00f5 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_cindex_2.pass.cpp
@@ -13,23 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
const S s;
assert(s[0] == 0);
- assert(s[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp
index 9147775effb25..0841d2f726ab4 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_front.pass.cpp
@@ -13,23 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
S s(1, '\0');
assert(s.front() == 0);
s.clear();
- assert(s.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp
index be2232dc0ff19..5b377e533f0d9 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_front_2.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,8 +26,7 @@ int main(int, char**) {
S s(1, '\0');
assert(s.front() == 0);
s.clear();
- assert(s.front() == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp
index b64d901374873..c2a6d050b357e 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_index.pass.cpp
@@ -13,22 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
S s;
assert(s[0] == 0);
- assert(s[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp
index 2b64b368b53c2..dae765dbbafa9 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/db_index_2.pass.cpp
@@ -13,23 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S s;
assert(s[0] == 0);
- assert(s[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/front.const.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/front.const.pass.cpp
index f0a984217ed35..f03e7842cbd71 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/front.const.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/front.const.pass.cpp
@@ -13,17 +13,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string const s;
- (void) s.front();
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/front.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/front.pass.cpp
index fe7d7ddf77b62..8f6e7d35a3c9a 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/front.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/front.pass.cpp
@@ -13,17 +13,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string s;
- (void) s.front();
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "string::front(): string is empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/index.const.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/index.const.pass.cpp
index f559bb887e2b7..cf5de95349d32 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/index.const.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/index.const.pass.cpp
@@ -13,19 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string const s;
char c = s[0];
assert(c == '\0');
- c = s[1];
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.access/index.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.access/index.pass.cpp
index 1680b5c7d72c9..691e0e1d82c13 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.access/index.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.access/index.pass.cpp
@@ -13,19 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::string s;
char c = s[0];
assert(c == '\0');
- c = s[1];
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s[1], "string index out of bounds");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp
index c81631019ad33..e70ad4260d12a 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_10.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S s1;
S s2;
- int i = s1.begin() - s2.begin();
- (void)i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s1.begin() - s2.begin(), "Attempted to subtract incompatible iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp
index 79eec3c36b700..28aa6711dbff3 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_11.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -29,8 +26,7 @@ int main(int, char**) {
C c(1, '\0');
C::iterator i = c.begin();
assert(i[0] == 0);
- assert(i[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i[1], "Attempted to subscript an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp
index 56966edd3cbdc..f35d29afe37c1 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_12.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -31,8 +28,7 @@ int main(int, char**) {
i += 1;
assert(i == c.end());
i = c.begin();
- i += 2;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i += 2, "Attempted to add/subtract an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp
index 25f470c8650e1..7603417b02cbd 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_13.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
C::iterator i = c.end();
--i;
assert(i == c.begin());
- --i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(--i, "Attempted to decrement a non-decrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp
index 77df2ee8c48c5..3458f8fdc06b3 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_14.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -30,8 +27,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp
index e6cb93b43d4a6..79977a75efb5e 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_15.pass.cpp
@@ -13,23 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > C;
C c(1, '\0');
C::iterator i = c.end();
- (void)*i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
index 8fcc75053e8f1..1c98997419ba0 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_2.pass.cpp
@@ -13,23 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
S s1;
S s2;
- bool b = s1.begin() < s2.begin();
- (void)b;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s1.begin() < s2.begin(), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
index aad00ff7836a4..71a92dd2a020d 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_3.pass.cpp
@@ -13,23 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string S;
S s1;
S s2;
- int i = s1.begin() - s2.begin();
- (void)i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s1.begin() - s2.begin(), "Attempted to subtract incompatible iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
index 2fa74544d9d3c..2e3feceb3b971 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_4.pass.cpp
@@ -13,23 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string C;
C c(1, '\0');
C::iterator i = c.begin();
assert(i[0] == 0);
- assert(i[1] == 0);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i[1], "Attempted to subscript an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
index 4a1ed9d66c59d..5194ed6013a73 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_5.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string C;
@@ -30,8 +27,7 @@ int main(int, char**) {
i += 1;
assert(i == c.end());
i = c.begin();
- i += 2;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(i += 2, "Attempted to add/subtract an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
index 2e2a9b30c499c..df0a4fda8d8eb 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_6.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string C;
@@ -29,8 +26,7 @@ int main(int, char**) {
C::iterator i = c.end();
--i;
assert(i == c.begin());
- --i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(--i, "Attempted to decrement a non-decrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
index 678c483f42c4e..6567ec16c17f3 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_7.pass.cpp
@@ -13,15 +13,12 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string C;
@@ -29,8 +26,7 @@ int main(int, char**) {
C::iterator i = c.begin();
++i;
assert(i == c.end());
- ++i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
index e0bc7a441a8c1..a89474c2a3a15 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_8.pass.cpp
@@ -13,22 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
typedef std::string C;
C c(1, '\0');
C::iterator i = c.end();
- (void)*i;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp
index 27d6d35391875..e1e60912d653c 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.iterators/db_iterators_9.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S s1;
S s2;
- bool b = s1.begin() < s2.begin();
- (void)b;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(s1.begin() < s2.begin(), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
index 4c80c41e910df..b1a3f015e4035 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
@@ -13,21 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <cstdlib>
-#include <exception>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
std::string::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "string::erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
index 31ba0a3388296..2a674231a9d5b 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
@@ -13,22 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <cstdlib>
-#include <exception>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
std::string l2("123");
std::string::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "string::erase(iterator) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp
index 3effc21d5ee70..d6099bb512bdd 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db3.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S l1("123");
S::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "string::erase(iterator) called with a non-dereferenceable iterator");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp
index bebbd6cbfc090..2c22912933a35 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db4.pass.cpp
@@ -13,12 +13,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
@@ -26,8 +25,8 @@ int main(int, char**) {
S l1("123");
S l2("123");
S::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
+ "string::erase(iterator) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
index 201ecb007d818..c5fe4f8989746 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
std::string l2("123");
- std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), l1.cbegin() + 1),
+ "string::erase(iterator, iterator) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
index ca4882109f11d..657c3b602a912 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
@@ -13,21 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
std::string l2("123");
- std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), l2.cbegin() + 1), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
index 1409b2daa030b..ae1d03800165d 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
std::string l2("123");
- std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), l2.cbegin() + 1),
+ "string::erase(iterator, iterator) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
index 8036d31598591..0c9f2d16819a5 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
@@ -13,20 +13,17 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
std::string l1("123");
- std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin() + 1, l1.cbegin()),
+ "string::erase(first, last) called with invalid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp
index 835be3590f476..c4ac4fe4ae1ef 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db5.pass.cpp
@@ -13,20 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S l1("123");
S l2("123");
- S::iterator i = l1.erase(l2.cbegin(), l1.cbegin() + 1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), l1.cbegin() + 1),
+ "string::erase(iterator, iterator) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp
index 9d4d2004ecfc2..b2b50998010e1 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db6.pass.cpp
@@ -13,20 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S l1("123");
S l2("123");
- S::iterator i = l1.erase(l1.cbegin(), l2.cbegin() + 1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), l2.cbegin() + 1), "Attempted to compare incomparable iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp
index e4f06eb9803ff..d51985ca78bcb 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db7.pass.cpp
@@ -13,20 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S l1("123");
S l2("123");
- S::iterator i = l1.erase(l2.cbegin(), l2.cbegin() + 1);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin() + 1, l1.cbegin()),
+ "string::erase(first, last) called with invalid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp
index b85b70bf2c011..6b5e49fafd4eb 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db8.pass.cpp
@@ -13,19 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
#include "min_allocator.h"
int main(int, char**) {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
S l1("123");
- S::iterator i = l1.erase(l1.cbegin() + 1, l1.cbegin());
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin() + 1, l1.cbegin()),
+ "string::erase(first, last) called with invalid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
index fe64f22abaf27..fecd29f9ccd90 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/erase_pop_back_db1.pass.cpp
@@ -13,20 +13,16 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
- {
- std::string s;
- s.pop_back();
- assert(false);
- }
+ std::string s;
+ TEST_LIBCPP_ASSERT_FAILURE(s.pop_back(), "string::pop_back(): string is already empty");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
index 1d72a5a7d69fa..c6a81ebfa65ae 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_char_db1.pass.cpp
@@ -13,24 +13,18 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <stdexcept>
-#include <cassert>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**)
{
- {
- typedef std::string S;
- S s;
- S s2;
- s.insert(s2.begin(), '1');
- assert(false);
- }
+ typedef std::string S;
+ S s;
+ S s2;
+ TEST_LIBCPP_ASSERT_FAILURE(s.insert(s2.begin(), '1'), "Attempted to subtract incompatible iterators");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_iter_iter_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_iter_iter_db1.pass.cpp
index 1a494397b4dc8..08ab646041755 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_iter_iter_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_iter_iter_db1.pass.cpp
@@ -14,24 +14,20 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**)
{
- {
- std::string v;
- std::string v2;
- char a[] = "123";
- const int N = sizeof(a)/sizeof(a[0]);
- std::string::iterator i = v.insert(v2.cbegin() + 10, a, a+N);
- assert(false);
- }
+ std::string v;
+ std::string v2;
+ char a[] = "123";
+ const int N = sizeof(a)/sizeof(a[0]);
+ TEST_LIBCPP_ASSERT_FAILURE(v.insert(v2.cbegin() + 10, a, a + N),
+ "Attempted to add/subtract an iterator outside its valid range");
return 0;
}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
index d488837d37c9c..1e744124eb7c3 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.modifiers/insert_iter_size_char_db1.pass.cpp
@@ -13,21 +13,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <string>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**)
{
- {
- std::string s;
- std::string s2;
- s.insert(s2.begin(), 1, 'a');
- assert(false);
- }
+ std::string s;
+ std::string s2;
+ TEST_LIBCPP_ASSERT_FAILURE(
+ s.insert(s2.begin(), 1, 'a'),
+ "string::insert(iterator, n, value) called with an iterator not referring to this string");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
index fc551da0f86ba..4fd04dd85fdeb 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
@@ -14,17 +14,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
std::optional<int> opt;
- int x = *opt; (void)x;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*opt, "optional operator* called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
index a4c853094e660..1f660fc658f05 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
@@ -14,17 +14,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
const std::optional<int> opt;
- int x = *opt; (void)x;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*opt, "optional operator* called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
index 3f09388f59a52..551e54808ab02 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
@@ -14,18 +14,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
+#include "debug_macros.h"
int main(int, char**) {
- std::optional<int> opt;
- int x = *std::move(opt); (void)x;
- assert(false);
+ const std::optional<int> opt;
+ TEST_LIBCPP_ASSERT_FAILURE(*std::move(opt), "optional operator* called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
index 20bc4a4f208c3..6df3c6c3eb45b 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
@@ -14,19 +14,15 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
-#include <utility>
#include "test_macros.h"
-
+#include "debug_macros.h"
int main(int, char**) {
std::optional<int> opt;
- int x = *std::move(opt); (void)x;
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(*std::move(opt), "optional operator* called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
index 7ff57bc285edb..a4db009e4ffff 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
@@ -14,12 +14,11 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
struct X {
int test() noexcept {return 3;}
@@ -27,8 +26,7 @@ struct X {
int main(int, char**) {
std::optional<X> opt;
- assert(opt->test() == 3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(opt->test(), "optional operator-> called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
index 005becf8a68c0..0bf2d449b98e8 100644
--- a/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
+++ b/libcxx/test/libcxx/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
@@ -14,21 +14,19 @@
// UNSUPPORTED: libcxx-no-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#include <optional>
-#include <cassert>
#include "test_macros.h"
+#include "debug_macros.h"
struct X {
- constexpr int test() const {return 3;}
+ int test() const {return 3;}
};
int main(int, char**) {
const std::optional<X> opt;
- assert(opt->test() == 3);
- assert(false);
+ TEST_LIBCPP_ASSERT_FAILURE(opt->test(), "optional operator-> called on a disengaged value");
return 0;
}
diff --git a/libcxx/test/support/debug_macros.h b/libcxx/test/support/debug_macros.h
new file mode 100644
index 0000000000000..bb1c40b0a97ea
--- /dev/null
+++ b/libcxx/test/support/debug_macros.h
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_SUPPORT_DEBUG_MACROS_H
+#define TEST_SUPPORT_DEBUG_MACROS_H
+
+#include <__debug>
+#include <cassert>
+#include <string>
+
+static const char* expected_libcpp_assert_message = 0;
+
+static void test_debug_function(std::__libcpp_debug_info const& info) {
+ if (0 == std::strcmp(info.__msg_, expected_libcpp_assert_message))
+ std::exit(0);
+ std::fprintf(stderr, "%s\n", info.what().c_str());
+ std::abort();
+}
+
+#define TEST_LIBCPP_ASSERT_FAILURE(expr, m) \
+ do { \
+ ::expected_libcpp_assert_message = m; \
+ std::__libcpp_set_debug_function(&::test_debug_function); \
+ (void)(expr); \
+ assert(false); \
+ } while (false)
+
+#endif // TEST_SUPPORT_DEBUG_MACROS_H
More information about the libcxx-commits
mailing list