summaryrefslogtreecommitdiffstats
path: root/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
committerEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
commita90c6dd46005b2b14de3bb889a8d03bb34bd3256 (patch)
tree81065ae44967d68964de1f2fdfa107623e58e8a4 /test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
parent669a8a5a1929e881258bfed10d7461ca42ea0a9e (diff)
downloadexternal_libcxx-a90c6dd46005b2b14de3bb889a8d03bb34bd3256.tar.gz
external_libcxx-a90c6dd46005b2b14de3bb889a8d03bb34bd3256.tar.bz2
external_libcxx-a90c6dd46005b2b14de3bb889a8d03bb34bd3256.zip
Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp')
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
new file mode 100644
index 000000000..219594051
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator<=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S>
+void
+test(const typename S::value_type* lhs, const S& rhs, bool x)
+{
+ assert((lhs <= rhs) == x);
+}
+
+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);
+ 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);
+ }
+#endif
+}