mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, f, l);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = std::distance(f, l);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
@@ -48,7 +48,7 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
|
||||
assert(false);
|
||||
}
|
||||
catch (...) {}
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == aCopy);
|
||||
}
|
||||
#endif
|
||||
|
@@ -29,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = S::traits_type::length(str);
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
|
@@ -12,12 +12,11 @@
|
||||
// basic_string<charT,traits,Allocator>&
|
||||
// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str, n2);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
|
@@ -12,12 +12,11 @@
|
||||
// basic_string<charT,traits,Allocator>&
|
||||
// replace(const_iterator i1, const_iterator i2, size_type n, charT c);
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -30,7 +29,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, n2, c);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = n2;
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
|
@@ -12,12 +12,11 @@
|
||||
// basic_string<charT,traits,Allocator>&
|
||||
// replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -29,7 +28,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
typename S::size_type xlen = last - first;
|
||||
s.replace(first, last, str);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == expected);
|
||||
typename S::size_type rlen = str.size();
|
||||
assert(s.size() == old_size - xlen + rlen);
|
||||
|
@@ -13,13 +13,12 @@
|
||||
// basic_string<charT,traits,Allocator>&
|
||||
// replace(size_type pos, size_type n1, const charT* s);
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -32,7 +31,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
try
|
||||
{
|
||||
s.replace(pos, n1, str);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos <= old_size);
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
|
@@ -13,13 +13,12 @@
|
||||
// basic_string<charT,traits,Allocator>&
|
||||
// replace(size_type pos, size_type n1, const charT* s, size_type n2);
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -33,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
try
|
||||
{
|
||||
s.replace(pos, n1, str, n2);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos <= old_size);
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -31,7 +32,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
|
||||
try
|
||||
{
|
||||
s.replace(pos, n1, n2, c);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos <= old_size);
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -29,7 +30,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
|
||||
try
|
||||
{
|
||||
s.replace(pos1, n1, str);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos1 <= old_size);
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
@@ -33,7 +34,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
try
|
||||
{
|
||||
s.replace(pos1, n1, str, pos2, n2);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos1 <= old_size && pos2 <= str.size());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
@@ -58,7 +59,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
|
||||
try
|
||||
{
|
||||
s.replace(pos1, n1, str, pos2);
|
||||
assert(s.__invariants());
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(pos1 <= old_size && pos2 <= str.size());
|
||||
assert(s == expected);
|
||||
typename S::size_type xlen = std::min(n1, old_size - pos1);
|
||||
|
Reference in New Issue
Block a user