[libc++] Fix several debug mode tests

These tests were only being run when _LIBCPP_DEBUG was defined, which
isn't the case by default when we run the test suite. In other words,
all these debug mode tests were never being run. This commit makes sure
they are run, and in some cases, extracts them into a file under test/libcxx
to separate them from the Standard tests.

Differential Revision: https://reviews.llvm.org/D88836
This commit is contained in:
Louis Dionne
2020-10-02 15:50:55 -04:00
parent 07cb4c013c
commit a506a66bd9
105 changed files with 749 additions and 1026 deletions

View File

@@ -11,10 +11,6 @@
// template<class InputIterator>
// iterator insert(const_iterator p, InputIterator first, InputIterator last);
#if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#endif
#include <string>
#include <cassert>
@@ -159,16 +155,6 @@ int main(int, char**)
test_exceptions(S(), 0, TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
#endif
#if _LIBCPP_DEBUG >= 1
{
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);
}
#endif
{ // test inserting into self
typedef std::string S;