diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-06-28 16:59:19 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-06-28 16:59:19 +0000 |
| commit | eec721826cc35a0c08dc5bc54db9a51dbd4fa361 (patch) | |
| tree | be3ea93c71256a122174477e4e8b0024bca43ee7 /libcxx/test/strings/basic.string/string.ops/string_find.last.of | |
| parent | e852add40ed7d93da626d4e2286c840afb9d98d8 (diff) | |
| download | bcm5719-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.ops/string_find.last.of')
4 files changed, 89 insertions, 16 deletions
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 } |

