From eec721826cc35a0c08dc5bc54db9a51dbd4fa361 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 28 Jun 2013 16:59:19 +0000 Subject: 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 --- .../string_opgt/pointer_string.pass.cpp | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'libcxx/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp') diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp index 32b4de40a31..56af158ed96 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,30 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs > rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test("", S(""), false); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), true); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), true); + test("abcdefghijklmnopqrst", S("abcde"), true); + test("abcdefghijklmnopqrst", S("abcdefghij"), true); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; test("", S(""), false); test("", S("abcde"), false); test("", S("abcdefghij"), false); @@ -42,4 +64,6 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), true); test("abcdefghijklmnopqrst", S("abcdefghij"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } -- cgit v1.2.3