[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
This commit is contained in:
Kristina Bessonova 2021-04-18 18:46:46 +02:00
parent 38e2359a11
commit 9f4f012c10
177 changed files with 516 additions and 962 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More