Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189114 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-08-23 17:37:05 +00:00
parent e31c432a33
commit 499cea12bb
41 changed files with 1481 additions and 281 deletions

View File

@@ -26,10 +26,10 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex
typename S::size_type old_size = s.size();
typename S::const_iterator first = s.begin() + pos1;
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());
assert(s == expected);
typename S::size_type xlen = last - first;
typename S::size_type rlen = std::distance(f, l);
assert(s.size() == old_size - xlen + rlen);
}

View File

@@ -27,10 +27,10 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
typename S::size_type old_size = s.size();
typename S::const_iterator first = s.begin() + pos1;
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);
typename S::size_type xlen = last - first;
typename S::size_type rlen = S::traits_type::length(str);
assert(s.size() == old_size - xlen + rlen);
}

View File

@@ -28,10 +28,10 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S
typename S::size_type old_size = s.size();
typename S::const_iterator first = s.begin() + pos1;
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());
assert(s == expected);
typename S::size_type xlen = last - first;
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}

View File

@@ -28,10 +28,10 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size
typename S::size_type old_size = s.size();
typename S::const_iterator first = s.begin() + pos1;
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());
assert(s == expected);
typename S::size_type xlen = last - first;
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}

View File

@@ -27,10 +27,10 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
typename S::size_type old_size = s.size();
typename S::const_iterator first = s.begin() + pos1;
typename S::const_iterator last = s.begin() + pos1 + n1;
typename S::size_type xlen = last - first;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);
typename S::size_type xlen = last - first;
typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
}