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.nonmembers | |
| 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.nonmembers')
30 files changed, 904 insertions, 46 deletions
diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp index 44aa73c9c9f..2a3b03df6f7 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { { @@ -46,4 +48,34 @@ int main() assert(in.eof()); assert(s == L" ghij"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + std::istringstream in(" abc\n def\n ghij"); + S s("initial text"); + getline(in, s); + assert(in.good()); + assert(s == " abc"); + getline(in, s); + assert(in.good()); + assert(s == " def"); + getline(in, s); + assert(in.eof()); + assert(s == " ghij"); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + std::wistringstream in(L" abc\n def\n ghij"); + S s(L"initial text"); + getline(in, s); + assert(in.good()); + assert(s == L" abc"); + getline(in, s); + assert(in.good()); + assert(s == L" def"); + getline(in, s); + assert(in.eof()); + assert(s == L" ghij"); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp index d8e2fec5032..a1ca8ce6ee7 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { { @@ -52,4 +54,40 @@ int main() assert(in.eof()); assert(s == L" ghij"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + std::istringstream in(" abc* def** ghij"); + S s("initial text"); + getline(in, s, '*'); + assert(in.good()); + assert(s == " abc"); + getline(in, s, '*'); + assert(in.good()); + assert(s == " def"); + getline(in, s, '*'); + assert(in.good()); + assert(s == ""); + getline(in, s, '*'); + assert(in.eof()); + assert(s == " ghij"); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + std::wistringstream in(L" abc* def** ghij"); + S s(L"initial text"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L" abc"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L" def"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L""); + getline(in, s, L'*'); + assert(in.eof()); + assert(s == L" ghij"); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp index 7be2958b5bd..47e66efd8b9 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -31,5 +33,19 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + S s("initial text"); + getline(std::istringstream(" abc* def* ghij"), s, '*'); + assert(s == " abc"); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + S s(L"initial text"); + getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); + assert(s == L" abc"); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp index 7e46ad50296..0565b37e732 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -31,5 +33,19 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + S s("initial text"); + getline(std::istringstream(" abc\n def\n ghij"), s); + assert(s == " abc"); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + S s(L"initial text"); + getline(std::wistringstream(L" abc\n def\n ghij"), s); + assert(s == L" abc"); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp index f017370675a..689fb7281e0 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { { @@ -64,4 +66,52 @@ int main() in >> s; assert(in.fail()); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + std::istringstream in("a bc defghij"); + S s("initial text"); + in >> s; + assert(in.good()); + assert(s == "a"); + assert(in.peek() == ' '); + in >> s; + assert(in.good()); + assert(s == "bc"); + assert(in.peek() == ' '); + in.width(3); + in >> s; + assert(in.good()); + assert(s == "def"); + assert(in.peek() == 'g'); + in >> s; + assert(in.eof()); + assert(s == "ghij"); + in >> s; + assert(in.fail()); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + std::wistringstream in(L"a bc defghij"); + S s(L"initial text"); + in >> s; + assert(in.good()); + assert(s == L"a"); + assert(in.peek() == L' '); + in >> s; + assert(in.good()); + assert(s == L"bc"); + assert(in.peek() == L' '); + in.width(3); + in >> s; + assert(in.good()); + assert(s == L"def"); + assert(in.peek() == L'g'); + in >> s; + assert(in.eof()); + assert(s == L"ghij"); + in >> s; + assert(in.fail()); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp index 617609961f9..5f777ba1c56 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp @@ -18,6 +18,8 @@ #include <sstream> #include <cassert> +#include "../../min_allocator.h" + int main() { { @@ -50,4 +52,40 @@ int main() assert(out.good()); assert(L" " + s == out.str()); } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + std::basic_ostringstream<S::value_type, S::traits_type, S::allocator_type> out; + S s("some text"); + out << s; + assert(out.good()); + assert(s == out.str()); + } + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + std::basic_ostringstream<S::value_type, S::traits_type, S::allocator_type> out; + S s("some text"); + out.width(12); + out << s; + assert(out.good()); + assert(" " + s == out.str()); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + std::basic_ostringstream<S::value_type, S::traits_type, S::allocator_type> out; + S s(L"some text"); + out << s; + assert(out.good()); + assert(s == out.str()); + } + { + typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t>> S; + std::basic_ostringstream<S::value_type, S::traits_type, S::allocator_type> out; + S s(L"some text"); + out.width(12); + out << s; + assert(out.good()); + assert(L" " + s == out.str()); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp index 7b34a7a485d..264494cb719 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp @@ -18,6 +18,8 @@ #include <algorithm> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(S s1, S s2) @@ -33,6 +35,7 @@ test(S s1, S s2) int main() { + { typedef std::string S; test(S(""), S("")); test(S(""), S("12345")); @@ -50,4 +53,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("12345")); test(S("abcdefghijklmnopqrst"), S("1234567890")); test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test(S(""), S("")); + test(S(""), S("12345")); + test(S(""), S("1234567890")); + test(S(""), S("12345678901234567890")); + test(S("abcde"), S("")); + test(S("abcde"), S("12345")); + test(S("abcde"), S("1234567890")); + test(S("abcde"), S("12345678901234567890")); + test(S("abcdefghij"), S("")); + test(S("abcdefghij"), S("12345")); + test(S("abcdefghij"), S("1234567890")); + test(S("abcdefghij"), S("12345678901234567890")); + test(S("abcdefghijklmnopqrst"), S("")); + test(S("abcdefghijklmnopqrst"), S("12345")); + test(S("abcdefghijklmnopqrst"), S("1234567890")); + test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp index 7c5fb30b042..6810c4f7600 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), true); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + 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<char, std::char_traits<char>, min_allocator<char>> S; test("", S(""), false); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +64,6 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), true); test("abcdefghijklmnopqrst", S("abcdefghij"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp index 8fcc0c5533d..e47214e6c08 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs != rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", false); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", true); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", false); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp index 186399721e8..864da89d103 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs != rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), false); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), false); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp index 65662f0db58..2d095a2b51f 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp @@ -20,6 +20,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test0(typename S::value_type lhs, const S& rhs, const S& x) @@ -38,15 +40,32 @@ test1(typename S::value_type lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1('a', S(""), S("a")); + test1('a', S("12345"), S("a12345")); + test1('a', S("1234567890"), S("a1234567890")); + test1('a', S("12345678901234567890"), S("a12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; + test0('a', S(""), S("a")); + test0('a', S("12345"), S("a12345")); + test0('a', S("1234567890"), S("a1234567890")); + test0('a', S("12345678901234567890"), S("a12345678901234567890")); + #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1('a', S(""), S("a")); @@ -55,4 +74,6 @@ int main() test1('a', S("12345678901234567890"), S("a12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp index 00d12d4b866..a06157de8aa 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp @@ -20,6 +20,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test0(const typename S::value_type* lhs, const S& rhs, const S& x) @@ -38,10 +40,51 @@ test1(const typename S::value_type* lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; + test0("", S(""), S("")); + test0("", S("12345"), S("12345")); + test0("", S("1234567890"), S("1234567890")); + test0("", S("12345678901234567890"), S("12345678901234567890")); + test0("abcde", S(""), S("abcde")); + test0("abcde", S("12345"), S("abcde12345")); + test0("abcde", S("1234567890"), S("abcde1234567890")); + test0("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); + test0("abcdefghij", S(""), S("abcdefghij")); + test0("abcdefghij", S("12345"), S("abcdefghij12345")); + test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); + test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); + test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); + test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1("", S(""), S("")); + test1("", S("12345"), S("12345")); + test1("", S("1234567890"), S("1234567890")); + test1("", S("12345678901234567890"), S("12345678901234567890")); + test1("abcde", S(""), S("abcde")); + test1("abcde", S("12345"), S("abcde12345")); + test1("abcde", S("1234567890"), S("abcde1234567890")); + test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); + test1("abcdefghij", S(""), S("abcdefghij")); + test1("abcdefghij", S("12345"), S("abcdefghij12345")); + test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); + test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); + test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); + test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); test0("", S("1234567890"), S("1234567890")); @@ -79,4 +122,6 @@ int main() test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp index 6136d55566c..fa5d0becf3f 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp @@ -20,6 +20,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test0(const S& lhs, typename S::value_type rhs, const S& x) @@ -38,10 +40,27 @@ test1(S&& lhs, typename S::value_type rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; + test0(S(""), '1', S("1")); + test0(S("abcde"), '1', S("abcde1")); + test0(S("abcdefghij"), '1', S("abcdefghij1")); + test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), '1', S("1")); + test1(S("abcde"), '1', S("abcde1")); + test1(S("abcdefghij"), '1', S("abcdefghij1")); + test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); @@ -55,4 +74,6 @@ int main() test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp index db8f4d68572..0be44c752e2 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp @@ -20,6 +20,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test0(const S& lhs, const typename S::value_type* rhs, const S& x) @@ -38,10 +40,51 @@ test1(S&& lhs, const typename S::value_type* rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; + test0(S(""), "", S("")); + test0(S(""), "12345", S("12345")); + test0(S(""), "1234567890", S("1234567890")); + test0(S(""), "12345678901234567890", S("12345678901234567890")); + test0(S("abcde"), "", S("abcde")); + test0(S("abcde"), "12345", S("abcde12345")); + test0(S("abcde"), "1234567890", S("abcde1234567890")); + test0(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); + test0(S("abcdefghij"), "", S("abcdefghij")); + test0(S("abcdefghij"), "12345", S("abcdefghij12345")); + test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); + test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), "", S("")); + test1(S(""), "12345", S("12345")); + test1(S(""), "1234567890", S("1234567890")); + test1(S(""), "12345678901234567890", S("12345678901234567890")); + test1(S("abcde"), "", S("abcde")); + test1(S("abcde"), "12345", S("abcde12345")); + test1(S("abcde"), "1234567890", S("abcde1234567890")); + test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); + test1(S("abcdefghij"), "", S("abcdefghij")); + test1(S("abcdefghij"), "12345", S("abcdefghij12345")); + test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); + test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); test0(S(""), "1234567890", S("1234567890")); @@ -79,4 +122,6 @@ int main() test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp index 1ffcf922edf..4a9fabe381a 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp @@ -32,6 +32,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test0(const S& lhs, const S& rhs, const S& x) @@ -64,10 +66,85 @@ test3(S&& lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; + test0(S(""), S(""), S("")); + test0(S(""), S("12345"), S("12345")); + test0(S(""), S("1234567890"), S("1234567890")); + test0(S(""), S("12345678901234567890"), S("12345678901234567890")); + test0(S("abcde"), S(""), S("abcde")); + test0(S("abcde"), S("12345"), S("abcde12345")); + test0(S("abcde"), S("1234567890"), S("abcde1234567890")); + test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcdefghij"), S(""), S("abcdefghij")); + test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), S(""), S("")); + test1(S(""), S("12345"), S("12345")); + test1(S(""), S("1234567890"), S("1234567890")); + test1(S(""), S("12345678901234567890"), S("12345678901234567890")); + test1(S("abcde"), S(""), S("abcde")); + test1(S("abcde"), S("12345"), S("abcde12345")); + test1(S("abcde"), S("1234567890"), S("abcde1234567890")); + test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcdefghij"), S(""), S("abcdefghij")); + test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test2(S(""), S(""), S("")); + test2(S(""), S("12345"), S("12345")); + test2(S(""), S("1234567890"), S("1234567890")); + test2(S(""), S("12345678901234567890"), S("12345678901234567890")); + test2(S("abcde"), S(""), S("abcde")); + test2(S("abcde"), S("12345"), S("abcde12345")); + test2(S("abcde"), S("1234567890"), S("abcde1234567890")); + test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcdefghij"), S(""), S("abcdefghij")); + test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test3(S(""), S(""), S("")); + test3(S(""), S("12345"), S("12345")); + test3(S(""), S("1234567890"), S("1234567890")); + test3(S(""), S("12345678901234567890"), S("12345678901234567890")); + test3(S("abcde"), S(""), S("abcde")); + test3(S("abcde"), S("12345"), S("abcde12345")); + test3(S("abcde"), S("1234567890"), S("abcde1234567890")); + test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcdefghij"), S(""), S("abcdefghij")); + test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); test0(S(""), S("1234567890"), S("1234567890")); @@ -139,4 +216,6 @@ int main() test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp index 249cd45e70b..a64881cf502 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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(""), true); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), false); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test("", S(""), true); test("", S("abcde"), false); test("", S("abcdefghij"), false); @@ -42,4 +64,6 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp index 94039ff6b03..77ebe081d38 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs == rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", true); + test(S(""), "abcde", false); + test(S(""), "abcdefghij", false); + test(S(""), "abcdefghijklmnopqrst", false); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", true); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp index ed9df5a34c7..5946839b929 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs == rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), true); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), true); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } 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 <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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<char, std::char_traits<char>, min_allocator<char>> 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 } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp index c216a43f03b..0577ed0e594 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* 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(S("abcde"), "", true); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", false); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp index 88e83b3a5bc..3074bc93e71 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs > rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), false); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), false); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } 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 6e6208bb488..2105af0472c 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 <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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(""), true); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), true); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), true); + test("abcdefghijklmnopqrst", S("abcde"), true); + test("abcdefghijklmnopqrst", S("abcdefghij"), true); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test("", S(""), true); 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"), true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp index 9a496f7f5cf..69359f765c3 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs >= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", true); + test(S(""), "abcde", false); + test(S(""), "abcdefghij", false); + test(S(""), "abcdefghijklmnopqrst", false); + test(S("abcde"), "", true); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", true); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp index c6bb659e5ab..32c340685bc 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs >= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), true); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), true); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp index 8c6270e0211..28e8db934fd 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), false); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test("", S(""), false); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +64,6 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp index 9791d914ff9..66063bb25cc 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs < rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", false); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", false); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp index 726f70bb563..3c5d115543d 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs < rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), false); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), false); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp index d206bf308bf..05ab3196b02 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> 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(""), true); + test("", S("abcde"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), false); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test("", S(""), true); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +64,6 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp index aad4694dcc6..964d71c54be 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,30 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs <= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), "", true); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), "", true); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +64,6 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp index 470878af617..5758ae3c01f 100644 --- a/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp +++ b/libcxx/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include <string> #include <cassert> +#include "../../min_allocator.h" + template <class S> void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,30 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs <= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; + test(S(""), S(""), true); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), S(""), true); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +65,6 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } |

