diff options
Diffstat (limited to 'libcxx/test/strings/basic.string/string.ops')
34 files changed, 954 insertions, 183 deletions
diff --git a/libcxx/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp index 0ab92526937..3326b35a057 100644 --- a/libcxx/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s) @@ -31,9 +33,20 @@ test(const S& s) int main() { + { typedef std::string S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(S("abcdefghijklmnopqrst")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test(S("")); + test(S("abcde")); + test(S("abcdefghij")); + test(S("abcdefghijklmnopqrst")); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp index 26459b7cc3b..c2c57f6f13d 100644 --- a/libcxx/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s) @@ -31,9 +33,20 @@ test(const S& s) int main() { + { typedef std::string S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(S("abcdefghijklmnopqrst")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test(S("")); + test(S("abcde")); + test(S("abcdefghij")); + test(S("abcdefghijklmnopqrst")); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp index 5223f3bb548..8d998171c64 100644 --- a/libcxx/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp @@ -15,6 +15,7 @@ #include <cassert> #include "../../test_allocator.h" +#include "../../min_allocator.h" template <class S> void @@ -25,10 +26,22 @@ test(const S& s, const typename S::allocator_type& a) int main() { + { typedef test_allocator<char> A; typedef std::basic_string<char, std::char_traits<char>, A> S; test(S(""), A()); test(S("abcde", A(1)), A(1)); test(S("abcdefghij", A(2)), A(2)); test(S("abcdefghijklmnopqrst", A(3)), A(3)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator<char> A; + typedef std::basic_string<char, std::char_traits<char>, A> S; + test(S(""), A()); + test(S("abcde", A()), A()); + test(S("abcdefghij", A()), A()); + test(S("abcdefghijklmnopqrst", A()), A()); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp index 14f999d140b..c13905e206f 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -30,10 +32,30 @@ test(const S& s, const typename S::value_type* str, int x) assert(sign(s.compare(str)) == sign(x)); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", 0); + test(S(""), "abcde", -5); + test(S(""), "abcdefghij", -10); + test(S(""), "abcdefghijklmnopqrst", -20); + test(S("abcde"), "", 5); + test(S("abcde"), "abcde", 0); + test(S("abcde"), "abcdefghij", -5); + test(S("abcde"), "abcdefghijklmnopqrst", -15); + test(S("abcdefghij"), "", 10); + test(S("abcdefghij"), "abcde", 5); + test(S("abcdefghij"), "abcdefghij", 0); + test(S("abcdefghij"), "abcdefghijklmnopqrst", -10); + test(S("abcdefghijklmnopqrst"), "", 20); + test(S("abcdefghijklmnopqrst"), "abcde", 15); + test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", 0); test(S(""), "abcde", -5); test(S(""), "abcdefghij", -10); @@ -50,4 +72,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", 15); test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp index d955652d3c6..ca4b067a1ce 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <stdexcept> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template <class S> void test0() { test(S(""), 0, 0, "", 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", -20); } +template <class S> void test1() { test(S("abcde"), 6, 0, "", 0); @@ -250,6 +252,7 @@ void test1() test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 0); } +template <class S> void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0); @@ -352,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.ops/string_compare/size_size_pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp index 8373ca4123b..c94eaef37db 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp @@ -15,6 +15,8 @@ #include <stdexcept> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n1, } } -typedef std::string S; - +template <class S> void test0() { test(S(""), 0, 0, "", 0, 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 0, 4, "abcde", 2, 2); } +template <class S> void test1() { test(S("abcde"), 0, 4, "abcde", 4, 0); @@ -250,6 +252,7 @@ void test1() test(S("abcde"), 1, 3, "abcdefghij", 1, 1); } +template <class S> void test2() { test(S("abcde"), 1, 3, "abcdefghij", 5, 1); @@ -354,6 +357,7 @@ void test2() test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 0, 3); } +template <class S> void test3() { test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 1, 2); @@ -458,6 +462,7 @@ void test3() test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", 20, -20); } +template <class S> void test4() { test(S("abcde"), 6, 0, "", 0, 0); @@ -562,6 +567,7 @@ void test4() test(S("abcdefghij"), 0, 11, "abcde", 2, 8); } +template <class S> void test5() { test(S("abcdefghij"), 0, 11, "abcde", 4, 6); @@ -666,6 +672,7 @@ void test5() test(S("abcdefghij"), 1, 10, "abcdefghij", 1, 1); } +template <class S> void test6() { test(S("abcdefghij"), 1, 10, "abcdefghij", 5, 1); @@ -770,6 +777,7 @@ void test6() test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 0, 5); } +template <class S> void test7() { test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 1, 5); @@ -874,6 +882,7 @@ void test7() test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 20, 0); } +template <class S> void test8() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, 0); @@ -978,6 +987,7 @@ void test8() test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 2, -2); } +template <class S> void test9() { test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 4, -4); @@ -1082,6 +1092,7 @@ void test9() test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 1, -1); } +template <class S> void test10() { test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 5, -5); @@ -1186,6 +1197,7 @@ void test10() test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 0, 0); } +template <class S> void test11() { test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 1, -1); @@ -1276,16 +1288,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.ops/string_compare/size_size_string.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp index a572ebcd418..4312e276541 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp @@ -15,6 +15,8 @@ #include <stdexcept> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template <class S> void test0() { test(S(""), 0, 0, S(""), 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 5, 1, S("abcdefghijklmnopqrst"), -20); } +template <class S> void test1() { test(S("abcde"), 6, 0, S(""), 0); @@ -250,6 +252,7 @@ void test1() test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 0); } +template <class S> void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0); @@ -352,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.ops/string_compare/size_size_string_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp index 401fbe3201d..8fa23b7ec25 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp @@ -16,6 +16,8 @@ #include <stdexcept> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -42,8 +44,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template <class S> void test0() { test(S(""), 0, 0, S(""), 0, 0, 0); @@ -148,6 +149,7 @@ void test0() test(S(""), 0, 1, S("abcde"), 6, 0, 0); } +template <class S> void test1() { test(S(""), 0, 1, S("abcdefghij"), 0, 0, 0); @@ -252,6 +254,7 @@ void test1() test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 1, 0); } +template <class S> void test2() { test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 10, 0); @@ -356,6 +359,7 @@ void test2() test(S("abcde"), 0, 1, S("abcde"), 0, 0, 1); } +template <class S> void test3() { test(S("abcde"), 0, 1, S("abcde"), 0, 1, 0); @@ -460,6 +464,7 @@ void test3() test(S("abcde"), 0, 2, S("abcdefghij"), 0, 9, -7); } +template <class S> void test4() { test(S("abcde"), 0, 2, S("abcdefghij"), 0, 10, -8); @@ -564,6 +569,7 @@ void test4() test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 0, 21, -16); } +template <class S> void test5() { test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 1, 0, 4); @@ -668,6 +674,7 @@ void test5() test(S("abcde"), 0, 6, S("abcde"), 0, 5, 0); } +template <class S> void test6() { test(S("abcde"), 0, 6, S("abcde"), 0, 6, 0); @@ -772,6 +779,7 @@ void test6() test(S("abcde"), 1, 0, S("abcdefghij"), 1, 1, -1); } +template <class S> void test7() { test(S("abcde"), 1, 0, S("abcdefghij"), 1, 4, -4); @@ -876,6 +884,7 @@ void test7() test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 18, -17); } +template <class S> void test8() { test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 19, -18); @@ -980,6 +989,7 @@ void test8() test(S("abcde"), 1, 3, S("abcde"), 1, 2, 1); } +template <class S> void test9() { test(S("abcde"), 1, 3, S("abcde"), 1, 3, 0); @@ -1084,6 +1094,7 @@ void test9() test(S("abcde"), 1, 4, S("abcdefghij"), 1, 10, -5); } +template <class S> void test10() { test(S("abcde"), 1, 4, S("abcdefghij"), 5, 0, 4); @@ -1188,6 +1199,7 @@ void test10() test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 1, -9); } +template <class S> void test11() { test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 5, -9); @@ -1292,6 +1304,7 @@ void test11() test(S("abcde"), 2, 1, S("abcde"), 2, 0, 1); } +template <class S> void test12() { test(S("abcde"), 2, 1, S("abcde"), 2, 1, 0); @@ -1396,6 +1409,7 @@ void test12() test(S("abcde"), 2, 2, S("abcdefghij"), 5, 4, -3); } +template <class S> void test13() { test(S("abcde"), 2, 2, S("abcdefghij"), 5, 5, -3); @@ -1500,6 +1514,7 @@ void test13() test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 10, 11, -8); } +template <class S> void test14() { test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 19, 0, 3); @@ -1604,6 +1619,7 @@ void test14() test(S("abcde"), 4, 0, S("abcde"), 2, 4, -3); } +template <class S> void test15() { test(S("abcde"), 4, 0, S("abcde"), 4, 0, 0); @@ -1708,6 +1724,7 @@ void test15() test(S("abcde"), 4, 1, S("abcdefghij"), 9, 1, -5); } +template <class S> void test16() { test(S("abcde"), 4, 1, S("abcdefghij"), 9, 2, -5); @@ -1812,6 +1829,7 @@ void test16() test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 0, 1); } +template <class S> void test17() { test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 1, 1); @@ -1916,6 +1934,7 @@ void test17() test(S("abcde"), 5, 1, S("abcde"), 5, 0, 0); } +template <class S> void test18() { test(S("abcde"), 5, 1, S("abcde"), 5, 1, 0); @@ -2020,6 +2039,7 @@ void test18() test(S("abcde"), 6, 0, S("abcdefghij"), 11, 0, 0); } +template <class S> void test19() { test(S("abcde"), 6, 0, S("abcdefghijklmnopqrst"), 0, 0, 0); @@ -2124,6 +2144,7 @@ void test19() test(S("abcdefghij"), 0, 1, S(""), 0, 1, 1); } +template <class S> void test20() { test(S("abcdefghij"), 0, 1, S(""), 1, 0, 0); @@ -2228,6 +2249,7 @@ void test20() test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 1, 4); } +template <class S> void test21() { test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 5, 0); @@ -2332,6 +2354,7 @@ void test21() test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 19, -10); } +template <class S> void test22() { test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 20, -11); @@ -2436,6 +2459,7 @@ void test22() test(S("abcdefghij"), 0, 11, S("abcde"), 0, 2, 8); } +template <class S> void test23() { test(S("abcdefghij"), 0, 11, S("abcde"), 0, 4, 6); @@ -2540,6 +2564,7 @@ void test23() test(S("abcdefghij"), 1, 0, S("abcdefghij"), 0, 11, -10); } +template <class S> void test24() { test(S("abcdefghij"), 1, 0, S("abcdefghij"), 1, 0, 0); @@ -2644,6 +2669,7 @@ void test24() test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 1, 0); } +template <class S> void test25() { test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 9, -8); @@ -2748,6 +2774,7 @@ void test25() test(S("abcdefghij"), 1, 8, S("abcde"), 1, 0, 8); } +template <class S> void test26() { test(S("abcdefghij"), 1, 8, S("abcde"), 1, 1, 7); @@ -2852,6 +2879,7 @@ void test26() test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 8, 1); } +template <class S> void test27() { test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 9, 0); @@ -2956,6 +2984,7 @@ void test27() test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 1, 20, -10); } +template <class S> void test28() { test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 10, 0, 9); @@ -3060,6 +3089,7 @@ void test28() test(S("abcdefghij"), 5, 1, S("abcde"), 1, 4, 4); } +template <class S> void test29() { test(S("abcdefghij"), 5, 1, S("abcde"), 1, 5, 4); @@ -3164,6 +3194,7 @@ void test29() test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 1, 1); } +template <class S> void test30() { test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 2, 0); @@ -3268,6 +3299,7 @@ void test30() test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 9, -5); } +template <class S> void test31() { test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 10, -5); @@ -3372,6 +3404,7 @@ void test31() test(S("abcdefghij"), 5, 6, S("abcde"), 2, 2, 3); } +template <class S> void test32() { test(S("abcdefghij"), 5, 6, S("abcde"), 2, 3, 3); @@ -3476,6 +3509,7 @@ void test32() test(S("abcdefghij"), 9, 0, S("abcdefghij"), 5, 6, -5); } +template <class S> void test33() { test(S("abcdefghij"), 9, 0, S("abcdefghij"), 9, 0, 0); @@ -3580,6 +3614,7 @@ void test33() test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 1, -10); } +template <class S> void test34() { test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 2, -10); @@ -3684,6 +3719,7 @@ void test34() test(S("abcdefghij"), 10, 0, S("abcde"), 4, 1, -1); } +template <class S> void test35() { test(S("abcdefghij"), 10, 0, S("abcde"), 4, 2, -1); @@ -3788,6 +3824,7 @@ void test35() test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 0, 0); } +template <class S> void test36() { test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 1, 0); @@ -3892,6 +3929,7 @@ void test36() test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 21, 0, 0); } +template <class S> void test37() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, 0); @@ -3996,6 +4034,7 @@ void test37() test(S("abcdefghijklmnopqrst"), 0, 1, S("abcde"), 6, 0, 0); } +template <class S> void test38() { test(S("abcdefghijklmnopqrst"), 0, 1, S("abcdefghij"), 0, 0, 1); @@ -4100,6 +4139,7 @@ void test38() test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 1, 9); } +template <class S> void test39() { test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 10, 0); @@ -4204,6 +4244,7 @@ void test39() test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 0, 20); } +template <class S> void test40() { test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 1, 19); @@ -4308,6 +4349,7 @@ void test40() test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 9, 11); } +template <class S> void test41() { test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 10, 10); @@ -4412,6 +4454,7 @@ void test41() test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 0, 21, -20); } +template <class S> void test42() { test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 1, 0, 0); @@ -4516,6 +4559,7 @@ void test42() test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 5, 1); } +template <class S> void test43() { test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 6, 1); @@ -4620,6 +4664,7 @@ void test43() test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 1, 17); } +template <class S> void test44() { test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 4, 14); @@ -4724,6 +4769,7 @@ void test44() test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 18, 1); } +template <class S> void test45() { test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 19, 0); @@ -4828,6 +4874,7 @@ void test45() test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 2, -2); } +template <class S> void test46() { test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 3, -3); @@ -4932,6 +4979,7 @@ void test46() test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 1, 10, 9); } +template <class S> void test47() { test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 5, 0, 1); @@ -5036,6 +5084,7 @@ void test47() test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 1, 4); } +template <class S> void test48() { test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 5, 0); @@ -5140,6 +5189,7 @@ void test48() test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 0, 10); } +template <class S> void test49() { test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 1, 8); @@ -5244,6 +5294,7 @@ void test49() test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 4, 5); } +template <class S> void test50() { test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 5, 5); @@ -5348,6 +5399,7 @@ void test50() test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 10, 11, -10); } +template <class S> void test51() { test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 19, 0, 0); @@ -5452,6 +5504,7 @@ void test51() test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 2, 4, 17); } +template <class S> void test52() { test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 4, 0, 1); @@ -5556,6 +5609,7 @@ void test52() test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 1, -1); } +template <class S> void test53() { test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 2, -1); @@ -5660,6 +5714,7 @@ void test53() test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 0, 0); } +template <class S> void test54() { test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 1, 0); @@ -5742,59 +5797,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 } diff --git a/libcxx/test/strings/basic.string/string.ops/string_compare/string.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_compare/string.pass.cpp index 6632cf74d86..58f576084c3 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_compare/string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_compare/string.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -30,10 +32,30 @@ test(const S& s, const S& str, int x) assert(sign(s.compare(str)) == sign(x)); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), 0); + test(S(""), S("abcde"), -5); + test(S(""), S("abcdefghij"), -10); + test(S(""), S("abcdefghijklmnopqrst"), -20); + test(S("abcde"), S(""), 5); + test(S("abcde"), S("abcde"), 0); + test(S("abcde"), S("abcdefghij"), -5); + test(S("abcde"), S("abcdefghijklmnopqrst"), -15); + test(S("abcdefghij"), S(""), 10); + test(S("abcdefghij"), S("abcde"), 5); + test(S("abcdefghij"), S("abcdefghij"), 0); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), -10); + test(S("abcdefghijklmnopqrst"), S(""), 20); + test(S("abcdefghijklmnopqrst"), S("abcde"), 15); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), 0); test(S(""), S("abcde"), -5); test(S(""), S("abcdefghij"), -10); @@ -50,4 +72,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), 15); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp index 3be9e92d646..302f725dced 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,41 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'q', 0, S::npos); + test(S(""), 'q', 1, S::npos); + test(S("kitcj"), 'q', 0, 0); + test(S("qkamf"), 'q', 1, 1); + test(S("nhmko"), 'q', 2, 2); + test(S("tpsaf"), 'q', 4, 4); + test(S("lahfb"), 'q', 5, S::npos); + test(S("irkhs"), 'q', 6, S::npos); + test(S("gmfhdaipsr"), 'q', 0, 0); + test(S("kantesmpgj"), 'q', 1, 1); + test(S("odaftiegpm"), 'q', 5, 5); + test(S("oknlrstdpi"), 'q', 9, 9); + test(S("eolhfgpjqk"), 'q', 10, S::npos); + test(S("pcdrofikas"), 'q', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'q', 0, 0); + test(S("bnrpehidofmqtcksjgla"), 'q', 1, 1); + test(S("jdmciepkaqgotsrfnhlb"), 'q', 10, 10); + test(S("jtdaefblsokrmhpgcnqi"), 'q', 19, 19); + test(S("hkbgspofltajcnedqmri"), 'q', 20, S::npos); + test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos); + + test(S(""), 'q', S::npos); + test(S("q"), 'q', S::npos); + test(S("qqq"), 'q', S::npos); + test(S("csope"), 'q', 0); + test(S("gfsmthlkon"), 'q', 0); + test(S("laenfsbridchgotmkqpj"), 'q', 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'q', 0, S::npos); test(S(""), 'q', 1, S::npos); test(S("kitcj"), 'q', 0, 0); @@ -64,4 +97,6 @@ int main() test(S("csope"), 'q', 0); test(S("gfsmthlkon"), 'q', 0); test(S("laenfsbridchgotmkqpj"), 'q', 0); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp index 13f3931fadd..66b21aea39d 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template <class S> void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp index 93eb4f30ba8..4416b826420 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template <class S> void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); } +template <class S> void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template <class S> void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp index a6c59bdaff6..3d28c2479be 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template <class S> void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp index dc620488f28..fd64fdf7802 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,39 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'e', 0, S::npos); + test(S(""), 'e', 1, S::npos); + test(S("kitcj"), 'e', 0, S::npos); + test(S("qkamf"), 'e', 1, S::npos); + test(S("nhmko"), 'e', 2, S::npos); + test(S("tpsaf"), 'e', 4, S::npos); + test(S("lahfb"), 'e', 5, S::npos); + test(S("irkhs"), 'e', 6, S::npos); + test(S("gmfhdaipsr"), 'e', 0, S::npos); + test(S("kantesmpgj"), 'e', 1, 4); + test(S("odaftiegpm"), 'e', 5, 6); + test(S("oknlrstdpi"), 'e', 9, S::npos); + test(S("eolhfgpjqk"), 'e', 10, S::npos); + test(S("pcdrofikas"), 'e', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'e', 0, 7); + test(S("bnrpehidofmqtcksjgla"), 'e', 1, 4); + test(S("jdmciepkaqgotsrfnhlb"), 'e', 10, S::npos); + test(S("jtdaefblsokrmhpgcnqi"), 'e', 19, S::npos); + test(S("hkbgspofltajcnedqmri"), 'e', 20, S::npos); + test(S("oselktgbcapndfjihrmq"), 'e', 21, S::npos); + + test(S(""), 'e', S::npos); + test(S("csope"), 'e', 4); + test(S("gfsmthlkon"), 'e', S::npos); + test(S("laenfsbridchgotmkqpj"), 'e', 2); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'e', 0, S::npos); test(S(""), 'e', 1, S::npos); test(S("kitcj"), 'e', 0, S::npos); @@ -62,4 +93,6 @@ int main() test(S("csope"), 'e', 4); test(S("gfsmthlkon"), 'e', S::npos); test(S("laenfsbridchgotmkqpj"), 'e', 2); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp index fb731ec92bc..59e00de36aa 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template <class S> void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp index 02006b2a88c..0c21a02fb5a 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template <class S> void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); } +template <class S> void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template <class S> void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp index 083000aba21..d7db16f6e35 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template <class S> void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp index 33c83122960..f6ce46acf56 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,39 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'i', 0, S::npos); + test(S(""), 'i', 1, S::npos); + test(S("kitcj"), 'i', 0, 0); + test(S("qkamf"), 'i', 1, 1); + test(S("nhmko"), 'i', 2, 2); + test(S("tpsaf"), 'i', 4, 4); + test(S("lahfb"), 'i', 5, 4); + test(S("irkhs"), 'i', 6, 4); + test(S("gmfhdaipsr"), 'i', 0, 0); + test(S("kantesmpgj"), 'i', 1, 1); + test(S("odaftiegpm"), 'i', 5, 4); + test(S("oknlrstdpi"), 'i', 9, 8); + test(S("eolhfgpjqk"), 'i', 10, 9); + test(S("pcdrofikas"), 'i', 11, 9); + test(S("nbatdlmekrgcfqsophij"), 'i', 0, 0); + test(S("bnrpehidofmqtcksjgla"), 'i', 1, 1); + test(S("jdmciepkaqgotsrfnhlb"), 'i', 10, 10); + test(S("jtdaefblsokrmhpgcnqi"), 'i', 19, 18); + test(S("hkbgspofltajcnedqmri"), 'i', 20, 18); + test(S("oselktgbcapndfjihrmq"), 'i', 21, 19); + + test(S(""), 'i', S::npos); + test(S("csope"), 'i', 4); + test(S("gfsmthlkon"), 'i', 9); + test(S("laenfsbridchgotmkqpj"), 'i', 19); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'i', 0, S::npos); test(S(""), 'i', 1, S::npos); test(S("kitcj"), 'i', 0, 0); @@ -62,4 +93,6 @@ int main() test(S("csope"), 'i', 4); test(S("gfsmthlkon"), 'i', 9); test(S("laenfsbridchgotmkqpj"), 'i', 19); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp index e20bed71c51..47c6d7ffd9b 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template <class S> void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp index 314821ec82c..f131b962217 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, 4); } +template <class S> void test1() { test(S("gbhqo"), "skqne", 5, 4, 4); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 9); } +template <class S> void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 8); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, 19); } +template <class S> void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 19); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp index a2415ff03e8..6de632670c3 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template <class S> void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp index 6337cb3ee17..32aa77d5083 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,39 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'm', 0, S::npos); + test(S(""), 'm', 1, S::npos); + test(S("kitcj"), 'm', 0, S::npos); + test(S("qkamf"), 'm', 1, S::npos); + test(S("nhmko"), 'm', 2, 2); + test(S("tpsaf"), 'm', 4, S::npos); + test(S("lahfb"), 'm', 5, S::npos); + test(S("irkhs"), 'm', 6, S::npos); + test(S("gmfhdaipsr"), 'm', 0, S::npos); + test(S("kantesmpgj"), 'm', 1, S::npos); + test(S("odaftiegpm"), 'm', 5, S::npos); + test(S("oknlrstdpi"), 'm', 9, S::npos); + test(S("eolhfgpjqk"), 'm', 10, S::npos); + test(S("pcdrofikas"), 'm', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'm', 0, S::npos); + test(S("bnrpehidofmqtcksjgla"), 'm', 1, S::npos); + test(S("jdmciepkaqgotsrfnhlb"), 'm', 10, 2); + test(S("jtdaefblsokrmhpgcnqi"), 'm', 19, 12); + test(S("hkbgspofltajcnedqmri"), 'm', 20, 17); + test(S("oselktgbcapndfjihrmq"), 'm', 21, 18); + + test(S(""), 'm', S::npos); + test(S("csope"), 'm', S::npos); + test(S("gfsmthlkon"), 'm', 3); + test(S("laenfsbridchgotmkqpj"), 'm', 15); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'm', 0, S::npos); test(S(""), 'm', 1, S::npos); test(S("kitcj"), 'm', 0, S::npos); @@ -62,4 +93,6 @@ int main() test(S("csope"), 'm', S::npos); test(S("gfsmthlkon"), 'm', 3); test(S("laenfsbridchgotmkqpj"), 'm', 15); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp index b542a1cb288..cfe71d2e787 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, 19); } +template <class S> void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp index 5c5ac104f30..7d82dc0fe22 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template <class S> void test1() { test(S("gbhqo"), "skqne", 5, 4, 3); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 1); } +template <class S> void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 9); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template <class S> void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 4); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp index 7307599af79..98f78f80738 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, 19); } +template <class S> void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp index c08ee53c9af..3c48a77045d 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,39 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(0 <= x && x + 1 <= s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'c', 0, S::npos); + test(S(""), 'c', 1, S::npos); + test(S("abcde"), 'c', 0, 2); + test(S("abcde"), 'c', 1, 2); + test(S("abcde"), 'c', 2, 2); + test(S("abcde"), 'c', 4, S::npos); + test(S("abcde"), 'c', 5, S::npos); + test(S("abcde"), 'c', 6, S::npos); + test(S("abcdeabcde"), 'c', 0, 2); + test(S("abcdeabcde"), 'c', 1, 2); + test(S("abcdeabcde"), 'c', 5, 7); + test(S("abcdeabcde"), 'c', 9, S::npos); + test(S("abcdeabcde"), 'c', 10, S::npos); + test(S("abcdeabcde"), 'c', 11, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12); + test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos); + + test(S(""), 'c', S::npos); + test(S("abcde"), 'c', 2); + test(S("abcdeabcde"), 'c', 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 2); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); test(S("abcde"), 'c', 0, 2); @@ -62,4 +93,6 @@ int main() test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp index dde0f50118f..c3ea07976bf 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -39,8 +41,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) } } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0); @@ -125,6 +126,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, S::npos); } +template <class S> void test1() { test(S(""), "", 0); @@ -147,6 +149,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp index 14db59ea864..f936651eb20 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x + n <= s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, 0); @@ -130,6 +131,7 @@ void test0() test(S("abcde"), "abcde", 5, 2, S::npos); } +template <class S> void test1() { test(S("abcde"), "abcde", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("abcdeabcde"), "abcdeabcde", 10, 1, S::npos); } +template <class S> void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); } +template <class S> void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp index 375a6f398ba..dc280d0aca2 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(0 <= x && x + str.size() <= s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, 0); @@ -118,6 +119,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, S::npos); } +template <class S> void test1() { test(S(""), S(""), 0); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp index 932e3530fa6..8db67d9fa95 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,39 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x + 1 <= s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 'b', 0, S::npos); + test(S(""), 'b', 1, S::npos); + test(S("abcde"), 'b', 0, S::npos); + test(S("abcde"), 'b', 1, 1); + test(S("abcde"), 'b', 2, 1); + test(S("abcde"), 'b', 4, 1); + test(S("abcde"), 'b', 5, 1); + test(S("abcde"), 'b', 6, 1); + test(S("abcdeabcde"), 'b', 0, S::npos); + test(S("abcdeabcde"), 'b', 1, 1); + test(S("abcdeabcde"), 'b', 5, 1); + test(S("abcdeabcde"), 'b', 9, 6); + test(S("abcdeabcde"), 'b', 10, 6); + test(S("abcdeabcde"), 'b', 11, 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 0, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'b', 1, 1); + test(S("abcdeabcdeabcdeabcde"), 'b', 10, 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 19, 16); + test(S("abcdeabcdeabcdeabcde"), 'b', 20, 16); + test(S("abcdeabcdeabcdeabcde"), 'b', 21, 16); + + test(S(""), 'b', S::npos); + test(S("abcde"), 'b', 1); + test(S("abcdeabcde"), 'b', 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 16); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'b', 0, S::npos); test(S(""), 'b', 1, S::npos); test(S("abcde"), 'b', 0, S::npos); @@ -62,4 +93,6 @@ int main() test(S("abcde"), 'b', 1); test(S("abcdeabcde"), 'b', 6); test(S("abcdeabcdeabcdeabcde"), 'b', 16); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp index 4424fdf4a95..2b1efd336dc 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -40,8 +42,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) } } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0); @@ -126,6 +127,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0); } +template <class S> void test1() { test(S(""), "", 0); @@ -148,6 +150,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp index 8ba26f126ee..5699cabfbeb 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x + n <= s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), "", 0, 0, 0); @@ -130,6 +131,7 @@ void test0() test(S("abcde"), "abcde", 5, 2, 0); } +template <class S> void test1() { test(S("abcde"), "abcde", 5, 4, 0); @@ -234,6 +236,7 @@ void test1() test(S("abcdeabcde"), "abcdeabcde", 10, 1, 5); } +template <class S> void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, 5); @@ -338,6 +341,7 @@ void test2() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); } +template <class S> void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, 15); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + test2<S>(); + test3<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>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp index 0c69f3c089a..d7c2e8503a6 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp @@ -14,6 +14,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(0 <= x && x + str.size() <= s.size()); } -typedef std::string S; - +template <class S> void test0() { test(S(""), S(""), 0, 0); @@ -118,6 +119,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, 0); } +template <class S> void test1() { test(S(""), S(""), 0); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0<S>(); + test1<S>(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0<S>(); + test1<S>(); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp index 9b112b0fe78..9612b583899 100644 --- a/libcxx/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ b/libcxx/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -16,6 +16,8 @@ #include <algorithm> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& s, typename S::size_type pos, typename S::size_type n) @@ -35,10 +37,72 @@ test(const S& s, typename S::size_type pos, typename S::size_type n) } } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), 0, 0); + test(S(""), 1, 0); + test(S("pniot"), 0, 0); + test(S("htaob"), 0, 1); + test(S("fodgq"), 0, 2); + test(S("hpqia"), 0, 4); + test(S("qanej"), 0, 5); + test(S("dfkap"), 1, 0); + test(S("clbao"), 1, 1); + test(S("ihqrf"), 1, 2); + test(S("mekdn"), 1, 3); + test(S("ngtjf"), 1, 4); + test(S("srdfq"), 2, 0); + test(S("qkdrs"), 2, 1); + test(S("ikcrq"), 2, 2); + test(S("cdaih"), 2, 3); + test(S("dmajb"), 4, 0); + test(S("karth"), 4, 1); + test(S("lhcdo"), 5, 0); + test(S("acbsj"), 6, 0); + test(S("pbsjikaole"), 0, 0); + test(S("pcbahntsje"), 0, 1); + test(S("mprdjbeiak"), 0, 5); + test(S("fhepcrntko"), 0, 9); + test(S("eqmpaidtls"), 0, 10); + test(S("joidhalcmq"), 1, 0); + test(S("omigsphflj"), 1, 1); + test(S("kocgbphfji"), 1, 4); + test(S("onmjekafbi"), 1, 8); + test(S("fbslrjiqkm"), 1, 9); + test(S("oqmrjahnkg"), 5, 0); + test(S("jeidpcmalh"), 5, 1); + test(S("schfalibje"), 5, 2); + test(S("crliponbqe"), 5, 4); + test(S("igdscopqtm"), 5, 5); + test(S("qngpdkimlc"), 9, 0); + test(S("thdjgafrlb"), 9, 1); + test(S("hcjitbfapl"), 10, 0); + test(S("mgojkldsqh"), 11, 0); + test(S("gfshlcmdjreqipbontak"), 0, 0); + test(S("nadkhpfemgclosibtjrq"), 0, 1); + test(S("nkodajteqplrbifhmcgs"), 0, 10); + test(S("ofdrqmkeblthacpgijsn"), 0, 19); + test(S("gbmetiprqdoasckjfhln"), 0, 20); + test(S("bdfjqgatlksriohemnpc"), 1, 0); + test(S("crnklpmegdqfiashtojb"), 1, 1); + test(S("ejqcnahdrkfsmptilgbo"), 1, 9); + test(S("jsbtafedocnirgpmkhql"), 1, 18); + test(S("prqgnlbaejsmkhdctoif"), 1, 19); + test(S("qnmodrtkebhpasifgcjl"), 10, 0); + test(S("pejafmnokrqhtisbcdgl"), 10, 1); + test(S("cpebqsfmnjdolhkratgi"), 10, 5); + test(S("odnqkgijrhabfmcestlp"), 10, 9); + test(S("lmofqdhpkibagnrcjste"), 10, 10); + test(S("lgjqketopbfahrmnsicd"), 19, 0); + test(S("ktsrmnqagdecfhijpobl"), 19, 1); + test(S("lsaijeqhtrbgcdmpfkno"), 20, 0); + test(S("dplqartnfgejichmoskb"), 21, 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 0, 0); test(S(""), 1, 0); test(S("pniot"), 0, 0); @@ -97,4 +161,6 @@ int main() test(S("ktsrmnqagdecfhijpobl"), 19, 1); test(S("lsaijeqhtrbgcdmpfkno"), 20, 0); test(S("dplqartnfgejichmoskb"), 21, 0); + } +#endif } |