libcxx initial import

llvm-svn: 103490
diff --git a/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp
new file mode 100644
index 0000000..2d54de4
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+//       iterator begin();
+// const_iterator begin() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(S s)
+{
+    const S& cs = s;
+    typename S::iterator b = s.begin();
+    typename S::const_iterator cb = cs.begin();
+    if (!s.empty())
+    {
+        assert(*b == s[0]);
+    }
+    assert(b == cb);
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp
new file mode 100644
index 0000000..f794a46
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// const_iterator cbegin() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s)
+{
+    typename S::const_iterator cb = s.cbegin();
+    if (!s.empty())
+    {
+        assert(*cb == s[0]);
+    }
+    assert(cb == s.begin());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp
new file mode 100644
index 0000000..5d5801fa
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// const_iterator cend() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s)
+{
+    typename S::const_iterator ce = s.cend();
+    assert(ce == s.end());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp
new file mode 100644
index 0000000..707272f
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// const_reverse_iterator crbegin() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s)
+{
+    typename S::const_reverse_iterator cb = s.crbegin();
+    if (!s.empty())
+    {
+        assert(*cb == s.back());
+    }
+    assert(cb == s.rbegin());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp
new file mode 100644
index 0000000..290854d
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// const_reverse_iterator crend() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s)
+{
+    typename S::const_reverse_iterator ce = s.crend();
+    assert(ce == s.rend());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp
new file mode 100644
index 0000000..cf43bdd
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+//       iterator end();
+// const_iterator end() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(S s)
+{
+    const S& cs = s;
+    typename S::iterator e = s.end();
+    typename S::const_iterator ce = cs.end();
+    if (s.empty())
+    {
+        assert(e == s.begin());
+        assert(ce == cs.begin());
+    }
+    assert(e - s.begin() == s.size());
+    assert(ce - cs.begin() == cs.size());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp
new file mode 100644
index 0000000..1653136
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+//       reverse_iterator rbegin();
+// const_reverse_iterator rbegin() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(S s)
+{
+    const S& cs = s;
+    typename S::reverse_iterator b = s.rbegin();
+    typename S::const_reverse_iterator cb = cs.rbegin();
+    if (!s.empty())
+    {
+        assert(*b == s.back());
+    }
+    assert(b == cb);
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}
diff --git a/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp
new file mode 100644
index 0000000..5daed01
--- /dev/null
+++ b/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+//       reverse_iterator rend();
+// const_reverse_iterator rend() const;
+
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(S s)
+{
+    const S& cs = s;
+    typename S::reverse_iterator e = s.rend();
+    typename S::const_reverse_iterator ce = cs.rend();
+    if (s.empty())
+    {
+        assert(e == s.rbegin());
+        assert(ce == cs.rbegin());
+    }
+    assert(e - s.rbegin() == s.size());
+    assert(ce - cs.rbegin() == cs.size());
+}
+
+int main()
+{
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+}