More vector debug tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178033 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
|
||||
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
|
||||
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "../../../stack_allocator.h"
|
||||
@@ -102,5 +106,13 @@ int main()
|
||||
assert(c.back().geti() == 3);
|
||||
assert(c.back().getd() == 4.5);
|
||||
}
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
{
|
||||
std::vector<A> c1;
|
||||
std::vector<A> c2;
|
||||
std::vector<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
// template <class Iter>
|
||||
// iterator insert(const_iterator position, Iter first, Iter last);
|
||||
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "../../../stack_allocator.h"
|
||||
@@ -83,4 +87,15 @@ int main()
|
||||
for (; j < 105; ++j)
|
||||
assert(v[j] == 0);
|
||||
}
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
{
|
||||
std::vector<int> v(100);
|
||||
std::vector<int> v2(100);
|
||||
int a[] = {1, 2, 3, 4, 5};
|
||||
const int N = sizeof(a)/sizeof(a[0]);
|
||||
std::vector<int>::iterator i = v.insert(v2.cbegin() + 10, input_iterator<const int*>(a),
|
||||
input_iterator<const int*>(a+N));
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
// iterator insert(const_iterator position, value_type&& x);
|
||||
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "../../../stack_allocator.h"
|
||||
@@ -43,5 +47,13 @@ int main()
|
||||
for (++j; j < 101; ++j)
|
||||
assert(v[j] == MoveOnly());
|
||||
}
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
{
|
||||
std::vector<int> v1(3);
|
||||
std::vector<int> v2(3);
|
||||
v1.insert(v2.begin(), 4);
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
// iterator insert(const_iterator position, size_type n, const value_type& x);
|
||||
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "../../../stack_allocator.h"
|
||||
@@ -43,4 +47,12 @@ int main()
|
||||
for (++j; j < 105; ++j)
|
||||
assert(v[j] == 0);
|
||||
}
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
{
|
||||
std::vector<int> c1(100);
|
||||
std::vector<int> c2;
|
||||
std::vector<int>::iterator i = c1.insert(c2.cbegin() + 10, 5, 1);
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
// iterator insert(const_iterator position, const value_type& x);
|
||||
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "../../../stack_allocator.h"
|
||||
@@ -41,4 +45,13 @@ int main()
|
||||
for (++j; j < 101; ++j)
|
||||
assert(v[j] == 0);
|
||||
}
|
||||
#if _LIBCPP_DEBUG2 >= 1
|
||||
{
|
||||
std::vector<int> v1(3);
|
||||
std::vector<int> v2(3);
|
||||
int i = 4;
|
||||
v1.insert(v2.begin(), i);
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user