summaryrefslogtreecommitdiffstats
path: root/libcxx/test/strings/basic.string/string.modifiers/string_replace
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-06-28 16:59:19 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-06-28 16:59:19 +0000
commiteec721826cc35a0c08dc5bc54db9a51dbd4fa361 (patch)
treebe3ea93c71256a122174477e4e8b0024bca43ee7 /libcxx/test/strings/basic.string/string.modifiers/string_replace
parente852add40ed7d93da626d4e2286c840afb9d98d8 (diff)
downloadbcm5719-llvm-eec721826cc35a0c08dc5bc54db9a51dbd4fa361.tar.gz
bcm5719-llvm-eec721826cc35a0c08dc5bc54db9a51dbd4fa361.zip
Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
llvm-svn: 185167
Diffstat (limited to 'libcxx/test/strings/basic.string/string.modifiers/string_replace')
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp10
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp94
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp35
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp61
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp37
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp35
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp33
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp69
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp33
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp33
-rw-r--r--libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp243
11 files changed, 491 insertions, 192 deletions
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
index def2629f2d0..6bc7148be4b 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
@@ -14,6 +14,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -22,5 +24,13 @@ int main()
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
assert(s == "123abc456");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ S s("123def456");
+ s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
+ assert(s == "123abc456");
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
index be89f60fd65..37262f13c77 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
@@ -17,7 +17,7 @@
#include <iterator>
#include <cassert>
-#include <stdio.h>
+#include "../../min_allocator.h"
template <class S, class It>
void
@@ -34,10 +34,9 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex
assert(s.size() == old_size - xlen + rlen);
}
-typedef std::string S;
-
const char* str = "12345678901234567890";
+template <class S>
void test0()
{
test(S(""), 0, 0, str, str+0, S(""));
@@ -119,29 +118,30 @@ void test0()
test(S("abcde"), 0, 4, str, str+1, S("1e"));
test(S("abcde"), 0, 4, str, str+10, S("1234567890e"));
test(S("abcde"), 0, 4, str, str+19, S("1234567890123456789e"));
-// test(S("abcde"), 0, 4, str, str+20, S("12345678901234567890e"));
-// test(S("abcde"), 0, 5, str, str+0, S(""));
-// test(S("abcde"), 0, 5, str, str+0, S(""));
-// test(S("abcde"), 0, 5, str, str+1, S("1"));
-// test(S("abcde"), 0, 5, str, str+2, S("12"));
-// test(S("abcde"), 0, 5, str, str+4, S("1234"));
-// test(S("abcde"), 0, 5, str, str+5, S("12345"));
-// test(S("abcde"), 0, 5, str, str+0, S(""));
-// test(S("abcde"), 0, 5, str, str+1, S("1"));
-// test(S("abcde"), 0, 5, str, str+5, S("12345"));
-// test(S("abcde"), 0, 5, str, str+9, S("123456789"));
-// test(S("abcde"), 0, 5, str, str+10, S("1234567890"));
-// test(S("abcde"), 0, 5, str, str+0, S(""));
-// test(S("abcde"), 0, 5, str, str+1, S("1"));
-// test(S("abcde"), 0, 5, str, str+10, S("1234567890"));
-// test(S("abcde"), 0, 5, str, str+19, S("1234567890123456789"));
-// test(S("abcde"), 0, 5, str, str+20, S("12345678901234567890"));
-// test(S("abcde"), 1, 0, str, str+0, S("abcde"));
-// test(S("abcde"), 1, 0, str, str+0, S("abcde"));
-// test(S("abcde"), 1, 0, str, str+1, S("a1bcde"));
-// test(S("abcde"), 1, 0, str, str+2, S("a12bcde"));
+ test(S("abcde"), 0, 4, str, str+20, S("12345678901234567890e"));
+ test(S("abcde"), 0, 5, str, str+0, S(""));
+ test(S("abcde"), 0, 5, str, str+0, S(""));
+ test(S("abcde"), 0, 5, str, str+1, S("1"));
+ test(S("abcde"), 0, 5, str, str+2, S("12"));
+ test(S("abcde"), 0, 5, str, str+4, S("1234"));
+ test(S("abcde"), 0, 5, str, str+5, S("12345"));
+ test(S("abcde"), 0, 5, str, str+0, S(""));
+ test(S("abcde"), 0, 5, str, str+1, S("1"));
+ test(S("abcde"), 0, 5, str, str+5, S("12345"));
+ test(S("abcde"), 0, 5, str, str+9, S("123456789"));
+ test(S("abcde"), 0, 5, str, str+10, S("1234567890"));
+ test(S("abcde"), 0, 5, str, str+0, S(""));
+ test(S("abcde"), 0, 5, str, str+1, S("1"));
+ test(S("abcde"), 0, 5, str, str+10, S("1234567890"));
+ test(S("abcde"), 0, 5, str, str+19, S("1234567890123456789"));
+ test(S("abcde"), 0, 5, str, str+20, S("12345678901234567890"));
+ test(S("abcde"), 1, 0, str, str+0, S("abcde"));
+ test(S("abcde"), 1, 0, str, str+0, S("abcde"));
+ test(S("abcde"), 1, 0, str, str+1, S("a1bcde"));
+ test(S("abcde"), 1, 0, str, str+2, S("a12bcde"));
}
-/*
+
+template <class S>
void test1()
{
test(S("abcde"), 1, 0, str, str+4, S("a1234bcde"));
@@ -246,6 +246,7 @@ void test1()
test(S("abcde"), 2, 1, str, str+1, S("ab1de"));
}
+template <class S>
void test2()
{
test(S("abcde"), 2, 1, str, str+5, S("ab12345de"));
@@ -350,6 +351,7 @@ void test2()
test(S("abcdefghij"), 0, 0, str, str+0, S("abcdefghij"));
}
+template <class S>
void test3()
{
test(S("abcdefghij"), 0, 0, str, str+1, S("1abcdefghij"));
@@ -454,6 +456,7 @@ void test3()
test(S("abcdefghij"), 1, 1, str, str+20, S("a12345678901234567890cdefghij"));
}
+template <class S>
void test4()
{
test(S("abcdefghij"), 1, 4, str, str+0, S("afghij"));
@@ -558,6 +561,7 @@ void test4()
test(S("abcdefghij"), 5, 4, str, str+2, S("abcde12j"));
}
+template <class S>
void test5()
{
test(S("abcdefghij"), 5, 4, str, str+4, S("abcde1234j"));
@@ -662,6 +666,7 @@ void test5()
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+1, S("1bcdefghijklmnopqrst"));
}
+template <class S>
void test6()
{
test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst"));
@@ -766,6 +771,7 @@ void test6()
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+0, S("aklmnopqrst"));
}
+template <class S>
void test7()
{
test(S("abcdefghijklmnopqrst"), 1, 9, str, str+1, S("a1klmnopqrst"));
@@ -870,6 +876,7 @@ void test7()
test(S("abcdefghijklmnopqrst"), 10, 9, str, str+20, S("abcdefghij12345678901234567890t"));
}
+template <class S>
void test8()
{
test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij"));
@@ -937,16 +944,33 @@ void test8()
test(S("abcdefghijklmnopqrst"), 20, 0, str, str+19, S("abcdefghijklmnopqrst1234567890123456789"));
test(S("abcdefghijklmnopqrst"), 20, 0, str, str+20, S("abcdefghijklmnopqrst12345678901234567890"));
}
-*/
+
int main()
{
- test0();
-// test1();
-// test2();
-// test3();
-// test4();
-// test5();
-// test6();
-// test7();
-// test8();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
index c1faafc9c8f..58a4b20c2f2 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
@@ -18,22 +18,24 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str, S expected)
+test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, S expected)
{
- S::size_type old_size = s.size();
- S::const_iterator first = s.begin() + pos1;
- S::const_iterator last = s.begin() + pos1 + n1;
+ 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;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);
- S::size_type xlen = last - first;
- S::size_type rlen = S::traits_type::length(str);
+ typename S::size_type xlen = last - first;
+ typename S::size_type rlen = S::traits_type::length(str);
assert(s.size() == old_size - xlen + rlen);
}
+template <class S>
void test0()
{
test(S(""), 0, 0, "", S(""));
@@ -138,6 +140,7 @@ void test0()
test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij"));
}
+template <class S>
void test1()
{
test(S("abcdefghij"), 1, 4, "", S("afghij"));
@@ -242,6 +245,7 @@ void test1()
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij"));
@@ -264,7 +268,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
index 24beb4c4d88..0ef59ed7771 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
@@ -18,23 +18,25 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str,
- S::size_type n2, S expected)
+test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str,
+ typename S::size_type n2, S expected)
{
- S::size_type old_size = s.size();
- S::const_iterator first = s.begin() + pos1;
- S::const_iterator last = s.begin() + pos1 + n1;
+ 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;
s.replace(first, last, str, n2);
assert(s.__invariants());
assert(s == expected);
- S::size_type xlen = last - first;
- S::size_type rlen = n2;
+ typename S::size_type xlen = last - first;
+ typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
+template <class S>
void test0()
{
test(S(""), 0, 0, "", 0, S(""));
@@ -139,6 +141,7 @@ void test0()
test(S("abcde"), 1, 0, "12345", 2, S("a12bcde"));
}
+template <class S>
void test1()
{
test(S("abcde"), 1, 0, "12345", 4, S("a1234bcde"));
@@ -243,6 +246,7 @@ void test1()
test(S("abcde"), 2, 1, "1234567890", 1, S("ab1de"));
}
+template <class S>
void test2()
{
test(S("abcde"), 2, 1, "1234567890", 5, S("ab12345de"));
@@ -347,6 +351,7 @@ void test2()
test(S("abcdefghij"), 0, 0, "12345678901234567890", 0, S("abcdefghij"));
}
+template <class S>
void test3()
{
test(S("abcdefghij"), 0, 0, "12345678901234567890", 1, S("1abcdefghij"));
@@ -451,6 +456,7 @@ void test3()
test(S("abcdefghij"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghij"));
}
+template <class S>
void test4()
{
test(S("abcdefghij"), 1, 4, "", 0, S("afghij"));
@@ -555,6 +561,7 @@ void test4()
test(S("abcdefghij"), 5, 4, "12345", 2, S("abcde12j"));
}
+template <class S>
void test5()
{
test(S("abcdefghij"), 5, 4, "12345", 4, S("abcde1234j"));
@@ -659,6 +666,7 @@ void test5()
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 1, S("1bcdefghijklmnopqrst"));
}
+template <class S>
void test6()
{
test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 5, S("12345bcdefghijklmnopqrst"));
@@ -763,6 +771,7 @@ void test6()
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 0, S("aklmnopqrst"));
}
+template <class S>
void test7()
{
test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 1, S("a1klmnopqrst"));
@@ -867,6 +876,7 @@ void test7()
test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 20, S("abcdefghij12345678901234567890t"));
}
+template <class S>
void test8()
{
test(S("abcdefghijklmnopqrst"), 10, 10, "", 0, S("abcdefghij"));
@@ -937,13 +947,30 @@ void test8()
int main()
{
- test0();
- test1();
- test2();
- test3();
- test4();
- test5();
- test6();
- test7();
- test8();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
index 05b7d4b54ee..6525607d7a7 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
@@ -18,23 +18,25 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1, S::size_type n2,
- S::value_type c, S expected)
+test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size_type n2,
+ typename S::value_type c, S expected)
{
- S::size_type old_size = s.size();
- S::const_iterator first = s.begin() + pos1;
- S::const_iterator last = s.begin() + pos1 + n1;
+ 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;
s.replace(first, last, n2, c);
assert(s.__invariants());
assert(s == expected);
- S::size_type xlen = last - first;
- S::size_type rlen = n2;
+ typename S::size_type xlen = last - first;
+ typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
+template <class S>
void test0()
{
test(S(""), 0, 0, 0, '3', S(""));
@@ -139,6 +141,7 @@ void test0()
test(S("abcdefghij"), 1, 1, 20, '3', S("a33333333333333333333cdefghij"));
}
+template <class S>
void test1()
{
test(S("abcdefghij"), 1, 4, 0, '3', S("afghij"));
@@ -243,6 +246,7 @@ void test1()
test(S("abcdefghijklmnopqrst"), 10, 9, 20, '3', S("abcdefghij33333333333333333333t"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '3', S("abcdefghij"));
@@ -265,7 +269,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
index 12df01154c8..76db558c2e5 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
@@ -18,22 +18,24 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1, S str, S expected)
+test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected)
{
- S::size_type old_size = s.size();
- S::const_iterator first = s.begin() + pos1;
- S::const_iterator last = s.begin() + pos1 + n1;
+ 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;
s.replace(first, last, str);
assert(s.__invariants());
assert(s == expected);
- S::size_type xlen = last - first;
- S::size_type rlen = str.size();
+ typename S::size_type xlen = last - first;
+ typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
}
+template <class S>
void test0()
{
test(S(""), 0, 0, S(""), S(""));
@@ -138,6 +140,7 @@ void test0()
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
}
+template <class S>
void test1()
{
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
@@ -242,6 +245,7 @@ void test1()
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
@@ -264,7 +268,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index 99d7d995d35..4dd1a828af7 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -19,13 +19,14 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos, S::size_type n1,
- const S::value_type* str, S expected)
+test(S s, typename S::size_type pos, typename S::size_type n1,
+ const typename S::value_type* str, S expected)
{
- S::size_type old_size = s.size();
+ typename S::size_type old_size = s.size();
S s0 = s;
try
{
@@ -33,8 +34,8 @@ test(S s, S::size_type pos, S::size_type n1,
assert(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
- S::size_type xlen = std::min(n1, old_size - pos);
- S::size_type rlen = S::traits_type::length(str);
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = S::traits_type::length(str);
assert(s.size() == old_size - xlen + rlen);
}
catch (std::out_of_range&)
@@ -44,6 +45,7 @@ test(S s, S::size_type pos, S::size_type n1,
}
}
+template <class S>
void test0()
{
test(S(""), 0, 0, "", S(""));
@@ -148,6 +150,7 @@ void test0()
test(S("abcde"), 5, 1, "12345678901234567890", S("abcde12345678901234567890"));
}
+template <class S>
void test1()
{
test(S("abcde"), 6, 0, "", S("can't happen"));
@@ -252,6 +255,7 @@ void test1()
test(S("abcdefghij"), 11, 0, "12345678901234567890", S("can't happen"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
@@ -354,7 +358,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index 3f581838de2..0b4aeafdab1 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -19,14 +19,15 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos, S::size_type n1,
- const S::value_type* str, S::size_type n2,
+test(S s, typename S::size_type pos, typename S::size_type n1,
+ const typename S::value_type* str, typename S::size_type n2,
S expected)
{
- S::size_type old_size = s.size();
+ typename S::size_type old_size = s.size();
S s0 = s;
try
{
@@ -34,8 +35,8 @@ test(S s, S::size_type pos, S::size_type n1,
assert(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
- S::size_type xlen = std::min(n1, old_size - pos);
- S::size_type rlen = n2;
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
catch (std::out_of_range&)
@@ -45,6 +46,7 @@ test(S s, S::size_type pos, S::size_type n1,
}
}
+template <class S>
void test0()
{
test(S(""), 0, 0, "", 0, S(""));
@@ -149,6 +151,7 @@ void test0()
test(S("abcde"), 0, 4, "12345", 2, S("12e"));
}
+template <class S>
void test1()
{
test(S("abcde"), 0, 4, "12345", 4, S("1234e"));
@@ -253,6 +256,7 @@ void test1()
test(S("abcde"), 1, 3, "1234567890", 1, S("a1e"));
}
+template <class S>
void test2()
{
test(S("abcde"), 1, 3, "1234567890", 5, S("a12345e"));
@@ -357,6 +361,7 @@ void test2()
test(S("abcde"), 2, 3, "12345678901234567890", 0, S("ab"));
}
+template <class S>
void test3()
{
test(S("abcde"), 2, 3, "12345678901234567890", 1, S("ab1"));
@@ -461,6 +466,7 @@ void test3()
test(S("abcde"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890"));
}
+template <class S>
void test4()
{
test(S("abcde"), 6, 0, "", 0, S("can't happen"));
@@ -565,6 +571,7 @@ void test4()
test(S("abcdefghij"), 0, 11, "12345", 2, S("12"));
}
+template <class S>
void test5()
{
test(S("abcdefghij"), 0, 11, "12345", 4, S("1234"));
@@ -669,6 +676,7 @@ void test5()
test(S("abcdefghij"), 1, 10, "1234567890", 1, S("a1"));
}
+template <class S>
void test6()
{
test(S("abcdefghij"), 1, 10, "1234567890", 5, S("a12345"));
@@ -773,6 +781,7 @@ void test6()
test(S("abcdefghij"), 5, 6, "12345678901234567890", 0, S("abcde"));
}
+template <class S>
void test7()
{
test(S("abcdefghij"), 5, 6, "12345678901234567890", 1, S("abcde1"));
@@ -877,6 +886,7 @@ void test7()
test(S("abcdefghij"), 11, 0, "12345678901234567890", 20, S("can't happen"));
}
+template <class S>
void test8()
{
test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, S("abcdefghijklmnopqrst"));
@@ -981,6 +991,7 @@ void test8()
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 2, S("a12bcdefghijklmnopqrst"));
}
+template <class S>
void test9()
{
test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 4, S("a1234bcdefghijklmnopqrst"));
@@ -1085,6 +1096,7 @@ void test9()
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 1, S("abcdefghij1klmnopqrst"));
}
+template <class S>
void test10()
{
test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 5, S("abcdefghij12345klmnopqrst"));
@@ -1189,6 +1201,7 @@ void test10()
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
}
+template <class S>
void test11()
{
test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t"));
@@ -1279,16 +1292,36 @@ void test11()
int main()
{
- test0();
- test1();
- test2();
- test3();
- test4();
- test5();
- test6();
- test7();
- test8();
- test9();
- test10();
- test11();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ test9<S>();
+ test10<S>();
+ test11<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ test9<S>();
+ test10<S>();
+ test11<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index b41dc2bc06c..f8e13b83b58 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -17,14 +17,15 @@
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos, S::size_type n1,
- S::size_type n2, S::value_type c,
+test(S s, typename S::size_type pos, typename S::size_type n1,
+ typename S::size_type n2, typename S::value_type c,
S expected)
{
- S::size_type old_size = s.size();
+ typename S::size_type old_size = s.size();
S s0 = s;
try
{
@@ -32,8 +33,8 @@ test(S s, S::size_type pos, S::size_type n1,
assert(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
- S::size_type xlen = std::min(n1, old_size - pos);
- S::size_type rlen = n2;
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
catch (std::out_of_range&)
@@ -43,6 +44,7 @@ test(S s, S::size_type pos, S::size_type n1,
}
}
+template <class S>
void test0()
{
test(S(""), 0, 0, 0, '2', S(""));
@@ -147,6 +149,7 @@ void test0()
test(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222"));
}
+template <class S>
void test1()
{
test(S("abcde"), 6, 0, 0, '2', S("can't happen"));
@@ -251,6 +254,7 @@ void test1()
test(S("abcdefghij"), 11, 0, 20, '2', S("can't happen"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst"));
@@ -353,7 +357,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index b64aa123c06..08e906884df 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -12,19 +12,18 @@
// basic_string<charT,traits,Allocator>&
// replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str);
-#include <stdio.h>
-
#include <string>
#include <stdexcept>
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1, S str, S expected)
+test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected)
{
- S::size_type old_size = s.size();
+ typename S::size_type old_size = s.size();
S s0 = s;
try
{
@@ -32,8 +31,8 @@ test(S s, S::size_type pos1, S::size_type n1, S str, S expected)
assert(s.__invariants());
assert(pos1 <= old_size);
assert(s == expected);
- S::size_type xlen = std::min(n1, old_size - pos1);
- S::size_type rlen = str.size();
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
}
catch (std::out_of_range&)
@@ -43,6 +42,7 @@ test(S s, S::size_type pos1, S::size_type n1, S str, S expected)
}
}
+template <class S>
void test0()
{
test(S(""), 0, 0, S(""), S(""));
@@ -147,6 +147,7 @@ void test0()
test(S("abcde"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890"));
}
+template <class S>
void test1()
{
test(S("abcde"), 6, 0, S(""), S("can't happen"));
@@ -251,6 +252,7 @@ void test1()
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), S("can't happen"));
}
+template <class S>
void test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
@@ -353,7 +355,18 @@ void test2()
int main()
{
- test0();
- test1();
- test2();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ }
+#endif
}
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index e7bc351b4c9..099980015ee 100644
--- a/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -13,21 +13,20 @@
// replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str,
// size_type pos2, size_type n2);
-#include <stdio.h>
-
#include <string>
#include <stdexcept>
#include <algorithm>
#include <cassert>
-typedef std::string S;
+#include "../../min_allocator.h"
+template <class S>
void
-test(S s, S::size_type pos1, S::size_type n1,
- S str, S::size_type pos2, S::size_type n2,
+test(S s, typename S::size_type pos1, typename S::size_type n1,
+ S str, typename S::size_type pos2, typename S::size_type n2,
S expected)
{
- S::size_type old_size = s.size();
+ typename S::size_type old_size = s.size();
S s0 = s;
try
{
@@ -35,8 +34,8 @@ test(S s, S::size_type pos1, S::size_type n1,
assert(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
- S::size_type xlen = std::min(n1, old_size - pos1);
- S::size_type rlen = std::min(n2, str.size() - pos2);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = std::min(n2, str.size() - pos2);
assert(s.size() == old_size - xlen + rlen);
}
catch (std::out_of_range&)
@@ -46,6 +45,7 @@ test(S s, S::size_type pos1, S::size_type n1,
}
}
+template <class S>
void test0()
{
test(S(""), 0, 0, S(""), 0, 0, S(""));
@@ -150,6 +150,7 @@ void test0()
test(S(""), 0, 1, S("12345"), 6, 0, S("can't happen"));
}
+template <class S>
void test1()
{
test(S(""), 0, 1, S("1234567890"), 0, 0, S(""));
@@ -254,6 +255,7 @@ void test1()
test(S(""), 1, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
}
+template <class S>
void test2()
{
test(S(""), 1, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
@@ -358,6 +360,7 @@ void test2()
test(S("abcde"), 0, 1, S("12345"), 0, 0, S("bcde"));
}
+template <class S>
void test3()
{
test(S("abcde"), 0, 1, S("12345"), 0, 1, S("1bcde"));
@@ -462,6 +465,7 @@ void test3()
test(S("abcde"), 0, 2, S("1234567890"), 0, 9, S("123456789cde"));
}
+template <class S>
void test4()
{
test(S("abcde"), 0, 2, S("1234567890"), 0, 10, S("1234567890cde"));
@@ -566,6 +570,7 @@ void test4()
test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 21, S("12345678901234567890e"));
}
+template <class S>
void test5()
{
test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 0, S("e"));
@@ -670,6 +675,7 @@ void test5()
test(S("abcde"), 0, 6, S("12345"), 0, 5, S("12345"));
}
+template <class S>
void test6()
{
test(S("abcde"), 0, 6, S("12345"), 0, 6, S("12345"));
@@ -774,6 +780,7 @@ void test6()
test(S("abcde"), 1, 0, S("1234567890"), 1, 1, S("a2bcde"));
}
+template <class S>
void test7()
{
test(S("abcde"), 1, 0, S("1234567890"), 1, 4, S("a2345bcde"));
@@ -878,6 +885,7 @@ void test7()
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cde"));
}
+template <class S>
void test8()
{
test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cde"));
@@ -982,6 +990,7 @@ void test8()
test(S("abcde"), 1, 3, S("12345"), 1, 2, S("a23e"));
}
+template <class S>
void test9()
{
test(S("abcde"), 1, 3, S("12345"), 1, 3, S("a234e"));
@@ -1086,6 +1095,7 @@ void test9()
test(S("abcde"), 1, 4, S("1234567890"), 1, 10, S("a234567890"));
}
+template <class S>
void test10()
{
test(S("abcde"), 1, 4, S("1234567890"), 5, 0, S("a"));
@@ -1190,6 +1200,7 @@ void test10()
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 1, S("a1"));
}
+template <class S>
void test11()
{
test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 5, S("a12345"));
@@ -1294,6 +1305,7 @@ void test11()
test(S("abcde"), 2, 1, S("12345"), 2, 0, S("abde"));
}
+template <class S>
void test12()
{
test(S("abcde"), 2, 1, S("12345"), 2, 1, S("ab3de"));
@@ -1398,6 +1410,7 @@ void test12()
test(S("abcde"), 2, 2, S("1234567890"), 5, 4, S("ab6789e"));
}
+template <class S>
void test13()
{
test(S("abcde"), 2, 2, S("1234567890"), 5, 5, S("ab67890e"));
@@ -1502,6 +1515,7 @@ void test13()
test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 11, S("ab1234567890"));
}
+template <class S>
void test14()
{
test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 0, S("ab"));
@@ -1606,6 +1620,7 @@ void test14()
test(S("abcde"), 4, 0, S("12345"), 2, 4, S("abcd345e"));
}
+template <class S>
void test15()
{
test(S("abcde"), 4, 0, S("12345"), 4, 0, S("abcde"));
@@ -1710,6 +1725,7 @@ void test15()
test(S("abcde"), 4, 1, S("1234567890"), 9, 1, S("abcd0"));
}
+template <class S>
void test16()
{
test(S("abcde"), 4, 1, S("1234567890"), 9, 2, S("abcd0"));
@@ -1814,6 +1830,7 @@ void test16()
test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 0, S("abcd"));
}
+template <class S>
void test17()
{
test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 1, S("abcd"));
@@ -1918,6 +1935,7 @@ void test17()
test(S("abcde"), 5, 1, S("12345"), 5, 0, S("abcde"));
}
+template <class S>
void test18()
{
test(S("abcde"), 5, 1, S("12345"), 5, 1, S("abcde"));
@@ -2022,6 +2040,7 @@ void test18()
test(S("abcde"), 6, 0, S("1234567890"), 11, 0, S("can't happen"));
}
+template <class S>
void test19()
{
test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
@@ -2126,6 +2145,7 @@ void test19()
test(S("abcdefghij"), 0, 1, S(""), 0, 1, S("bcdefghij"));
}
+template <class S>
void test20()
{
test(S("abcdefghij"), 0, 1, S(""), 1, 0, S("can't happen"));
@@ -2230,6 +2250,7 @@ void test20()
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 1, S("1fghij"));
}
+template <class S>
void test21()
{
test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 5, S("12345fghij"));
@@ -2334,6 +2355,7 @@ void test21()
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 19, S("1234567890123456789j"));
}
+template <class S>
void test22()
{
test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 20, S("12345678901234567890j"));
@@ -2438,6 +2460,7 @@ void test22()
test(S("abcdefghij"), 0, 11, S("12345"), 0, 2, S("12"));
}
+template <class S>
void test23()
{
test(S("abcdefghij"), 0, 11, S("12345"), 0, 4, S("1234"));
@@ -2542,6 +2565,7 @@ void test23()
test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghij"));
}
+template <class S>
void test24()
{
test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 0, S("abcdefghij"));
@@ -2646,6 +2670,7 @@ void test24()
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghij"));
}
+template <class S>
void test25()
{
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghij"));
@@ -2750,6 +2775,7 @@ void test25()
test(S("abcdefghij"), 1, 8, S("12345"), 1, 0, S("aj"));
}
+template <class S>
void test26()
{
test(S("abcdefghij"), 1, 8, S("12345"), 1, 1, S("a2j"));
@@ -2854,6 +2880,7 @@ void test26()
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 8, S("a23456789"));
}
+template <class S>
void test27()
{
test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 9, S("a234567890"));
@@ -2958,6 +2985,7 @@ void test27()
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
}
+template <class S>
void test28()
{
test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 0, S("a"));
@@ -3062,6 +3090,7 @@ void test28()
test(S("abcdefghij"), 5, 1, S("12345"), 1, 4, S("abcde2345ghij"));
}
+template <class S>
void test29()
{
test(S("abcdefghij"), 5, 1, S("12345"), 1, 5, S("abcde2345ghij"));
@@ -3166,6 +3195,7 @@ void test29()
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 1, S("abcde6hij"));
}
+template <class S>
void test30()
{
test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 2, S("abcde67hij"));
@@ -3270,6 +3300,7 @@ void test30()
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 9, S("abcde123456789j"));
}
+template <class S>
void test31()
{
test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 10, S("abcde1234567890j"));
@@ -3374,6 +3405,7 @@ void test31()
test(S("abcdefghij"), 5, 6, S("12345"), 2, 2, S("abcde34"));
}
+template <class S>
void test32()
{
test(S("abcdefghij"), 5, 6, S("12345"), 2, 3, S("abcde345"));
@@ -3478,6 +3510,7 @@ void test32()
test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 6, S("abcdefghi67890j"));
}
+template <class S>
void test33()
{
test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 0, S("abcdefghij"));
@@ -3582,6 +3615,7 @@ void test33()
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 1, S("abcdefghi0"));
}
+template <class S>
void test34()
{
test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 2, S("abcdefghi0"));
@@ -3686,6 +3720,7 @@ void test34()
test(S("abcdefghij"), 10, 0, S("12345"), 4, 1, S("abcdefghij5"));
}
+template <class S>
void test35()
{
test(S("abcdefghij"), 10, 0, S("12345"), 4, 2, S("abcdefghij5"));
@@ -3790,6 +3825,7 @@ void test35()
test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 0, S("abcdefghij"));
}
+template <class S>
void test36()
{
test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 1, S("abcdefghij"));
@@ -3894,6 +3930,7 @@ void test36()
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
}
+template <class S>
void test37()
{
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
@@ -3998,6 +4035,7 @@ void test37()
test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 6, 0, S("can't happen"));
}
+template <class S>
void test38()
{
test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 0, S("bcdefghijklmnopqrst"));
@@ -4102,6 +4140,7 @@ void test38()
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 1, S("1klmnopqrst"));
}
+template <class S>
void test39()
{
test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890klmnopqrst"));
@@ -4206,6 +4245,7 @@ void test39()
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 0, S(""));
}
+template <class S>
void test40()
{
test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 1, S("1"));
@@ -4310,6 +4350,7 @@ void test40()
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 9, S("123456789"));
}
+template <class S>
void test41()
{
test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 10, S("1234567890"));
@@ -4414,6 +4455,7 @@ void test41()
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
}
+template <class S>
void test42()
{
test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
@@ -4518,6 +4560,7 @@ void test42()
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 5, S("a12345klmnopqrst"));
}
+template <class S>
void test43()
{
test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 6, S("a12345klmnopqrst"));
@@ -4622,6 +4665,7 @@ void test43()
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 1, S("a2t"));
}
+template <class S>
void test44()
{
test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 4, S("a2345t"));
@@ -4726,6 +4770,7 @@ void test44()
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
}
+template <class S>
void test45()
{
test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
@@ -4830,6 +4875,7 @@ void test45()
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
}
+template <class S>
void test46()
{
test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
@@ -4934,6 +4980,7 @@ void test46()
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst"));
}
+template <class S>
void test47()
{
test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 0, S("abcdefghijlmnopqrst"));
@@ -5038,6 +5085,7 @@ void test47()
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 1, S("abcdefghij1pqrst"));
}
+template <class S>
void test48()
{
test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst"));
@@ -5142,6 +5190,7 @@ void test48()
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 0, S("abcdefghij"));
}
+template <class S>
void test49()
{
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 1, S("abcdefghij3"));
@@ -5246,6 +5295,7 @@ void test49()
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 4, S("abcdefghij6789"));
}
+template <class S>
void test50()
{
test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 5, S("abcdefghij67890"));
@@ -5350,6 +5400,7 @@ void test50()
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
}
+template <class S>
void test51()
{
test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
@@ -5454,6 +5505,7 @@ void test51()
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
}
+template <class S>
void test52()
{
test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 0, S("abcdefghijklmnopqrs"));
@@ -5558,6 +5610,7 @@ void test52()
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
}
+template <class S>
void test53()
{
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
@@ -5662,6 +5715,7 @@ void test53()
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
}
+template <class S>
void test54()
{
test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
@@ -5744,59 +5798,122 @@ void test54()
int main()
{
- test0();
- test1();
- test2();
- test3();
- test4();
- test5();
- test6();
- test7();
- test8();
- test9();
- test10();
- test11();
- test12();
- test13();
- test14();
- test15();
- test16();
- test17();
- test18();
- test19();
- test20();
- test21();
- test22();
- test23();
- test24();
- test25();
- test26();
- test27();
- test28();
- test29();
- test30();
- test31();
- test32();
- test33();
- test34();
- test35();
- test36();
- test37();
- test38();
- test39();
- test40();
- test41();
- test42();
- test43();
- test44();
- test45();
- test46();
- test47();
- test48();
- test49();
- test50();
- test51();
- test52();
- test53();
- test54();
+ {
+ typedef std::string S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ test9<S>();
+ test10<S>();
+ test11<S>();
+ test12<S>();
+ test13<S>();
+ test14<S>();
+ test15<S>();
+ test16<S>();
+ test17<S>();
+ test18<S>();
+ test19<S>();
+ test20<S>();
+ test21<S>();
+ test22<S>();
+ test23<S>();
+ test24<S>();
+ test25<S>();
+ test26<S>();
+ test27<S>();
+ test28<S>();
+ test29<S>();
+ test30<S>();
+ test31<S>();
+ test32<S>();
+ test33<S>();
+ test34<S>();
+ test35<S>();
+ test36<S>();
+ test37<S>();
+ test38<S>();
+ test39<S>();
+ test40<S>();
+ test41<S>();
+ test42<S>();
+ test43<S>();
+ test44<S>();
+ test45<S>();
+ test46<S>();
+ test47<S>();
+ test48<S>();
+ test49<S>();
+ test50<S>();
+ test51<S>();
+ test52<S>();
+ test53<S>();
+ test54<S>();
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ test4<S>();
+ test5<S>();
+ test6<S>();
+ test7<S>();
+ test8<S>();
+ test9<S>();
+ test10<S>();
+ test11<S>();
+ test12<S>();
+ test13<S>();
+ test14<S>();
+ test15<S>();
+ test16<S>();
+ test17<S>();
+ test18<S>();
+ test19<S>();
+ test20<S>();
+ test21<S>();
+ test22<S>();
+ test23<S>();
+ test24<S>();
+ test25<S>();
+ test26<S>();
+ test27<S>();
+ test28<S>();
+ test29<S>();
+ test30<S>();
+ test31<S>();
+ test32<S>();
+ test33<S>();
+ test34<S>();
+ test35<S>();
+ test36<S>();
+ test37<S>();
+ test38<S>();
+ test39<S>();
+ test40<S>();
+ test41<S>();
+ test42<S>();
+ test43<S>();
+ test44<S>();
+ test45<S>();
+ test46<S>();
+ test47<S>();
+ test48<S>();
+ test49<S>();
+ test50<S>();
+ test51<S>();
+ test52<S>();
+ test53<S>();
+ test54<S>();
+ }
+#endif
}
OpenPOWER on IntegriCloud