[libcxx] r224658 - Move test into test/std subdirectory.

Eric Fiselier eric at efcs.ca
Fri Dec 19 17:40:31 PST 2014


Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op%3D%3D/equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// template <class charT, class traits>
+//   bool operator==(const istreambuf_iterator<charT,traits>& a,
+//                   const istreambuf_iterator<charT,traits>& b);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf1("abc");
+        std::istringstream inf2("def");
+        std::istreambuf_iterator<char> i1(inf1);
+        std::istreambuf_iterator<char> i2(inf2);
+        std::istreambuf_iterator<char> i3;
+        std::istreambuf_iterator<char> i4;
+
+        assert( (i1 == i1));
+        assert( (i1 == i2));
+        assert(!(i1 == i3));
+        assert(!(i1 == i4));
+
+        assert( (i2 == i1));
+        assert( (i2 == i2));
+        assert(!(i2 == i3));
+        assert(!(i2 == i4));
+
+        assert(!(i3 == i1));
+        assert(!(i3 == i2));
+        assert( (i3 == i3));
+        assert( (i3 == i4));
+
+        assert(!(i4 == i1));
+        assert(!(i4 == i2));
+        assert( (i4 == i3));
+        assert( (i4 == i4));
+    }
+    {
+        std::wistringstream inf1(L"abc");
+        std::wistringstream inf2(L"def");
+        std::istreambuf_iterator<wchar_t> i1(inf1);
+        std::istreambuf_iterator<wchar_t> i2(inf2);
+        std::istreambuf_iterator<wchar_t> i3;
+        std::istreambuf_iterator<wchar_t> i4;
+
+        assert( (i1 == i1));
+        assert( (i1 == i2));
+        assert(!(i1 == i3));
+        assert(!(i1 == i4));
+
+        assert( (i2 == i1));
+        assert( (i2 == i2));
+        assert(!(i2 == i3));
+        assert(!(i2 == i4));
+
+        assert(!(i3 == i1));
+        assert(!(i3 == i2));
+        assert( (i3 == i3));
+        assert( (i3 == i4));
+
+        assert(!(i4 == i1));
+        assert(!(i4 == i2));
+        assert( (i4 == i3));
+        assert( (i4 == i4));
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// pointer operator->() const;
+
+#include <iostream>
+#include <sstream>
+#include <streambuf>
+
+typedef char C;
+int main ()
+{
+   std::istringstream s("filename");
+   std::istreambuf_iterator<char> i(s);
+
+   (*i).~C();  // This is well-formed...
+   i->~C();  // ... so this should be supported!
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/post_increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/post_increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/post_increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/post_increment.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// proxy istreambuf_iterator<charT,traits>::operator++(int);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf("abc");
+        std::istreambuf_iterator<char> i(inf);
+        assert(*i++ == 'a');
+        assert(*i++ == 'b');
+        assert(*i++ == 'c');
+        assert(i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::wistringstream inf(L"abc");
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(*i++ == L'a');
+        assert(*i++ == L'b');
+        assert(*i++ == L'c');
+        assert(i == std::istreambuf_iterator<wchar_t>());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/pre_increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/pre_increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/pre_increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/pre_increment.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// istreambuf_iterator<charT,traits>&
+//   istreambuf_iterator<charT,traits>::operator++();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf("abc");
+        std::istreambuf_iterator<char> i(inf);
+        assert(*i == 'a');
+        assert(*++i == 'b');
+        assert(*++i == 'c');
+        assert(++i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::wistringstream inf(L"abc");
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(*i == L'a');
+        assert(*++i == L'b');
+        assert(*++i == L'c');
+        assert(++i == std::istreambuf_iterator<wchar_t>());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_proxy/proxy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_proxy/proxy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_proxy/proxy.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_proxy/proxy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class charT, class traits = char_traits<charT> >
+// class istreambuf_iterator
+//     : public iterator<input_iterator_tag, charT,
+//                       typename traits::off_type, charT*,
+//                       charT>
+// {
+// public:
+//     ...
+//     proxy operator++(int);
+
+// class proxy
+// {
+// public:
+//     charT operator*();
+// };
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf("abc");
+        std::istreambuf_iterator<char> i(inf);
+        assert(*i++ == 'a');
+    }
+    {
+        std::wistringstream inf(L"abc");
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(*i++ == L'a');
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class charT, class traits = char_traits<charT> >
+// class istreambuf_iterator
+//     : public iterator<input_iterator_tag, charT,
+//                       typename traits::off_type, unspecified,
+//                       charT>
+// {
+// public:
+//     typedef charT                         char_type;
+//     typedef traits                        traits_type;
+//     typedef typename traits::int_type     int_type;
+//     typedef basic_streambuf<charT,traits> streambuf_type;
+//     typedef basic_istream<charT,traits>   istream_type;
+//     ...
+
+#include <iterator>
+#include <string>
+#include <type_traits>
+
+int main()
+{
+    typedef std::istreambuf_iterator<char> I1;
+    static_assert((std::is_convertible<I1,
+        std::iterator<std::input_iterator_tag, char, std::char_traits<char>::off_type,
+        char*, char> >::value), "");
+    static_assert((std::is_same<I1::char_type, char>::value), "");
+    static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<I1::int_type, I1::traits_type::int_type>::value), "");
+    static_assert((std::is_same<I1::streambuf_type, std::streambuf>::value), "");
+    static_assert((std::is_same<I1::istream_type, std::istream>::value), "");
+
+    typedef std::istreambuf_iterator<wchar_t> I2;
+    static_assert((std::is_convertible<I2,
+        std::iterator<std::input_iterator_tag, wchar_t, std::char_traits<wchar_t>::off_type,
+        wchar_t*, wchar_t> >::value), "");
+    static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
+    static_assert((std::is_same<I2::int_type, I2::traits_type::int_type>::value), "");
+    static_assert((std::is_same<I2::streambuf_type, std::wstreambuf>::value), "");
+    static_assert((std::is_same<I2::istream_type, std::wistream>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_array.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class T, size_t N> T* begin(T (&array)[N]);
+
+#include <iterator>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    int* i = std::begin(ia);
+    assert(*i == 1);
+    *i = 2;
+    assert(ia[0] == 2);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_const.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class C> auto begin(const C& c) -> decltype(c.begin());
+
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    const std::vector<int> v(ia, ia + sizeof(ia)/sizeof(ia[0]));
+    std::vector<int>::const_iterator i = begin(v);
+    assert(*i == 1);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_non_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_non_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_non_const.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/begin_non_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class C> auto begin(C& c) -> decltype(c.begin());
+
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    std::vector<int> v(ia, ia + sizeof(ia)/sizeof(ia[0]));
+    std::vector<int>::iterator i = begin(v);
+    assert(*i == 1);
+    *i = 2;
+    assert(*i == 2);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_array.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class T, size_t N> T* end(T (&array)[N]);
+
+#include <iterator>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    int* i = std::begin(ia);
+    int* e = std::end(ia);
+    assert(e == ia + 3);
+    assert(e - i == 3);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_const.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class C> auto end(const C& c) -> decltype(c.end());
+
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    const std::vector<int> v(ia, ia + sizeof(ia)/sizeof(ia[0]));
+    std::vector<int>::const_iterator i = end(v);
+    assert(i == v.cend());
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_non_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_non_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_non_const.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/iterator.range/end_non_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class C> auto end(C& c) -> decltype(c.end());
+
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    int ia[] = {1, 2, 3};
+    std::vector<int> v(ia, ia + sizeof(ia)/sizeof(ia[0]));
+    std::vector<int>::iterator i = end(v);
+    assert(i == v.end());
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator(const ostream_iterator& x);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::ostringstream outf;
+    std::ostream_iterator<int> i(outf);
+    std::ostream_iterator<int> j = i;
+    assert(outf.good());
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator(ostream_type& s);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::ostringstream outf;
+    std::ostream_iterator<int> i(outf);
+    assert(outf.good());
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator(ostream_type& s, const charT* delimiter);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostream_iterator<int> i(outf, ", ");
+        assert(outf.good());
+    }
+    {
+        std::wostringstream outf;
+        std::ostream_iterator<double, wchar_t> i(outf, L", ");
+        assert(outf.good());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator& operator=(const T& value);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostream_iterator<int> i(outf);
+        i = 2.4;
+        assert(outf.str() == "2");
+    }
+    {
+        std::ostringstream outf;
+        std::ostream_iterator<int> i(outf, ", ");
+        i = 2.4;
+        assert(outf.str() == "2, ");
+    }
+    {
+        std::wostringstream outf;
+        std::ostream_iterator<int, wchar_t> i(outf);
+        i = 2.4;
+        assert(outf.str() == L"2");
+    }
+    {
+        std::wostringstream outf;
+        std::ostream_iterator<int, wchar_t> i(outf, L", ");
+        i = 2.4;
+        assert(outf.str() == L"2, ");
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/dereference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/dereference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/dereference.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/dereference.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator& operator*() const;
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::ostringstream os;
+    std::ostream_iterator<int> i(os);
+    std::ostream_iterator<int>& iref = *i;
+    assert(&iref == &i);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/increment.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostream_iterator
+
+// ostream_iterator& operator++();
+// ostream_iterator& operator++(int);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::ostringstream os;
+    std::ostream_iterator<int> i(os);
+    std::ostream_iterator<int>& iref1 = ++i;
+    assert(&iref1 == &i);
+    std::ostream_iterator<int>& iref2 = i++;
+    assert(&iref2 == &i);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class T, class charT = char, class traits = char_traits<charT>,
+//           class Distance = ptrdiff_t>
+// class ostream_iterator
+//     : public iterator<output_iterator_tag, void, void, void, void>
+// {
+// public:
+//     typedef charT char_type;
+//     typedef traits traits_type;
+//     typedef basic_istream<charT,traits> istream_type;
+//     ...
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    typedef std::ostream_iterator<double> I1;
+    static_assert((std::is_convertible<I1,
+        std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
+    static_assert((std::is_same<I1::char_type, char>::value), "");
+    static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<I1::ostream_type, std::ostream>::value), "");
+    typedef std::ostream_iterator<unsigned, wchar_t> I2;
+    static_assert((std::is_convertible<I2,
+        std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
+    static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
+    static_assert((std::is_same<I2::ostream_type, std::wostream>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/ostream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/ostream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/ostream.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/ostream.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// ostreambuf_iterator(ostream_type& s) throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostreambuf_iterator<char> i(outf);
+        assert(!i.failed());
+    }
+    {
+        std::wostringstream outf;
+        std::ostreambuf_iterator<wchar_t> i(outf);
+        assert(!i.failed());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/streambuf.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// ostreambuf_iterator(streambuf_type* s) throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostreambuf_iterator<char> i(outf.rdbuf());
+        assert(!i.failed());
+    }
+    {
+        std::wostringstream outf;
+        std::ostreambuf_iterator<wchar_t> i(outf.rdbuf());
+        assert(!i.failed());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/assign_c.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/assign_c.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/assign_c.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/assign_c.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// ostreambuf_iterator<charT,traits>&
+//   operator=(charT c);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostreambuf_iterator<char> i(outf);
+        i = 'a';
+        assert(outf.str() == "a");
+        i = 'b';
+        assert(outf.str() == "ab");
+    }
+    {
+        std::wostringstream outf;
+        std::ostreambuf_iterator<wchar_t> i(outf);
+        i = L'a';
+        assert(outf.str() == L"a");
+        i = L'b';
+        assert(outf.str() == L"ab");
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/deref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/deref.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/deref.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/deref.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// ostreambuf_iterator<charT,traits>& operator*();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostreambuf_iterator<char> i(outf);
+        std::ostreambuf_iterator<char>& iref = *i;
+        assert(&iref == &i);
+    }
+    {
+        std::wostringstream outf;
+        std::ostreambuf_iterator<wchar_t> i(outf);
+        std::ostreambuf_iterator<wchar_t>& iref = *i;
+        assert(&iref == &i);
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// bool failed() const throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostreambuf_iterator<char> i(nullptr);
+        assert(i.failed());
+    }
+    {
+        std::ostreambuf_iterator<wchar_t> i(nullptr);
+        assert(i.failed());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/increment.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// ostreambuf_iterator<charT,traits>& operator++();
+// ostreambuf_iterator<charT,traits>& operator++(int);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream outf;
+        std::ostreambuf_iterator<char> i(outf);
+        std::ostreambuf_iterator<char>& iref = ++i;
+        assert(&iref == &i);
+        std::ostreambuf_iterator<char>& iref2 = i++;
+        assert(&iref2 == &i);
+    }
+    {
+        std::wostringstream outf;
+        std::ostreambuf_iterator<wchar_t> i(outf);
+        std::ostreambuf_iterator<wchar_t>& iref = ++i;
+        assert(&iref == &i);
+        std::ostreambuf_iterator<wchar_t>& iref2 = i++;
+        assert(&iref2 == &i);
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class charT, class traits = char_traits<charT> >
+// class ostreambuf_iterator
+//   : public iterator<output_iterator_tag, void, void, void, void>
+// {
+// public:
+//   typedef charT                          char_type;
+//   typedef traits                         traits_type;
+//   typedef basic_streambuf<charT, traits> streambuf_type;
+//   typedef basic_ostream<charT, traits>   ostream_type;
+//   ...
+
+#include <iterator>
+#include <string>
+#include <type_traits>
+
+int main()
+{
+    typedef std::ostreambuf_iterator<char> I1;
+    static_assert((std::is_convertible<I1,
+        std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
+    static_assert((std::is_same<I1::char_type, char>::value), "");
+    static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<I1::streambuf_type, std::streambuf>::value), "");
+    static_assert((std::is_same<I1::ostream_type, std::ostream>::value), "");
+
+    typedef std::ostreambuf_iterator<wchar_t> I2;
+    static_assert((std::is_convertible<I2,
+        std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
+    static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
+    static_assert((std::is_same<I2::streambuf_type, std::wstreambuf>::value), "");
+    static_assert((std::is_same<I2::ostream_type, std::wostream>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/version.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+#include <iterator>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,290 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdint>
+
+#include <cstdint>
+#include <csignal>
+#include <cwctype>
+#include <climits>
+#include <type_traits>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+    // typedef std::int8_t
+    static_assert(sizeof(std::int8_t)*CHAR_BIT == 8,
+                 "sizeof(std::int8_t)*CHAR_BIT == 8");
+    static_assert(std::is_signed<std::int8_t>::value,
+                 "std::is_signed<std::int8_t>::value");
+    // typedef std::int16_t
+    static_assert(sizeof(std::int16_t)*CHAR_BIT == 16,
+                 "sizeof(std::int16_t)*CHAR_BIT == 16");
+    static_assert(std::is_signed<std::int16_t>::value,
+                 "std::is_signed<std::int16_t>::value");
+    // typedef std::int32_t
+    static_assert(sizeof(std::int32_t)*CHAR_BIT == 32,
+                 "sizeof(std::int32_t)*CHAR_BIT == 32");
+    static_assert(std::is_signed<std::int32_t>::value,
+                 "std::is_signed<std::int32_t>::value");
+    // typedef std::int64_t
+    static_assert(sizeof(std::int64_t)*CHAR_BIT == 64,
+                 "sizeof(std::int64_t)*CHAR_BIT == 64");
+    static_assert(std::is_signed<std::int64_t>::value,
+                 "std::is_signed<std::int64_t>::value");
+
+    // typedef std::uint8_t
+    static_assert(sizeof(std::uint8_t)*CHAR_BIT == 8,
+                 "sizeof(std::uint8_t)*CHAR_BIT == 8");
+    static_assert(std::is_unsigned<std::uint8_t>::value,
+                 "std::is_unsigned<std::uint8_t>::value");
+    // typedef std::uint16_t
+    static_assert(sizeof(std::uint16_t)*CHAR_BIT == 16,
+                 "sizeof(std::uint16_t)*CHAR_BIT == 16");
+    static_assert(std::is_unsigned<std::uint16_t>::value,
+                 "std::is_unsigned<std::uint16_t>::value");
+    // typedef std::uint32_t
+    static_assert(sizeof(std::uint32_t)*CHAR_BIT == 32,
+                 "sizeof(std::uint32_t)*CHAR_BIT == 32");
+    static_assert(std::is_unsigned<std::uint32_t>::value,
+                 "std::is_unsigned<std::uint32_t>::value");
+    // typedef std::uint64_t
+    static_assert(sizeof(std::uint64_t)*CHAR_BIT == 64,
+                 "sizeof(std::uint64_t)*CHAR_BIT == 64");
+    static_assert(std::is_unsigned<std::uint64_t>::value,
+                 "std::is_unsigned<std::uint64_t>::value");
+
+    // typedef std::int_least8_t
+    static_assert(sizeof(std::int_least8_t)*CHAR_BIT >= 8,
+                 "sizeof(std::int_least8_t)*CHAR_BIT >= 8");
+    static_assert(std::is_signed<std::int_least8_t>::value,
+                 "std::is_signed<std::int_least8_t>::value");
+    // typedef std::int_least16_t
+    static_assert(sizeof(std::int_least16_t)*CHAR_BIT >= 16,
+                 "sizeof(std::int_least16_t)*CHAR_BIT >= 16");
+    static_assert(std::is_signed<std::int_least16_t>::value,
+                 "std::is_signed<std::int_least16_t>::value");
+    // typedef std::int_least32_t
+    static_assert(sizeof(std::int_least32_t)*CHAR_BIT >= 32,
+                 "sizeof(std::int_least32_t)*CHAR_BIT >= 32");
+    static_assert(std::is_signed<std::int_least32_t>::value,
+                 "std::is_signed<std::int_least32_t>::value");
+    // typedef std::int_least64_t
+    static_assert(sizeof(std::int_least64_t)*CHAR_BIT >= 64,
+                 "sizeof(std::int_least64_t)*CHAR_BIT >= 64");
+    static_assert(std::is_signed<std::int_least64_t>::value,
+                 "std::is_signed<std::int_least64_t>::value");
+
+    // typedef std::uint_least8_t
+    static_assert(sizeof(std::uint_least8_t)*CHAR_BIT >= 8,
+                 "sizeof(std::uint_least8_t)*CHAR_BIT >= 8");
+    static_assert(std::is_unsigned<std::uint_least8_t>::value,
+                 "std::is_unsigned<std::uint_least8_t>::value");
+    // typedef std::uint_least16_t
+    static_assert(sizeof(std::uint_least16_t)*CHAR_BIT >= 16,
+                 "sizeof(std::uint_least16_t)*CHAR_BIT >= 16");
+    static_assert(std::is_unsigned<std::uint_least16_t>::value,
+                 "std::is_unsigned<std::uint_least16_t>::value");
+    // typedef std::uint_least32_t
+    static_assert(sizeof(std::uint_least32_t)*CHAR_BIT >= 32,
+                 "sizeof(std::uint_least32_t)*CHAR_BIT >= 32");
+    static_assert(std::is_unsigned<std::uint_least32_t>::value,
+                 "std::is_unsigned<std::uint_least32_t>::value");
+    // typedef std::uint_least64_t
+    static_assert(sizeof(std::uint_least64_t)*CHAR_BIT >= 64,
+                 "sizeof(std::uint_least64_t)*CHAR_BIT >= 64");
+    static_assert(std::is_unsigned<std::uint_least64_t>::value,
+                 "std::is_unsigned<std::uint_least64_t>::value");
+
+    // typedef std::int_fast8_t
+    static_assert(sizeof(std::int_fast8_t)*CHAR_BIT >= 8,
+                 "sizeof(std::int_fast8_t)*CHAR_BIT >= 8");
+    static_assert(std::is_signed<std::int_fast8_t>::value,
+                 "std::is_signed<std::int_fast8_t>::value");
+    // typedef std::int_fast16_t
+    static_assert(sizeof(std::int_fast16_t)*CHAR_BIT >= 16,
+                 "sizeof(std::int_fast16_t)*CHAR_BIT >= 16");
+    static_assert(std::is_signed<std::int_fast16_t>::value,
+                 "std::is_signed<std::int_fast16_t>::value");
+    // typedef std::int_fast32_t
+    static_assert(sizeof(std::int_fast32_t)*CHAR_BIT >= 32,
+                 "sizeof(std::int_fast32_t)*CHAR_BIT >= 32");
+    static_assert(std::is_signed<std::int_fast32_t>::value,
+                 "std::is_signed<std::int_fast32_t>::value");
+    // typedef std::int_fast64_t
+    static_assert(sizeof(std::int_fast64_t)*CHAR_BIT >= 64,
+                 "sizeof(std::int_fast64_t)*CHAR_BIT >= 64");
+    static_assert(std::is_signed<std::int_fast64_t>::value,
+                 "std::is_signed<std::int_fast64_t>::value");
+
+    // typedef std::uint_fast8_t
+    static_assert(sizeof(std::uint_fast8_t)*CHAR_BIT >= 8,
+                 "sizeof(std::uint_fast8_t)*CHAR_BIT >= 8");
+    static_assert(std::is_unsigned<std::uint_fast8_t>::value,
+                 "std::is_unsigned<std::uint_fast8_t>::value");
+    // typedef std::uint_fast16_t
+    static_assert(sizeof(std::uint_fast16_t)*CHAR_BIT >= 16,
+                 "sizeof(std::uint_fast16_t)*CHAR_BIT >= 16");
+    static_assert(std::is_unsigned<std::uint_fast16_t>::value,
+                 "std::is_unsigned<std::uint_fast16_t>::value");
+    // typedef std::uint_fast32_t
+    static_assert(sizeof(std::uint_fast32_t)*CHAR_BIT >= 32,
+                 "sizeof(std::uint_fast32_t)*CHAR_BIT >= 32");
+    static_assert(std::is_unsigned<std::uint_fast32_t>::value,
+                 "std::is_unsigned<std::uint_fast32_t>::value");
+    // typedef std::uint_fast64_t
+    static_assert(sizeof(std::uint_fast64_t)*CHAR_BIT >= 64,
+                 "sizeof(std::uint_fast64_t)*CHAR_BIT >= 64");
+    static_assert(std::is_unsigned<std::uint_fast64_t>::value,
+                 "std::is_unsigned<std::uint_fast64_t>::value");
+
+    // typedef std::intptr_t
+    static_assert(sizeof(std::intptr_t) >= sizeof(void*),
+                 "sizeof(std::intptr_t) >= sizeof(void*)");
+    static_assert(std::is_signed<std::intptr_t>::value,
+                 "std::is_signed<std::intptr_t>::value");
+    // typedef std::uintptr_t
+    static_assert(sizeof(std::uintptr_t) >= sizeof(void*),
+                 "sizeof(std::uintptr_t) >= sizeof(void*)");
+    static_assert(std::is_unsigned<std::uintptr_t>::value,
+                 "std::is_unsigned<std::uintptr_t>::value");
+
+    // typedef std::intmax_t
+    static_assert(sizeof(std::intmax_t) >= sizeof(long long),
+                 "sizeof(std::intmax_t) >= sizeof(long long)");
+    static_assert(std::is_signed<std::intmax_t>::value,
+                 "std::is_signed<std::intmax_t>::value");
+    // typedef std::uintmax_t
+    static_assert(sizeof(std::uintmax_t) >= sizeof(unsigned long long),
+                 "sizeof(std::uintmax_t) >= sizeof(unsigned long long)");
+    static_assert(std::is_unsigned<std::uintmax_t>::value,
+                 "std::is_unsigned<std::uintmax_t>::value");
+
+    // INTN_MIN
+    static_assert(INT8_MIN == -128, "INT8_MIN == -128");
+    static_assert(INT16_MIN == -32768, "INT16_MIN == -32768");
+    static_assert(INT32_MIN == -2147483648U, "INT32_MIN == -2147483648");
+    static_assert(INT64_MIN == -9223372036854775808ULL, "INT64_MIN == -9223372036854775808LL");
+
+    // INTN_MAX
+    static_assert(INT8_MAX == 127, "INT8_MAX == 127");
+    static_assert(INT16_MAX == 32767, "INT16_MAX == 32767");
+    static_assert(INT32_MAX == 2147483647, "INT32_MAX == 2147483647");
+    static_assert(INT64_MAX == 9223372036854775807LL, "INT64_MAX == 9223372036854775807LL");
+
+    // UINTN_MAX
+    static_assert(UINT8_MAX == 255, "UINT8_MAX == 255");
+    static_assert(UINT16_MAX == 65535, "UINT16_MAX == 65535");
+    static_assert(UINT32_MAX == 4294967295U, "UINT32_MAX == 4294967295");
+    static_assert(UINT64_MAX == 18446744073709551615ULL, "UINT64_MAX == 18446744073709551615ULL");
+
+    // INT_FASTN_MIN
+    static_assert(INT_FAST8_MIN <= -128, "INT_FAST8_MIN <= -128");
+    static_assert(INT_FAST16_MIN <= -32768, "INT_FAST16_MIN <= -32768");
+    static_assert(INT_FAST32_MIN <= -2147483648U, "INT_FAST32_MIN <= -2147483648");
+    static_assert(INT_FAST64_MIN <= -9223372036854775808ULL, "INT_FAST64_MIN <= -9223372036854775808LL");
+
+    // INT_FASTN_MAX
+    static_assert(INT_FAST8_MAX >= 127, "INT_FAST8_MAX >= 127");
+    static_assert(INT_FAST16_MAX >= 32767, "INT_FAST16_MAX >= 32767");
+    static_assert(INT_FAST32_MAX >= 2147483647, "INT_FAST32_MAX >= 2147483647");
+    static_assert(INT_FAST64_MAX >= 9223372036854775807LL, "INT_FAST64_MAX >= 9223372036854775807LL");
+
+    // UINT_FASTN_MAX
+    static_assert(UINT_FAST8_MAX >= 255, "UINT_FAST8_MAX >= 255");
+    static_assert(UINT_FAST16_MAX >= 65535, "UINT_FAST16_MAX >= 65535");
+    static_assert(UINT_FAST32_MAX >= 4294967295U, "UINT_FAST32_MAX >= 4294967295");
+    static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, "UINT_FAST64_MAX >= 18446744073709551615ULL");
+
+    // INTPTR_MIN
+    assert(INTPTR_MIN == std::numeric_limits<std::intptr_t>::min());
+
+    // INTPTR_MAX
+    assert(INTPTR_MAX == std::numeric_limits<std::intptr_t>::max());
+
+    // UINTPTR_MAX
+    assert(UINTPTR_MAX == std::numeric_limits<std::uintptr_t>::max());
+
+    // INTMAX_MIN
+    assert(INTMAX_MIN == std::numeric_limits<std::intmax_t>::min());
+
+    // INTMAX_MAX
+    assert(INTMAX_MAX == std::numeric_limits<std::intmax_t>::max());
+
+    // UINTMAX_MAX
+    assert(UINTMAX_MAX == std::numeric_limits<std::uintmax_t>::max());
+
+    // PTRDIFF_MIN
+    assert(PTRDIFF_MIN == std::numeric_limits<std::ptrdiff_t>::min());
+
+    // PTRDIFF_MAX
+    assert(PTRDIFF_MAX == std::numeric_limits<std::ptrdiff_t>::max());
+
+    // SIG_ATOMIC_MIN
+    assert(SIG_ATOMIC_MIN == std::numeric_limits<std::sig_atomic_t>::min());
+
+    // SIG_ATOMIC_MAX
+    assert(SIG_ATOMIC_MAX == std::numeric_limits<std::sig_atomic_t>::max());
+
+    // SIZE_MAX
+    assert(SIZE_MAX == std::numeric_limits<std::size_t>::max());
+
+    // WCHAR_MIN
+    assert(WCHAR_MIN == std::numeric_limits<wchar_t>::min());
+
+    // WCHAR_MAX
+    assert(WCHAR_MAX == std::numeric_limits<wchar_t>::max());
+
+    // WINT_MIN
+    assert(WINT_MIN == std::numeric_limits<std::wint_t>::min());
+
+    // WINT_MAX
+    assert(WINT_MAX == std::numeric_limits<std::wint_t>::max());
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
+}

Added: libcxx/trunk/test/std/language.support/cstdint/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/cstdint/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/cstdint/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/cstdint/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdint>
+
+#include <cstdint>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_alloc
+
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_base_of<std::exception, std::bad_alloc>::value),
+                 "std::is_base_of<std::exception, std::bad_alloc>::value");
+    static_assert(std::is_polymorphic<std::bad_alloc>::value,
+                 "std::is_polymorphic<std::bad_alloc>::value");
+    std::bad_alloc b;
+    std::bad_alloc b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_array_length
+
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#if __LIBCPP_STD_VER > 11
+    static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
+                  "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
+    static_assert(std::is_polymorphic<std::bad_array_length>::value,
+                 "std::is_polymorphic<std::bad_array_length>::value");
+    std::bad_array_length b;
+    std::bad_array_length b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_array_new_length
+
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_base_of<std::bad_alloc, std::bad_array_new_length>::value),
+                  "std::is_base_of<std::bad_alloc, std::bad_array_new_length>::value");
+    static_assert(std::is_polymorphic<std::bad_array_new_length>::value,
+                 "std::is_polymorphic<std::bad_array_new_length>::value");
+    std::bad_array_new_length b;
+    std::bad_array_new_length b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test new_handler
+
+#include <new>
+
+void f() {}
+
+int main()
+{
+    std::new_handler p = f;
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/get_new_handler.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/get_new_handler.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/get_new_handler.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/get_new_handler.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test get_new_handler
+
+#include <new>
+#include <cassert>
+
+void f1() {}
+void f2() {}
+
+int main()
+{
+    assert(std::get_new_handler() == 0);
+    std::set_new_handler(f1);
+    assert(std::get_new_handler() == f1);
+    std::set_new_handler(f2);
+    assert(std::get_new_handler() == f2);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/set_new_handler.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/set_new_handler.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/set_new_handler.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/alloc.errors/set.new.handler/set_new_handler.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test set_new_handler
+
+#include <new>
+#include <cassert>
+
+void f1() {}
+void f2() {}
+
+int main()
+{
+    assert(std::set_new_handler(f1) == 0);
+    assert(std::set_new_handler(f2) == f1);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new[]
+// NOTE: asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <limits>
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+    ++new_handler_called;
+    std::set_new_handler(0);
+}
+
+int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    std::set_new_handler(new_handler);
+    try
+    {
+        void*volatile vp = operator new[] (std::numeric_limits<std::size_t>::max());
+        assert(false);
+    }
+    catch (std::bad_alloc&)
+    {
+        assert(new_handler_called == 1);
+    }
+    catch (...)
+    {
+        assert(false);
+    }
+    A* ap = new A[3];
+    assert(ap);
+    assert(A_constructed == 3);
+    delete [] ap;
+    assert(A_constructed == 0);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new [] (nothrow)
+// NOTE: asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <limits>
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+    ++new_handler_called;
+    std::set_new_handler(0);
+}
+
+int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    std::set_new_handler(new_handler);
+    try
+    {
+        void*volatile vp = operator new [] (std::numeric_limits<std::size_t>::max(), std::nothrow);
+        assert(new_handler_called == 1);
+        assert(vp == 0);
+    }
+    catch (...)
+    {
+        assert(false);
+    }
+    A* ap = new(std::nothrow) A[3];
+    assert(ap);
+    assert(A_constructed == 3);
+    delete [] ap;
+    assert(A_constructed == 0);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new [] nothrow by replacing only operator new
+
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+volatile int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    A* ap = new (std::nothrow) A[3];
+    assert(ap);
+    assert(A_constructed == 3);
+    assert(new_called);
+    delete [] ap;
+    assert(A_constructed == 0);
+    assert(!new_called);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new[] replacement by replacing only operator new
+
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+volatile int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    A* ap = new A[3];
+    assert(ap);
+    assert(A_constructed == 3);
+    assert(new_called == 1);
+    delete [] ap;
+    assert(A_constructed == 0);
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.dataraces/not_testable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.dataraces/not_testable.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.dataraces/not_testable.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.dataraces/not_testable.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test placement new
+
+#include <new>
+#include <cassert>
+
+int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    char buf[sizeof(A)];
+
+    A* ap = new(buf) A;
+    assert((char*)ap == buf);
+    assert(A_constructed == 1);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test placement new array
+
+#include <new>
+#include <cassert>
+
+int A_constructed = 0;
+
+struct A
+{
+    A() {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    char buf[3*sizeof(A)];
+
+    A* ap = new(buf) A[3];
+    assert((char*)ap == buf);
+    assert(A_constructed == 3);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <limits>
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+    ++new_handler_called;
+    std::set_new_handler(0);
+}
+
+bool A_constructed = false;
+
+struct A
+{
+    A() {A_constructed = true;}
+    ~A() {A_constructed = false;}
+};
+
+int main()
+{
+    std::set_new_handler(new_handler);
+    try
+    {
+        void* vp = operator new (std::numeric_limits<std::size_t>::max());
+        assert(false);
+    }
+    catch (std::bad_alloc&)
+    {
+        assert(new_handler_called == 1);
+    }
+    catch (...)
+    {
+        assert(false);
+    }
+    A* ap = new A;
+    assert(ap);
+    assert(A_constructed);
+    delete ap;
+    assert(!A_constructed);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new (nothrow)
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <limits>
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+    ++new_handler_called;
+    std::set_new_handler(0);
+}
+
+bool A_constructed = false;
+
+struct A
+{
+    A() {A_constructed = true;}
+    ~A() {A_constructed = false;}
+};
+
+int main()
+{
+    std::set_new_handler(new_handler);
+    try
+    {
+        void* vp = operator new (std::numeric_limits<std::size_t>::max(), std::nothrow);
+        assert(new_handler_called == 1);
+        assert(vp == 0);
+    }
+    catch (...)
+    {
+        assert(false);
+    }
+    A* ap = new(std::nothrow) A;
+    assert(ap);
+    assert(A_constructed);
+    delete ap;
+    assert(!A_constructed);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new nothrow by replacing only operator new
+
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+bool A_constructed = false;
+
+struct A
+{
+    A() {A_constructed = true;}
+    ~A() {A_constructed = false;}
+};
+
+int main()
+{
+    A* ap = new (std::nothrow) A;
+    assert(ap);
+    assert(A_constructed);
+    assert(new_called);
+    delete ap;
+    assert(!A_constructed);
+    assert(!new_called);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test operator new replacement
+
+// UNSUPPORTED: asan, msan
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+bool A_constructed = false;
+
+struct A
+{
+    A() {A_constructed = true;}
+    ~A() {A_constructed = false;}
+};
+
+int main()
+{
+    A* ap = new A;
+    assert(ap);
+    assert(A_constructed);
+    assert(new_called);
+    delete ap;
+    assert(!A_constructed);
+    assert(!new_called);
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.dynamic/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.dynamic/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+#include <new>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.exception/bad.exception/bad_exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/bad.exception/bad_exception.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/bad.exception/bad_exception.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/bad.exception/bad_exception.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_exception
+
+#include <exception>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_base_of<std::exception, std::bad_exception>::value),
+                 "std::is_base_of<std::exception, std::bad_exception>::value");
+    static_assert(std::is_polymorphic<std::bad_exception>::value,
+                 "std::is_polymorphic<std::bad_exception>::value");
+    std::bad_exception b;
+    std::bad_exception b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// nested_exception& operator=(const nested_exception&) throw() = default;
+
+#include <exception>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    {
+        std::nested_exception e0;
+        std::nested_exception e;
+        e = e0;
+        assert(e.nested_ptr() == nullptr);
+    }
+    {
+        try
+        {
+            throw A(2);
+            assert(false);
+        }
+        catch (const A&)
+        {
+            std::nested_exception e0;
+            std::nested_exception e;
+            e = e0;
+            assert(e.nested_ptr() != nullptr);
+            try
+            {
+                rethrow_exception(e.nested_ptr());
+                assert(false);
+            }
+            catch (const A& a)
+            {
+                assert(a == A(2));
+            }
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// nested_exception(const nested_exception&) throw() = default;
+
+#include <exception>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    {
+        std::nested_exception e0;
+        std::nested_exception e = e0;
+        assert(e.nested_ptr() == nullptr);
+    }
+    {
+        try
+        {
+            throw A(2);
+            assert(false);
+        }
+        catch (const A&)
+        {
+            std::nested_exception e0;
+            std::nested_exception e = e0;
+            assert(e.nested_ptr() != nullptr);
+            try
+            {
+                rethrow_exception(e.nested_ptr());
+                assert(false);
+            }
+            catch (const A& a)
+            {
+                assert(a == A(2));
+            }
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// nested_exception() throw();
+
+#include <exception>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    {
+        std::nested_exception e;
+        assert(e.nested_ptr() == nullptr);
+    }
+    {
+        try
+        {
+            throw A(2);
+            assert(false);
+        }
+        catch (const A&)
+        {
+            std::nested_exception e;
+            assert(e.nested_ptr() != nullptr);
+            try
+            {
+                rethrow_exception(e.nested_ptr());
+                assert(false);
+            }
+            catch (const A& a)
+            {
+                assert(a == A(2));
+            }
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// template <class E> void rethrow_if_nested(const E& e);
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+    virtual ~A() _NOEXCEPT {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+class B
+    : public std::nested_exception,
+      public A
+{
+public:
+    explicit B(int data) : A(data) {}
+    B(const B& b) : A(b) {}
+};
+
+int main()
+{
+    {
+        try
+        {
+            A a(3);
+            std::rethrow_if_nested(a);
+            assert(true);
+        }
+        catch (...)
+        {
+            assert(false);
+        }
+    }
+    {
+        try
+        {
+            throw B(5);
+        }
+        catch (const B& b)
+        {
+            try
+            {
+                throw b;
+            }
+            catch (const A& a)
+            {
+                try
+                {
+                    std::rethrow_if_nested(a);
+                    assert(false);
+                }
+                catch (const B& b)
+                {
+                    assert(b == B(5));
+                }
+            }
+        }
+    }
+    {
+        try
+        {
+            std::rethrow_if_nested(1);
+            assert(true);
+        }
+        catch (...)
+        {
+            assert(false);
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// void rethrow_nested [[noreturn]] () const;
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+void go_quietly()
+{
+    std::exit(0);
+}
+
+int main()
+{
+    {
+        try
+        {
+            throw A(2);
+            assert(false);
+        }
+        catch (const A&)
+        {
+            const std::nested_exception e;
+            assert(e.nested_ptr() != nullptr);
+            try
+            {
+                e.rethrow_nested();
+                assert(false);
+            }
+            catch (const A& a)
+            {
+                assert(a == A(2));
+            }
+        }
+    }
+    {
+        try
+        {
+            std::set_terminate(go_quietly);
+            const std::nested_exception e;
+            e.rethrow_nested();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(false);
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// class nested_exception;
+
+// template<class T> void throw_with_nested [[noreturn]] (T&& t);
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    explicit A(int data) : data_(data) {}
+
+    friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
+};
+
+class B
+    : public std::nested_exception
+{
+    int data_;
+public:
+    explicit B(int data) : data_(data) {}
+
+    friend bool operator==(const B& x, const B& y) {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    {
+        try
+        {
+            A a(3);
+            std::throw_with_nested(a);
+            assert(false);
+        }
+        catch (const A& a)
+        {
+            assert(a == A(3));
+        }
+    }
+    {
+        try
+        {
+            A a(4);
+            std::throw_with_nested(a);
+            assert(false);
+        }
+        catch (const std::nested_exception& e)
+        {
+            assert(e.nested_ptr() == nullptr);
+        }
+    }
+    {
+        try
+        {
+            B b(5);
+            std::throw_with_nested(b);
+            assert(false);
+        }
+        catch (const B& b)
+        {
+            assert(b == B(5));
+        }
+    }
+    {
+        try
+        {
+            B b(6);
+            std::throw_with_nested(b);
+            assert(false);
+        }
+        catch (const std::nested_exception& e)
+        {
+            assert(e.nested_ptr() == nullptr);
+            const B& b = dynamic_cast<const B&>(e);
+            assert(b == B(6));
+        }
+    }
+    {
+        try
+        {
+            int i = 7;
+            std::throw_with_nested(i);
+            assert(false);
+        }
+        catch (int i)
+        {
+            assert(i == 7);
+        }
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception.terminate/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/get_terminate.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test get_terminate
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+void f1() {}
+void f2() {}
+
+int main()
+{
+    std::set_terminate(f1);
+    assert(std::get_terminate() == f1);
+    std::set_terminate(f2);
+    assert(std::get_terminate() == f2);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception.terminate/set.terminate/set_terminate.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test set_terminate
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+void f1() {}
+void f2() {}
+
+int main()
+{
+    std::set_terminate(f1);
+    assert(std::set_terminate(f2) == f1);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test terminate_handler
+
+#include <exception>
+
+void f() {}
+
+int main()
+{
+    std::terminate_handler p = f;
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception.terminate/terminate/terminate.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test terminate
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+void f1()
+{
+    std::exit(0);
+}
+
+int main()
+{
+    std::set_terminate(f1);
+    std::terminate();
+    assert(false);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/exception/exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/exception/exception.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/exception/exception.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/exception/exception.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test exception
+
+#include <exception>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert(std::is_polymorphic<std::exception>::value,
+                 "std::is_polymorphic<std::exception>::value");
+    std::exception b;
+    std::exception b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,269 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// exception_ptr current_exception();
+
+#include <exception>
+#include <cassert>
+
+struct A
+{
+    static int constructed;
+
+    A() {++constructed;}
+    ~A() {--constructed;}
+    A(const A&)  {++constructed;}
+};
+
+int A::constructed = 0;
+
+int main()
+{
+    {
+        std::exception_ptr p = std::current_exception();
+        assert(p == nullptr);
+    }
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+    assert(A::constructed == 0);
+    {
+        std::exception_ptr p2;
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            std::exception_ptr p = std::current_exception();
+            assert(A::constructed == 1);
+            assert(p != nullptr);
+            p2 = std::current_exception();
+            assert(A::constructed == 1);
+            assert(p == p2);
+        }
+        assert(A::constructed == 1);
+    }
+    assert(A::constructed == 0);
+    {
+        std::exception_ptr p2;
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (A& a)
+        {
+            std::exception_ptr p = std::current_exception();
+            assert(A::constructed == 1);
+            assert(p != nullptr);
+            p2 = std::current_exception();
+            assert(A::constructed == 1);
+            assert(p == p2);
+        }
+        assert(A::constructed == 1);
+    }
+    assert(A::constructed == 0);
+    {
+        std::exception_ptr p2;
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (A a)
+        {
+            std::exception_ptr p = std::current_exception();
+            assert(A::constructed == 2);
+            assert(p != nullptr);
+            p2 = std::current_exception();
+            assert(A::constructed == 2);
+            assert(p == p2);
+        }
+        assert(A::constructed == 1);
+    }
+    assert(A::constructed == 0);
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                assert(A::constructed == 1);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                assert(A::constructed == 1);
+            }
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+    assert(A::constructed == 0);
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                std::exception_ptr p = std::current_exception();
+                assert(A::constructed == 1);
+                assert(p != nullptr);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                assert(A::constructed == 1);
+            }
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+    assert(A::constructed == 0);
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                assert(A::constructed == 1);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                std::exception_ptr p = std::current_exception();
+                assert(A::constructed == 1);
+                assert(p != nullptr);
+            }
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+    assert(A::constructed == 0);
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                assert(A::constructed == 1);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                assert(A::constructed == 1);
+            }
+            std::exception_ptr p = std::current_exception();
+            assert(A::constructed == 1);
+            assert(p != nullptr);
+        }
+        assert(A::constructed == 0);
+    }
+    assert(A::constructed == 0);
+    {
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                assert(A::constructed == 1);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                assert(A::constructed == 1);
+            }
+            assert(A::constructed == 1);
+        }
+        std::exception_ptr p = std::current_exception();
+        assert(A::constructed == 0);
+        assert(p == nullptr);
+    }
+    assert(A::constructed == 0);
+    {
+        std::exception_ptr p;
+        try
+        {
+            assert(A::constructed == 0);
+            throw A();
+            assert(false);
+        }
+        catch (...)
+        {
+            assert(A::constructed == 1);
+            try
+            {
+                assert(A::constructed == 1);
+                throw;
+                assert(false);
+            }
+            catch (...)
+            {
+                p = std::current_exception();
+                assert(A::constructed == 1);
+            }
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 1);
+        assert(p != nullptr);
+    }
+    assert(A::constructed == 0);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// typedef unspecified exception_ptr;
+
+// exception_ptr shall satisfy the requirements of NullablePointer.
+
+#include <exception>
+#include <cassert>
+
+int main()
+{
+    std::exception_ptr p;
+    assert(p == nullptr);
+    std::exception_ptr p2 = p;
+    assert(nullptr == p);
+    assert(!p);
+    assert(p2 == p);
+    p2 = p;
+    assert(p2 == p);
+    assert(p2 == nullptr);
+    std::exception_ptr p3 = nullptr;
+    assert(p3 == nullptr);
+    p3 = nullptr;
+    assert(p3 == nullptr);
+}

Added: libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// template<class E> exception_ptr make_exception_ptr(E e);
+
+#include <exception>
+#include <cassert>
+
+struct A
+{
+    static int constructed;
+    int data_;
+
+    A(int data = 0) : data_(data) {++constructed;}
+    ~A() {--constructed;}
+    A(const A& a) : data_(a.data_) {++constructed;}
+};
+
+int A::constructed = 0;
+
+int main()
+{
+    {
+        std::exception_ptr p = std::make_exception_ptr(A(5));
+        try
+        {
+            std::rethrow_exception(p);
+            assert(false);
+        }
+        catch (const A& a)
+        {
+            assert(A::constructed == 1);
+            assert(p != nullptr);
+            p = nullptr;
+            assert(p == nullptr);
+            assert(a.data_ == 5);
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+// void rethrow_exception [[noreturn]] (exception_ptr p);
+
+#include <exception>
+#include <cassert>
+
+struct A
+{
+    static int constructed;
+    int data_;
+
+    A(int data = 0) : data_(data) {++constructed;}
+    ~A() {--constructed;}
+    A(const A& a) : data_(a.data_) {++constructed;}
+};
+
+int A::constructed = 0;
+
+int main()
+{
+    {
+        std::exception_ptr p;
+        try
+        {
+            throw A(3);
+        }
+        catch (...)
+        {
+            p = std::current_exception();
+        }
+        try
+        {
+            std::rethrow_exception(p);
+            assert(false);
+        }
+        catch (const A& a)
+        {
+            assert(A::constructed == 1);
+            assert(p != nullptr);
+            p = nullptr;
+            assert(p == nullptr);
+            assert(a.data_ == 3);
+            assert(A::constructed == 1);
+        }
+        assert(A::constructed == 0);
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test uncaught_exception
+
+#include <exception>
+#include <cassert>
+
+struct A
+{
+    ~A()
+    {
+        assert(std::uncaught_exception());
+    }
+};
+
+struct B
+{
+    B()
+    {
+        // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
+        assert(!std::uncaught_exception());
+    }
+};
+
+int main()
+{
+    try
+    {
+        A a;
+        assert(!std::uncaught_exception());
+        throw B();
+    }
+    catch (...)
+    {
+        assert(!std::uncaught_exception());
+    }
+    assert(!std::uncaught_exception());
+}

Added: libcxx/trunk/test/std/language.support/support.exception/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.exception/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <exception>
+
+#include <exception>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// template<class E> class initializer_list;
+
+// const E* begin() const;
+// const E* end() const;
+// size_t size() const;
+
+#include <initializer_list>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+struct A
+{
+    A(std::initializer_list<int> il)
+    {
+        const int* b = il.begin();
+        const int* e = il.end();
+        assert(il.size() == 3);
+        assert(e - b == il.size());
+        assert(*b++ == 3);
+        assert(*b++ == 2);
+        assert(*b++ == 1);
+    }
+};
+
+#if _LIBCPP_STD_VER > 11
+struct B
+{
+    constexpr B(std::initializer_list<int> il)
+    {
+        const int* b = il.begin();
+        const int* e = il.end();
+        assert(il.size() == 3);
+        assert(e - b == il.size());
+        assert(*b++ == 3);
+        assert(*b++ == 2);
+        assert(*b++ == 1);
+    }
+};
+
+#endif  // _LIBCPP_STD_VER > 11
+
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    A test1 = {3, 2, 1};
+#endif
+#if _LIBCPP_STD_VER > 11
+    constexpr B test2 = {3, 2, 1};
+#endif  // _LIBCPP_STD_VER > 11
+}

Added: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// template<class E> class initializer_list;
+
+// initializer_list();
+
+#include <initializer_list>
+#include <cassert>
+
+struct A {};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    std::initializer_list<A> il;
+    assert(il.size() == 0);
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if _LIBCPP_STD_VER > 11
+    constexpr std::initializer_list<A> il2;
+    static_assert(il2.size() == 0, "");
+#endif  // _LIBCPP_STD_VER > 11
+}

Added: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <initializer_list>
+
+// template<class E> const E* begin(initializer_list<E> il);
+
+#include <initializer_list>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+struct A
+{
+    A(std::initializer_list<int> il)
+    {
+        const int* b = begin(il);
+        const int* e = end(il);
+        assert(il.size() == 3);
+        assert(e - b == il.size());
+        assert(*b++ == 3);
+        assert(*b++ == 2);
+        assert(*b++ == 1);
+    }
+};
+
+#if _LIBCPP_STD_VER > 11
+struct B
+{
+    constexpr B(std::initializer_list<int> il)
+    {
+        const int* b = begin(il);
+        const int* e = end(il);
+        assert(il.size() == 3);
+        assert(e - b == il.size());
+        assert(*b++ == 3);
+        assert(*b++ == 2);
+        assert(*b++ == 1);
+    }
+};
+
+#endif  // _LIBCPP_STD_VER > 11
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    A test1 = {3, 2, 1};
+#endif
+#if _LIBCPP_STD_VER > 11
+    constexpr B test2 = {3, 2, 1};
+#endif  // _LIBCPP_STD_VER > 11
+}

Added: libcxx/trunk/test/std/language.support/support.initlist/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/types.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.initlist/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// template<class E>
+// class initializer_list
+// {
+// public:
+//     typedef E        value_type;
+//     typedef const E& reference;
+//     typedef const E& const_reference;
+//     typedef size_t   size_type;
+//
+//     typedef const E* iterator;
+//     typedef const E* const_iterator;
+
+#include <initializer_list>
+#include <type_traits>
+
+struct A {};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    static_assert((std::is_same<std::initializer_list<A>::value_type, A>::value), "");
+    static_assert((std::is_same<std::initializer_list<A>::reference, const A&>::value), "");
+    static_assert((std::is_same<std::initializer_list<A>::const_reference, const A&>::value), "");
+    static_assert((std::is_same<std::initializer_list<A>::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<std::initializer_list<A>::iterator, const A*>::value), "");
+    static_assert((std::is_same<std::initializer_list<A>::const_iterator, const A*>::value), "");
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/language.support/support.initlist/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.initlist/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <initializer_list>
+
+#include <initializer_list>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+ // test cfloat
+
+#include <cfloat>
+
+#ifndef FLT_ROUNDS
+#error FLT_ROUNDS not defined
+#endif
+
+#ifndef FLT_EVAL_METHOD
+#error FLT_EVAL_METHOD not defined
+#endif
+
+#ifndef FLT_RADIX
+#error FLT_RADIX not defined
+#endif
+
+#ifndef FLT_MANT_DIG
+#error FLT_MANT_DIG not defined
+#endif
+
+#ifndef DBL_MANT_DIG
+#error DBL_MANT_DIG not defined
+#endif
+
+#ifndef LDBL_MANT_DIG
+#error LDBL_MANT_DIG not defined
+#endif
+
+#ifndef DECIMAL_DIG
+#error DECIMAL_DIG not defined
+#endif
+
+#ifndef FLT_DIG
+#error FLT_DIG not defined
+#endif
+
+#ifndef DBL_DIG
+#error DBL_DIG not defined
+#endif
+
+#ifndef LDBL_DIG
+#error LDBL_DIG not defined
+#endif
+
+#ifndef FLT_MIN_EXP
+#error FLT_MIN_EXP not defined
+#endif
+
+#ifndef DBL_MIN_EXP
+#error DBL_MIN_EXP not defined
+#endif
+
+#ifndef LDBL_MIN_EXP
+#error LDBL_MIN_EXP not defined
+#endif
+
+#ifndef FLT_MIN_10_EXP
+#error FLT_MIN_10_EXP not defined
+#endif
+
+#ifndef DBL_MIN_10_EXP
+#error DBL_MIN_10_EXP not defined
+#endif
+
+#ifndef LDBL_MIN_10_EXP
+#error LDBL_MIN_10_EXP not defined
+#endif
+
+#ifndef FLT_MAX_EXP
+#error FLT_MAX_EXP not defined
+#endif
+
+#ifndef DBL_MAX_EXP
+#error DBL_MAX_EXP not defined
+#endif
+
+#ifndef LDBL_MAX_EXP
+#error LDBL_MAX_EXP not defined
+#endif
+
+#ifndef FLT_MAX_10_EXP
+#error FLT_MAX_10_EXP not defined
+#endif
+
+#ifndef DBL_MAX_10_EXP
+#error DBL_MAX_10_EXP not defined
+#endif
+
+#ifndef LDBL_MAX_10_EXP
+#error LDBL_MAX_10_EXP not defined
+#endif
+
+#ifndef FLT_MAX
+#error FLT_MAX not defined
+#endif
+
+#ifndef DBL_MAX
+#error DBL_MAX not defined
+#endif
+
+#ifndef LDBL_MAX
+#error LDBL_MAX not defined
+#endif
+
+#ifndef FLT_EPSILON
+#error FLT_EPSILON not defined
+#endif
+
+#ifndef DBL_EPSILON
+#error DBL_EPSILON not defined
+#endif
+
+#ifndef LDBL_EPSILON
+#error LDBL_EPSILON not defined
+#endif
+
+#ifndef FLT_MIN
+#error FLT_MIN not defined
+#endif
+
+#ifndef DBL_MIN
+#error DBL_MIN not defined
+#endif
+
+#ifndef LDBL_MIN
+#error LDBL_MIN not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/c.limits/climits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/c.limits/climits.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/c.limits/climits.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/c.limits/climits.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+ // test climits
+
+#include <climits>
+
+#ifndef CHAR_BIT
+#error CHAR_BIT not defined
+#endif
+
+#ifndef SCHAR_MIN
+#error SCHAR_MIN not defined
+#endif
+
+#ifndef SCHAR_MAX
+#error SCHAR_MAX not defined
+#endif
+
+#ifndef UCHAR_MAX
+#error UCHAR_MAX not defined
+#endif
+
+#ifndef CHAR_MIN
+#error CHAR_MIN not defined
+#endif
+
+#ifndef CHAR_MAX
+#error CHAR_MAX not defined
+#endif
+
+#ifndef MB_LEN_MAX
+#error MB_LEN_MAX not defined
+#endif
+
+#ifndef SHRT_MIN
+#error SHRT_MIN not defined
+#endif
+
+#ifndef SHRT_MAX
+#error SHRT_MAX not defined
+#endif
+
+#ifndef USHRT_MAX
+#error USHRT_MAX not defined
+#endif
+
+#ifndef INT_MIN
+#error INT_MIN not defined
+#endif
+
+#ifndef INT_MAX
+#error INT_MAX not defined
+#endif
+
+#ifndef UINT_MAX
+#error UINT_MAX not defined
+#endif
+
+#ifndef LONG_MIN
+#error LONG_MIN not defined
+#endif
+
+#ifndef LONG_MAX
+#error LONG_MAX not defined
+#endif
+
+#ifndef ULONG_MAX
+#error ULONG_MAX not defined
+#endif
+
+#ifndef LLONG_MIN
+#error LLONG_MIN not defined
+#endif
+
+#ifndef LLONG_MAX
+#error LLONG_MAX not defined
+#endif
+
+#ifndef ULLONG_MAX
+#error ULLONG_MAX not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/c.limits/version_cfloat.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cfloat>
+
+#include <cfloat>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/c.limits/version_climits.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <climits>
+
+#include <climits>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/denorm.style/check_values.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/denorm.style/check_values.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/denorm.style/check_values.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/denorm.style/check_values.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// float_round_style
+
+#include <limits>
+
+typedef char one;
+struct two {one _[2];};
+
+one test(std::float_round_style);
+two test(int);
+
+int main()
+{
+    static_assert(std::round_indeterminate == -1,
+                 "std::round_indeterminate == -1");
+    static_assert(std::round_toward_zero == 0,
+                 "std::round_toward_zero == 0");
+    static_assert(std::round_to_nearest == 1,
+                 "std::round_to_nearest == 1");
+    static_assert(std::round_toward_infinity == 2,
+                 "std::round_toward_infinity == 2");
+    static_assert(std::round_toward_neg_infinity == 3,
+                 "std::round_toward_neg_infinity == 3");
+    static_assert(sizeof(test(std::round_to_nearest)) == 1,
+                 "sizeof(test(std::round_to_nearest)) == 1");
+    static_assert(sizeof(test(1)) == 2,
+                 "sizeof(test(1)) == 2");
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/is_specialized.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/is_specialized.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/is_specialized.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/is_specialized.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// Specializations shall be provided for each arithmetic type, both floating
+// point and integer, including bool. The member is_specialized shall be
+// true for all such specializations of numeric_limits.
+
+// Non-arithmetic standard types, such as complex<T> (26.3.2), shall not
+// have specializations.
+
+// From [numeric.limits]:
+
+// The value of each member of a specialization of numeric_limits on a cv
+// -qualified type cv T shall be equal to the value of the corresponding
+// member of the specialization on the unqualified type T.
+
+// More convenient to test it here.
+
+#include <limits>
+#include <complex>
+
+template <class T>
+void test()
+{
+    static_assert(std::numeric_limits<T>::is_specialized,
+                 "std::numeric_limits<T>::is_specialized");
+    static_assert(std::numeric_limits<const T>::is_specialized,
+                 "std::numeric_limits<const T>::is_specialized");
+    static_assert(std::numeric_limits<volatile T>::is_specialized,
+                 "std::numeric_limits<volatile T>::is_specialized");
+    static_assert(std::numeric_limits<const volatile T>::is_specialized,
+                 "std::numeric_limits<const volatile T>::is_specialized");
+}
+
+int main()
+{
+    test<bool>();
+    test<char>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<signed char>();
+    test<unsigned char>();
+    test<signed short>();
+    test<unsigned short>();
+    test<signed int>();
+    test<unsigned int>();
+    test<signed long>();
+    test<unsigned long>();
+    test<signed long long>();
+    test<unsigned long long>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>();
+    test<__uint128_t>();
+#endif
+    test<float>();
+    test<double>();
+    test<long double>();
+    static_assert(!std::numeric_limits<std::complex<double> >::is_specialized,
+                 "!std::numeric_limits<std::complex<double> >::is_specialized");
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,199 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <limits>
+
+/*
+<limits>:
+    numeric_limits
+        is_specialized
+        digits
+        digits10
+        max_digits10
+        is_signed
+        is_integer
+        is_exact
+        radix
+        min_exponent
+        min_exponent10
+        max_exponent
+        max_exponent10
+        has_infinity
+        has_quiet_NaN
+        has_signaling_NaN
+        has_denorm
+        has_denorm_loss
+        is_iec559
+        is_bounded
+        is_modulo
+        traps
+        tinyness_before
+        round_style
+*/
+
+template <class _Tp>
+void test(const _Tp &) {}
+
+#define TEST_NUMERIC_LIMITS(type) \
+  test(std::numeric_limits<type>::is_specialized); \
+  test(std::numeric_limits<type>::digits); \
+  test(std::numeric_limits<type>::digits10); \
+  test(std::numeric_limits<type>::max_digits10); \
+  test(std::numeric_limits<type>::is_signed); \
+  test(std::numeric_limits<type>::is_integer); \
+  test(std::numeric_limits<type>::is_exact); \
+  test(std::numeric_limits<type>::radix); \
+  test(std::numeric_limits<type>::min_exponent); \
+  test(std::numeric_limits<type>::min_exponent10); \
+  test(std::numeric_limits<type>::max_exponent); \
+  test(std::numeric_limits<type>::max_exponent10); \
+  test(std::numeric_limits<type>::has_infinity); \
+  test(std::numeric_limits<type>::has_quiet_NaN); \
+  test(std::numeric_limits<type>::has_signaling_NaN); \
+  test(std::numeric_limits<type>::has_denorm); \
+  test(std::numeric_limits<type>::has_denorm_loss); \
+  test(std::numeric_limits<type>::is_iec559); \
+  test(std::numeric_limits<type>::is_bounded); \
+  test(std::numeric_limits<type>::is_modulo); \
+  test(std::numeric_limits<type>::traps); \
+  test(std::numeric_limits<type>::tinyness_before); \
+  test(std::numeric_limits<type>::round_style);
+
+struct other {};
+
+int main()
+{
+    // bool
+    TEST_NUMERIC_LIMITS(bool)
+    TEST_NUMERIC_LIMITS(const bool)
+    TEST_NUMERIC_LIMITS(volatile bool)
+    TEST_NUMERIC_LIMITS(const volatile bool)
+
+    // char
+    TEST_NUMERIC_LIMITS(char)
+    TEST_NUMERIC_LIMITS(const char)
+    TEST_NUMERIC_LIMITS(volatile char)
+    TEST_NUMERIC_LIMITS(const volatile char)
+
+    // signed char
+    TEST_NUMERIC_LIMITS(signed char)
+    TEST_NUMERIC_LIMITS(const signed char)
+    TEST_NUMERIC_LIMITS(volatile signed char)
+    TEST_NUMERIC_LIMITS(const volatile signed char)
+
+    // unsigned char
+    TEST_NUMERIC_LIMITS(unsigned char)
+    TEST_NUMERIC_LIMITS(const unsigned char)
+    TEST_NUMERIC_LIMITS(volatile unsigned char)
+    TEST_NUMERIC_LIMITS(const volatile unsigned char)
+
+    // wchar_t
+    TEST_NUMERIC_LIMITS(wchar_t)
+    TEST_NUMERIC_LIMITS(const wchar_t)
+    TEST_NUMERIC_LIMITS(volatile wchar_t)
+    TEST_NUMERIC_LIMITS(const volatile wchar_t)
+
+    // char16_t
+    TEST_NUMERIC_LIMITS(char16_t)
+    TEST_NUMERIC_LIMITS(const char16_t)
+    TEST_NUMERIC_LIMITS(volatile char16_t)
+    TEST_NUMERIC_LIMITS(const volatile char16_t)
+
+    // char32_t
+    TEST_NUMERIC_LIMITS(char32_t)
+    TEST_NUMERIC_LIMITS(const char32_t)
+    TEST_NUMERIC_LIMITS(volatile char32_t)
+    TEST_NUMERIC_LIMITS(const volatile char32_t)
+
+    // short
+    TEST_NUMERIC_LIMITS(short)
+    TEST_NUMERIC_LIMITS(const short)
+    TEST_NUMERIC_LIMITS(volatile short)
+    TEST_NUMERIC_LIMITS(const volatile short)
+
+    // int
+    TEST_NUMERIC_LIMITS(int)
+    TEST_NUMERIC_LIMITS(const int)
+    TEST_NUMERIC_LIMITS(volatile int)
+    TEST_NUMERIC_LIMITS(const volatile int)
+
+    // long
+    TEST_NUMERIC_LIMITS(long)
+    TEST_NUMERIC_LIMITS(const long)
+    TEST_NUMERIC_LIMITS(volatile long)
+    TEST_NUMERIC_LIMITS(const volatile long)
+
+#ifndef _LIBCPP_HAS_NO_INT128
+    TEST_NUMERIC_LIMITS(__int128_t)
+    TEST_NUMERIC_LIMITS(const __int128_t)
+    TEST_NUMERIC_LIMITS(volatile __int128_t)
+    TEST_NUMERIC_LIMITS(const volatile __int128_t)
+#endif
+
+    // long long
+    TEST_NUMERIC_LIMITS(long long)
+    TEST_NUMERIC_LIMITS(const long long)
+    TEST_NUMERIC_LIMITS(volatile long long)
+    TEST_NUMERIC_LIMITS(const volatile long long)
+
+    // unsigned short
+    TEST_NUMERIC_LIMITS(unsigned short)
+    TEST_NUMERIC_LIMITS(const unsigned short)
+    TEST_NUMERIC_LIMITS(volatile unsigned short)
+    TEST_NUMERIC_LIMITS(const volatile unsigned short)
+
+    // unsigned int
+    TEST_NUMERIC_LIMITS(unsigned int)
+    TEST_NUMERIC_LIMITS(const unsigned int)
+    TEST_NUMERIC_LIMITS(volatile unsigned int)
+    TEST_NUMERIC_LIMITS(const volatile unsigned int)
+
+    // unsigned long
+    TEST_NUMERIC_LIMITS(unsigned long)
+    TEST_NUMERIC_LIMITS(const unsigned long)
+    TEST_NUMERIC_LIMITS(volatile unsigned long)
+    TEST_NUMERIC_LIMITS(const volatile unsigned long)
+
+    // unsigned long long
+    TEST_NUMERIC_LIMITS(unsigned long long)
+    TEST_NUMERIC_LIMITS(const unsigned long long)
+    TEST_NUMERIC_LIMITS(volatile unsigned long long)
+    TEST_NUMERIC_LIMITS(const volatile unsigned long long)
+
+#ifndef _LIBCPP_HAS_NO_INT128
+    TEST_NUMERIC_LIMITS(__uint128_t)
+    TEST_NUMERIC_LIMITS(const __uint128_t)
+    TEST_NUMERIC_LIMITS(volatile __uint128_t)
+    TEST_NUMERIC_LIMITS(const volatile __uint128_t)
+#endif
+
+    // float
+    TEST_NUMERIC_LIMITS(float)
+    TEST_NUMERIC_LIMITS(const float)
+    TEST_NUMERIC_LIMITS(volatile float)
+    TEST_NUMERIC_LIMITS(const volatile float)
+    
+    // double
+    TEST_NUMERIC_LIMITS(double)
+    TEST_NUMERIC_LIMITS(const double)
+    TEST_NUMERIC_LIMITS(volatile double)
+    TEST_NUMERIC_LIMITS(const volatile double)
+    
+    // long double
+    TEST_NUMERIC_LIMITS(long double)
+    TEST_NUMERIC_LIMITS(const long double)
+    TEST_NUMERIC_LIMITS(volatile long double)
+    TEST_NUMERIC_LIMITS(const volatile long double)
+
+    // other
+    TEST_NUMERIC_LIMITS(other)
+    TEST_NUMERIC_LIMITS(const other)
+    TEST_NUMERIC_LIMITS(volatile other)
+    TEST_NUMERIC_LIMITS(const volatile other)
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// denorm_min()
+
+#include <limits>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::denorm_min() == expected);
+    assert(std::numeric_limits<const T>::denorm_min() == expected);
+    assert(std::numeric_limits<volatile T>::denorm_min() == expected);
+    assert(std::numeric_limits<const volatile T>::denorm_min() == expected);
+}
+
+int main()
+{
+    test<bool>(false);
+    test<char>(0);
+    test<signed char>(0);
+    test<unsigned char>(0);
+    test<wchar_t>(0);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(0);
+    test<unsigned short>(0);
+    test<int>(0);
+    test<unsigned int>(0);
+    test<long>(0);
+    test<unsigned long>(0);
+    test<long long>(0);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(0);
+    test<__uint128_t>(0);
+#endif
+    test<float>(__FLT_DENORM_MIN__);
+    test<double>(__DBL_DENORM_MIN__);
+    test<long double>(__LDBL_DENORM_MIN__);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// digits
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::digits == expected, "digits test 1");
+    static_assert(std::numeric_limits<const T>::digits == expected, "digits test 2");
+    static_assert(std::numeric_limits<volatile T>::digits == expected, "digits test 3");
+    static_assert(std::numeric_limits<const volatile T>::digits == expected, "digits test 4");
+}
+
+int main()
+{
+    test<bool, 1>();
+    test<char, std::numeric_limits<char>::is_signed ? 7 : 8>();
+    test<signed char, 7>();
+    test<unsigned char, 8>();
+    test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? sizeof(wchar_t)*8-1 : sizeof(wchar_t)*8>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 16>();
+    test<char32_t, 32>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 15>();
+    test<unsigned short, 16>();
+    test<int, 31>();
+    test<unsigned int, 32>();
+    test<long, sizeof(long) == 4 ? 31 : 63>();
+    test<unsigned long, sizeof(long) == 4 ? 32 : 64>();
+    test<long long, 63>();
+    test<unsigned long long, 64>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 127>();
+    test<__uint128_t, 128>();
+#endif
+    test<float, FLT_MANT_DIG>();
+    test<double, DBL_MANT_DIG>();
+    test<long double, LDBL_MANT_DIG>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// digits10
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::digits10 == expected, "digits10 test 1");
+    static_assert(std::numeric_limits<T>::is_bounded, "digits10 test 5");
+    static_assert(std::numeric_limits<const T>::digits10 == expected, "digits10 test 2");
+    static_assert(std::numeric_limits<const T>::is_bounded, "digits10 test 6");
+    static_assert(std::numeric_limits<volatile T>::digits10 == expected, "digits10 test 3");
+    static_assert(std::numeric_limits<volatile T>::is_bounded, "digits10 test 7");
+    static_assert(std::numeric_limits<const volatile T>::digits10 == expected, "digits10 test 4");
+    static_assert(std::numeric_limits<const volatile T>::is_bounded, "digits10 test 8");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 2>();
+    test<signed char, 2>();
+    test<unsigned char, 2>();
+    test<wchar_t, 5*sizeof(wchar_t)/2-1>();  // 4 -> 9 and 2 -> 4
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 4>();
+    test<char32_t, 9>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 4>();
+    test<unsigned short, 4>();
+    test<int, 9>();
+    test<unsigned int, 9>();
+    test<long, sizeof(long) == 4 ? 9 : 18>();
+    test<unsigned long, sizeof(long) == 4 ? 9 : 19>();
+    test<long long, 18>();
+    test<unsigned long long, 19>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 38>();
+    test<__uint128_t, 38>();
+#endif
+    test<float, FLT_DIG>();
+    test<double, DBL_DIG>();
+    test<long double, LDBL_DIG>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// epsilon()
+
+#include <limits>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::epsilon() == expected);
+    assert(std::numeric_limits<const T>::epsilon() == expected);
+    assert(std::numeric_limits<volatile T>::epsilon() == expected);
+    assert(std::numeric_limits<const volatile T>::epsilon() == expected);
+}
+
+int main()
+{
+    test<bool>(false);
+    test<char>(0);
+    test<signed char>(0);
+    test<unsigned char>(0);
+    test<wchar_t>(0);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(0);
+    test<unsigned short>(0);
+    test<int>(0);
+    test<unsigned int>(0);
+    test<long>(0);
+    test<unsigned long>(0);
+    test<long long>(0);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(0);
+    test<__uint128_t>(0);
+#endif
+    test<float>(FLT_EPSILON);
+    test<double>(DBL_EPSILON);
+    test<long double>(LDBL_EPSILON);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// has_denorm
+
+#include <limits>
+
+template <class T, std::float_denorm_style expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::has_denorm == expected, "has_denorm test 1");
+    static_assert(std::numeric_limits<const T>::has_denorm == expected, "has_denorm test 2");
+    static_assert(std::numeric_limits<volatile T>::has_denorm == expected, "has_denorm test 3");
+    static_assert(std::numeric_limits<const volatile T>::has_denorm == expected, "has_denorm test 4");
+}
+
+int main()
+{
+    test<bool, std::denorm_absent>();
+    test<char, std::denorm_absent>();
+    test<signed char, std::denorm_absent>();
+    test<unsigned char, std::denorm_absent>();
+    test<wchar_t, std::denorm_absent>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, std::denorm_absent>();
+    test<char32_t, std::denorm_absent>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, std::denorm_absent>();
+    test<unsigned short, std::denorm_absent>();
+    test<int, std::denorm_absent>();
+    test<unsigned int, std::denorm_absent>();
+    test<long, std::denorm_absent>();
+    test<unsigned long, std::denorm_absent>();
+    test<long long, std::denorm_absent>();
+    test<unsigned long long, std::denorm_absent>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, std::denorm_absent>();
+    test<__uint128_t, std::denorm_absent>();
+#endif
+    test<float, std::denorm_present>();
+    test<double, std::denorm_present>();
+    test<long double, std::denorm_present>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// has_denorm_loss
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::has_denorm_loss == expected, "has_denorm_loss test 1");
+    static_assert(std::numeric_limits<const T>::has_denorm_loss == expected, "has_denorm_loss test 2");
+    static_assert(std::numeric_limits<volatile T>::has_denorm_loss == expected, "has_denorm_loss test 3");
+    static_assert(std::numeric_limits<const volatile T>::has_denorm_loss == expected, "has_denorm_loss test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// has_infinity
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::has_infinity == expected, "has_infinity test 1");
+    static_assert(std::numeric_limits<const T>::has_infinity == expected, "has_infinity test 2");
+    static_assert(std::numeric_limits<volatile T>::has_infinity == expected, "has_infinity test 3");
+    static_assert(std::numeric_limits<const volatile T>::has_infinity == expected, "has_infinity test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// has_quiet_NaN
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::has_quiet_NaN == expected, "has_quiet_NaN test 1");
+    static_assert(std::numeric_limits<const T>::has_quiet_NaN == expected, "has_quiet_NaN test 2");
+    static_assert(std::numeric_limits<volatile T>::has_quiet_NaN == expected, "has_quiet_NaN test 3");
+    static_assert(std::numeric_limits<const volatile T>::has_quiet_NaN == expected, "has_quiet_NaN test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// has_signaling_NaN
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::has_signaling_NaN == expected, "has_signaling_NaN test 1");
+    static_assert(std::numeric_limits<const T>::has_signaling_NaN == expected, "has_signaling_NaN test 2");
+    static_assert(std::numeric_limits<volatile T>::has_signaling_NaN == expected, "has_signaling_NaN test 3");
+    static_assert(std::numeric_limits<const volatile T>::has_signaling_NaN == expected, "has_signaling_NaN test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// infinity()
+
+#include <limits>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::infinity() == expected);
+    assert(std::numeric_limits<const T>::infinity() == expected);
+    assert(std::numeric_limits<volatile T>::infinity() == expected);
+    assert(std::numeric_limits<const volatile T>::infinity() == expected);
+}
+
+extern float zero;
+
+int main()
+{
+    test<bool>(false);
+    test<char>(0);
+    test<signed char>(0);
+    test<unsigned char>(0);
+    test<wchar_t>(0);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(0);
+    test<unsigned short>(0);
+    test<int>(0);
+    test<unsigned int>(0);
+    test<long>(0);
+    test<unsigned long>(0);
+    test<long long>(0);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(0);
+    test<__uint128_t>(0);
+#endif
+    test<float>(1./zero);
+    test<double>(1./zero);
+    test<long double>(1./zero);
+}
+
+float zero = 0;

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_bounded
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_bounded == expected, "is_bounded test 1");
+    static_assert(std::numeric_limits<const T>::is_bounded == expected, "is_bounded test 2");
+    static_assert(std::numeric_limits<volatile T>::is_bounded == expected, "is_bounded test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_bounded == expected, "is_bounded test 4");
+}
+
+int main()
+{
+    test<bool, true>();
+    test<char, true>();
+    test<signed char, true>();
+    test<unsigned char, true>();
+    test<wchar_t, true>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, true>();
+    test<char32_t, true>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, true>();
+    test<unsigned short, true>();
+    test<int, true>();
+    test<unsigned int, true>();
+    test<long, true>();
+    test<unsigned long, true>();
+    test<long long, true>();
+    test<unsigned long long, true>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, true>();
+    test<__uint128_t, true>();
+#endif
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_exact
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_exact == expected, "is_exact test 1");
+    static_assert(std::numeric_limits<const T>::is_exact == expected, "is_exact test 2");
+    static_assert(std::numeric_limits<volatile T>::is_exact == expected, "is_exact test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_exact == expected, "is_exact test 4");
+}
+
+int main()
+{
+    test<bool, true>();
+    test<char, true>();
+    test<signed char, true>();
+    test<unsigned char, true>();
+    test<wchar_t, true>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, true>();
+    test<char32_t, true>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, true>();
+    test<unsigned short, true>();
+    test<int, true>();
+    test<unsigned int, true>();
+    test<long, true>();
+    test<unsigned long, true>();
+    test<long long, true>();
+    test<unsigned long long, true>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, true>();
+    test<__uint128_t, true>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_iec559
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_iec559 == expected, "is_iec559 test 1");
+    static_assert(std::numeric_limits<const T>::is_iec559 == expected, "is_iec559 test 2");
+    static_assert(std::numeric_limits<volatile T>::is_iec559 == expected, "is_iec559 test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_iec559 == expected, "is_iec559 test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, true>();
+    test<double, true>();
+#if (defined(__ppc__) || defined(__ppc64__))
+    test<long double, false>();
+#else
+    test<long double, true>();
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_integer
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_integer == expected, "is_integer test 1");
+    static_assert(std::numeric_limits<const T>::is_integer == expected, "is_integer test 2");
+    static_assert(std::numeric_limits<volatile T>::is_integer == expected, "is_integer test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_integer == expected, "is_integer test 4");
+}
+
+int main()
+{
+    test<bool, true>();
+    test<char, true>();
+    test<signed char, true>();
+    test<unsigned char, true>();
+    test<wchar_t, true>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, true>();
+    test<char32_t, true>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, true>();
+    test<unsigned short, true>();
+    test<int, true>();
+    test<unsigned int, true>();
+    test<long, true>();
+    test<unsigned long, true>();
+    test<long long, true>();
+    test<unsigned long long, true>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, true>();
+    test<__uint128_t, true>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_modulo
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_modulo == expected, "is_modulo test 1");
+    static_assert(std::numeric_limits<const T>::is_modulo == expected, "is_modulo test 2");
+    static_assert(std::numeric_limits<volatile T>::is_modulo == expected, "is_modulo test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_modulo == expected, "is_modulo test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+//    test<char, false>(); // don't know
+    test<signed char, false>();
+    test<unsigned char, true>();
+//    test<wchar_t, false>(); // don't know
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, true>();
+    test<char32_t, true>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, true>();
+    test<int, false>();
+    test<unsigned int, true>();
+    test<long, false>();
+    test<unsigned long, true>();
+    test<long long, false>();
+    test<unsigned long long, true>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, true>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// is_signed
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::is_signed == expected, "is_signed test 1");
+    static_assert(std::numeric_limits<const T>::is_signed == expected, "is_signed test 2");
+    static_assert(std::numeric_limits<volatile T>::is_signed == expected, "is_signed test 3");
+    static_assert(std::numeric_limits<const volatile T>::is_signed == expected, "is_signed test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, char(-1) < char(0)>();
+    test<signed char, true>();
+    test<unsigned char, false>();
+    test<wchar_t, wchar_t(-1) < wchar_t(0)>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, true>();
+    test<unsigned short, false>();
+    test<int, true>();
+    test<unsigned int, false>();
+    test<long, true>();
+    test<unsigned long, false>();
+    test<long long, true>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, true>();
+    test<__uint128_t, false>();
+#endif
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// lowest()
+
+#include <limits>
+#include <climits>
+#include <cwchar>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::lowest() == expected);
+    assert(std::numeric_limits<T>::is_bounded);
+    assert(std::numeric_limits<const T>::lowest() == expected);
+    assert(std::numeric_limits<const T>::is_bounded);
+    assert(std::numeric_limits<volatile T>::lowest() == expected);
+    assert(std::numeric_limits<volatile T>::is_bounded);
+    assert(std::numeric_limits<const volatile T>::lowest() == expected);
+    assert(std::numeric_limits<const volatile T>::is_bounded);
+}
+
+int main()
+{
+    test<bool>(false);
+    test<char>(CHAR_MIN);
+    test<signed char>(SCHAR_MIN);
+    test<unsigned char>(0);
+    test<wchar_t>(WCHAR_MIN);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(SHRT_MIN);
+    test<unsigned short>(0);
+    test<int>(INT_MIN);
+    test<unsigned int>(0);
+    test<long>(LONG_MIN);
+    test<unsigned long>(0);
+    test<long long>(LLONG_MIN);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
+    test<__uint128_t>(0);
+#endif
+    test<float>(-FLT_MAX);
+    test<double>(-DBL_MAX);
+    test<long double>(-LDBL_MAX);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// max()
+
+#include <limits>
+#include <climits>
+#include <cwchar>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::max() == expected);
+    assert(std::numeric_limits<T>::is_bounded);
+    assert(std::numeric_limits<const T>::max() == expected);
+    assert(std::numeric_limits<const T>::is_bounded);
+    assert(std::numeric_limits<volatile T>::max() == expected);
+    assert(std::numeric_limits<volatile T>::is_bounded);
+    assert(std::numeric_limits<const volatile T>::max() == expected);
+    assert(std::numeric_limits<const volatile T>::is_bounded);
+}
+
+int main()
+{
+    test<bool>(true);
+    test<char>(CHAR_MAX);
+    test<signed char>(SCHAR_MAX);
+    test<unsigned char>(UCHAR_MAX);
+    test<wchar_t>(WCHAR_MAX);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(USHRT_MAX);
+    test<char32_t>(UINT_MAX);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(SHRT_MAX);
+    test<unsigned short>(USHRT_MAX);
+    test<int>(INT_MAX);
+    test<unsigned int>(UINT_MAX);
+    test<long>(LONG_MAX);
+    test<unsigned long>(ULONG_MAX);
+    test<long long>(LLONG_MAX);
+    test<unsigned long long>(ULLONG_MAX);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(__int128_t(__uint128_t(-1)/2));
+    test<__uint128_t>(__uint128_t(-1));
+#endif
+    test<float>(FLT_MAX);
+    test<double>(DBL_MAX);
+    test<long double>(LDBL_MAX);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// max_digits10
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::max_digits10 == expected, "max_digits10 test 1");
+    static_assert(std::numeric_limits<const T>::max_digits10 == expected, "max_digits10 test 2");
+    static_assert(std::numeric_limits<volatile T>::max_digits10 == expected, "max_digits10 test 3");
+    static_assert(std::numeric_limits<const volatile T>::max_digits10 == expected, "max_digits10 test 4");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 0>();
+    test<signed char, 0>();
+    test<unsigned char, 0>();
+    test<wchar_t, 0>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 0>();
+    test<char32_t, 0>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 0>();
+    test<unsigned short, 0>();
+    test<int, 0>();
+    test<unsigned int, 0>();
+    test<long, 0>();
+    test<unsigned long, 0>();
+    test<long long, 0>();
+    test<unsigned long long, 0>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 0>();
+    test<__uint128_t, 0>();
+#endif
+    test<float, 2+(FLT_MANT_DIG * 30103)/100000>();
+    test<double, 2+(DBL_MANT_DIG * 30103)/100000>();
+    test<long double, 2+(LDBL_MANT_DIG * 30103)/100000>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// max_exponent
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::max_exponent == expected, "max_exponent test 1");
+    static_assert(std::numeric_limits<const T>::max_exponent == expected, "max_exponent test 2");
+    static_assert(std::numeric_limits<volatile T>::max_exponent == expected, "max_exponent test 3");
+    static_assert(std::numeric_limits<const volatile T>::max_exponent == expected, "max_exponent test 4");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 0>();
+    test<signed char, 0>();
+    test<unsigned char, 0>();
+    test<wchar_t, 0>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 0>();
+    test<char32_t, 0>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 0>();
+    test<unsigned short, 0>();
+    test<int, 0>();
+    test<unsigned int, 0>();
+    test<long, 0>();
+    test<unsigned long, 0>();
+    test<long long, 0>();
+    test<unsigned long long, 0>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 0>();
+    test<__uint128_t, 0>();
+#endif
+    test<float, FLT_MAX_EXP>();
+    test<double, DBL_MAX_EXP>();
+    test<long double, LDBL_MAX_EXP>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// max_exponent10
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::max_exponent10 == expected, "max_exponent10 test 1");
+    static_assert(std::numeric_limits<const T>::max_exponent10 == expected, "max_exponent10 test 2");
+    static_assert(std::numeric_limits<volatile T>::max_exponent10 == expected, "max_exponent10 test 3");
+    static_assert(std::numeric_limits<const volatile T>::max_exponent10 == expected, "max_exponent10 test 4");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 0>();
+    test<signed char, 0>();
+    test<unsigned char, 0>();
+    test<wchar_t, 0>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 0>();
+    test<char32_t, 0>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 0>();
+    test<unsigned short, 0>();
+    test<int, 0>();
+    test<unsigned int, 0>();
+    test<long, 0>();
+    test<unsigned long, 0>();
+    test<long long, 0>();
+    test<unsigned long long, 0>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 0>();
+    test<__uint128_t, 0>();
+#endif
+    test<float, FLT_MAX_10_EXP>();
+    test<double, DBL_MAX_10_EXP>();
+    test<long double, LDBL_MAX_10_EXP>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// min()
+
+#include <limits>
+#include <climits>
+#include <cwchar>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::min() == expected);
+    assert(std::numeric_limits<T>::is_bounded || !std::numeric_limits<T>::is_signed);
+    assert(std::numeric_limits<const T>::min() == expected);
+    assert(std::numeric_limits<const T>::is_bounded || !std::numeric_limits<const T>::is_signed);
+    assert(std::numeric_limits<volatile T>::min() == expected);
+    assert(std::numeric_limits<volatile T>::is_bounded || !std::numeric_limits<volatile T>::is_signed);
+    assert(std::numeric_limits<const volatile T>::min() == expected);
+    assert(std::numeric_limits<const volatile T>::is_bounded || !std::numeric_limits<const volatile T>::is_signed);
+}
+
+int main()
+{
+    test<bool>(false);
+    test<char>(CHAR_MIN);
+    test<signed char>(SCHAR_MIN);
+    test<unsigned char>(0);
+    test<wchar_t>(WCHAR_MIN);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(SHRT_MIN);
+    test<unsigned short>(0);
+    test<int>(INT_MIN);
+    test<unsigned int>(0);
+    test<long>(LONG_MIN);
+    test<unsigned long>(0);
+    test<long long>(LLONG_MIN);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(-__int128_t(__uint128_t(-1)/2) - 1);
+    test<__uint128_t>(0);
+#endif
+    test<float>(FLT_MIN);
+    test<double>(DBL_MIN);
+    test<long double>(LDBL_MIN);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// min_exponent
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::min_exponent == expected, "min_exponent test 1");
+    static_assert(std::numeric_limits<const T>::min_exponent == expected, "min_exponent test 2");
+    static_assert(std::numeric_limits<volatile T>::min_exponent == expected, "min_exponent test 3");
+    static_assert(std::numeric_limits<const volatile T>::min_exponent == expected, "min_exponent test 4");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 0>();
+    test<signed char, 0>();
+    test<unsigned char, 0>();
+    test<wchar_t, 0>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 0>();
+    test<char32_t, 0>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 0>();
+    test<unsigned short, 0>();
+    test<int, 0>();
+    test<unsigned int, 0>();
+    test<long, 0>();
+    test<unsigned long, 0>();
+    test<long long, 0>();
+    test<unsigned long long, 0>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 0>();
+    test<__uint128_t, 0>();
+#endif
+    test<float, FLT_MIN_EXP>();
+    test<double, DBL_MIN_EXP>();
+    test<long double, LDBL_MIN_EXP>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// min_exponent10
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::min_exponent10 == expected, "min_exponent10 test 1");
+    static_assert(std::numeric_limits<const T>::min_exponent10 == expected, "min_exponent10 test 2");
+    static_assert(std::numeric_limits<volatile T>::min_exponent10 == expected, "min_exponent10 test 3");
+    static_assert(std::numeric_limits<const volatile T>::min_exponent10 == expected, "min_exponent10 test 4");
+}
+
+int main()
+{
+    test<bool, 0>();
+    test<char, 0>();
+    test<signed char, 0>();
+    test<unsigned char, 0>();
+    test<wchar_t, 0>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 0>();
+    test<char32_t, 0>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 0>();
+    test<unsigned short, 0>();
+    test<int, 0>();
+    test<unsigned int, 0>();
+    test<long, 0>();
+    test<unsigned long, 0>();
+    test<long long, 0>();
+    test<unsigned long long, 0>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 0>();
+    test<__uint128_t, 0>();
+#endif
+    test<float, FLT_MIN_10_EXP>();
+    test<double, DBL_MIN_10_EXP>();
+    test<long double, LDBL_MIN_10_EXP>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// quiet_NaN()
+
+#include <limits>
+#include <cmath>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test_imp(std::true_type)
+{
+    assert(std::isnan(std::numeric_limits<T>::quiet_NaN()));
+    assert(std::isnan(std::numeric_limits<const T>::quiet_NaN()));
+    assert(std::isnan(std::numeric_limits<volatile T>::quiet_NaN()));
+    assert(std::isnan(std::numeric_limits<const volatile T>::quiet_NaN()));
+}
+
+template <class T>
+void
+test_imp(std::false_type)
+{
+    assert(std::numeric_limits<T>::quiet_NaN() == T());
+    assert(std::numeric_limits<const T>::quiet_NaN() == T());
+    assert(std::numeric_limits<volatile T>::quiet_NaN() == T());
+    assert(std::numeric_limits<const volatile T>::quiet_NaN() == T());
+}
+
+template <class T>
+inline
+void
+test()
+{
+    test_imp<T>(std::is_floating_point<T>());
+}
+
+int main()
+{
+    test<bool>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>();
+    test<__uint128_t>();
+#endif
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// radix
+
+#include <limits>
+#include <cfloat>
+
+template <class T, int expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::radix == expected, "radix test 1");
+    static_assert(std::numeric_limits<const T>::radix == expected, "radix test 2");
+    static_assert(std::numeric_limits<volatile T>::radix == expected, "radix test 3");
+    static_assert(std::numeric_limits<const volatile T>::radix == expected, "radix test 4");
+}
+
+int main()
+{
+    test<bool, 2>();
+    test<char, 2>();
+    test<signed char, 2>();
+    test<unsigned char, 2>();
+    test<wchar_t, 2>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, 2>();
+    test<char32_t, 2>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, 2>();
+    test<unsigned short, 2>();
+    test<int, 2>();
+    test<unsigned int, 2>();
+    test<long, 2>();
+    test<unsigned long, 2>();
+    test<long long, 2>();
+    test<unsigned long long, 2>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, 2>();
+    test<__uint128_t, 2>();
+#endif
+    test<float, FLT_RADIX>();
+    test<double, FLT_RADIX>();
+    test<long double, FLT_RADIX>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// round_error()
+
+#include <limits>
+#include <cfloat>
+#include <cassert>
+
+template <class T>
+void
+test(T expected)
+{
+    assert(std::numeric_limits<T>::round_error() == expected);
+    assert(std::numeric_limits<const T>::round_error() == expected);
+    assert(std::numeric_limits<volatile T>::round_error() == expected);
+    assert(std::numeric_limits<const volatile T>::round_error() == expected);
+}
+
+int main()
+{
+    test<bool>(false);
+    test<char>(0);
+    test<signed char>(0);
+    test<unsigned char>(0);
+    test<wchar_t>(0);
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>(0);
+    test<char32_t>(0);
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>(0);
+    test<unsigned short>(0);
+    test<int>(0);
+    test<unsigned int>(0);
+    test<long>(0);
+    test<unsigned long>(0);
+    test<long long>(0);
+    test<unsigned long long>(0);
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>(0);
+    test<__uint128_t>(0);
+#endif
+    test<float>(0.5);
+    test<double>(0.5);
+    test<long double>(0.5);
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// round_style
+
+#include <limits>
+
+template <class T, std::float_round_style expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::round_style == expected, "round_style test 1");
+    static_assert(std::numeric_limits<const T>::round_style == expected, "round_style test 2");
+    static_assert(std::numeric_limits<volatile T>::round_style == expected, "round_style test 3");
+    static_assert(std::numeric_limits<const volatile T>::round_style == expected, "round_style test 4");
+}
+
+int main()
+{
+    test<bool, std::round_toward_zero>();
+    test<char, std::round_toward_zero>();
+    test<signed char, std::round_toward_zero>();
+    test<unsigned char, std::round_toward_zero>();
+    test<wchar_t, std::round_toward_zero>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, std::round_toward_zero>();
+    test<char32_t, std::round_toward_zero>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, std::round_toward_zero>();
+    test<unsigned short, std::round_toward_zero>();
+    test<int, std::round_toward_zero>();
+    test<unsigned int, std::round_toward_zero>();
+    test<long, std::round_toward_zero>();
+    test<unsigned long, std::round_toward_zero>();
+    test<long long, std::round_toward_zero>();
+    test<unsigned long long, std::round_toward_zero>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, std::round_toward_zero>();
+    test<__uint128_t, std::round_toward_zero>();
+#endif
+    test<float, std::round_to_nearest>();
+    test<double, std::round_to_nearest>();
+    test<long double, std::round_to_nearest>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// signaling_NaN()
+
+#include <limits>
+#include <cmath>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test_imp(std::true_type)
+{
+    assert(std::isnan(std::numeric_limits<T>::signaling_NaN()));
+    assert(std::isnan(std::numeric_limits<const T>::signaling_NaN()));
+    assert(std::isnan(std::numeric_limits<volatile T>::signaling_NaN()));
+    assert(std::isnan(std::numeric_limits<const volatile T>::signaling_NaN()));
+}
+
+template <class T>
+void
+test_imp(std::false_type)
+{
+    assert(std::numeric_limits<T>::signaling_NaN() == T());
+    assert(std::numeric_limits<const T>::signaling_NaN() == T());
+    assert(std::numeric_limits<volatile T>::signaling_NaN() == T());
+    assert(std::numeric_limits<const volatile T>::signaling_NaN() == T());
+}
+
+template <class T>
+inline
+void
+test()
+{
+    test_imp<T>(std::is_floating_point<T>());
+}
+
+int main()
+{
+    test<bool>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t>();
+    test<__uint128_t>();
+#endif
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// tinyness_before
+
+#include <limits>
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::tinyness_before == expected, "tinyness_before test 1");
+    static_assert(std::numeric_limits<const T>::tinyness_before == expected, "tinyness_before test 2");
+    static_assert(std::numeric_limits<volatile T>::tinyness_before == expected, "tinyness_before test 3");
+    static_assert(std::numeric_limits<const volatile T>::tinyness_before == expected, "tinyness_before test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, false>();
+    test<signed char, false>();
+    test<unsigned char, false>();
+    test<wchar_t, false>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, false>();
+    test<char32_t, false>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, false>();
+    test<unsigned short, false>();
+    test<int, false>();
+    test<unsigned int, false>();
+    test<long, false>();
+    test<unsigned long, false>();
+    test<long long, false>();
+    test<unsigned long long, false>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, false>();
+    test<__uint128_t, false>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// traps
+
+#include <limits>
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__)
+static const bool integral_types_trap = true;
+#else
+static const bool integral_types_trap = false;
+#endif
+
+template <class T, bool expected>
+void
+test()
+{
+    static_assert(std::numeric_limits<T>::traps == expected, "traps test 1");
+    static_assert(std::numeric_limits<const T>::traps == expected, "traps test 2");
+    static_assert(std::numeric_limits<volatile T>::traps == expected, "traps test 3");
+    static_assert(std::numeric_limits<const volatile T>::traps == expected, "traps test 4");
+}
+
+int main()
+{
+    test<bool, false>();
+    test<char, integral_types_trap>();
+    test<signed char, integral_types_trap>();
+    test<unsigned char, integral_types_trap>();
+    test<wchar_t, integral_types_trap>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t, integral_types_trap>();
+    test<char32_t, integral_types_trap>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<short, integral_types_trap>();
+    test<unsigned short, integral_types_trap>();
+    test<int, integral_types_trap>();
+    test<unsigned int, integral_types_trap>();
+    test<long, integral_types_trap>();
+    test<unsigned long, integral_types_trap>();
+    test<long long, integral_types_trap>();
+    test<unsigned long long, integral_types_trap>();
+#ifndef _LIBCPP_HAS_NO_INT128
+    test<__int128_t, integral_types_trap>();
+    test<__uint128_t, integral_types_trap>();
+#endif
+    test<float, false>();
+    test<double, false>();
+    test<long double, false>();
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits/default.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// The default numeric_limits<T> template shall have all members, but with
+// 0 or false values.
+
+#include <limits>
+#include <cassert>
+
+struct A
+{
+    A(int i = 0) : data_(i) {}
+    int data_;
+};
+
+bool operator == (const A& x, const A& y) {return x.data_ == y.data_;}
+
+int main()
+{
+    static_assert(std::numeric_limits<A>::is_specialized == false,
+                 "std::numeric_limits<A>::is_specialized == false");
+    assert(std::numeric_limits<A>::min() == A());
+    assert(std::numeric_limits<A>::max() == A());
+    assert(std::numeric_limits<A>::lowest() == A());
+    static_assert(std::numeric_limits<A>::digits == 0,
+                 "std::numeric_limits<A>::digits == 0");
+    static_assert(std::numeric_limits<A>::digits10 == 0,
+                 "std::numeric_limits<A>::digits10 == 0");
+    static_assert(std::numeric_limits<A>::max_digits10 == 0,
+                 "std::numeric_limits<A>::max_digits10 == 0");
+    static_assert(std::numeric_limits<A>::is_signed == false,
+                 "std::numeric_limits<A>::is_signed == false");
+    static_assert(std::numeric_limits<A>::is_integer == false,
+                 "std::numeric_limits<A>::is_integer == false");
+    static_assert(std::numeric_limits<A>::is_exact == false,
+                 "std::numeric_limits<A>::is_exact == false");
+    static_assert(std::numeric_limits<A>::radix == 0,
+                 "std::numeric_limits<A>::radix == 0");
+    assert(std::numeric_limits<A>::epsilon() == A());
+    assert(std::numeric_limits<A>::round_error() == A());
+    static_assert(std::numeric_limits<A>::min_exponent == 0,
+                 "std::numeric_limits<A>::min_exponent == 0");
+    static_assert(std::numeric_limits<A>::min_exponent10 == 0,
+                 "std::numeric_limits<A>::min_exponent10 == 0");
+    static_assert(std::numeric_limits<A>::max_exponent == 0,
+                 "std::numeric_limits<A>::max_exponent == 0");
+    static_assert(std::numeric_limits<A>::max_exponent10 == 0,
+                 "std::numeric_limits<A>::max_exponent10 == 0");
+    static_assert(std::numeric_limits<A>::has_infinity == false,
+                 "std::numeric_limits<A>::has_infinity == false");
+    static_assert(std::numeric_limits<A>::has_quiet_NaN == false,
+                 "std::numeric_limits<A>::has_quiet_NaN == false");
+    static_assert(std::numeric_limits<A>::has_signaling_NaN == false,
+                 "std::numeric_limits<A>::has_signaling_NaN == false");
+    static_assert(std::numeric_limits<A>::has_denorm == std::denorm_absent,
+                 "std::numeric_limits<A>::has_denorm == std::denorm_absent");
+    static_assert(std::numeric_limits<A>::has_denorm_loss == false,
+                 "std::numeric_limits<A>::has_denorm_loss == false");
+    assert(std::numeric_limits<A>::infinity() == A());
+    assert(std::numeric_limits<A>::quiet_NaN() == A());
+    assert(std::numeric_limits<A>::signaling_NaN() == A());
+    assert(std::numeric_limits<A>::denorm_min() == A());
+    static_assert(std::numeric_limits<A>::is_iec559 == false,
+                 "std::numeric_limits<A>::is_iec559 == false");
+    static_assert(std::numeric_limits<A>::is_bounded == false,
+                 "std::numeric_limits<A>::is_bounded == false");
+    static_assert(std::numeric_limits<A>::is_modulo == false,
+                 "std::numeric_limits<A>::is_modulo == false");
+    static_assert(std::numeric_limits<A>::traps == false,
+                 "std::numeric_limits<A>::traps == false");
+    static_assert(std::numeric_limits<A>::tinyness_before == false,
+                 "std::numeric_limits<A>::tinyness_before == false");
+    static_assert(std::numeric_limits<A>::round_style == std::round_toward_zero,
+                 "std::numeric_limits<A>::round_style == std::round_toward_zero");
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.special/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.special/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.special/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.special/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/round.style/check_values.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/round.style/check_values.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/round.style/check_values.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/round.style/check_values.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test numeric_limits
+
+// float_denorm_style
+
+#include <limits>
+
+typedef char one;
+struct two {one _[2];};
+
+one test(std::float_denorm_style);
+two test(int);
+
+int main()
+{
+    static_assert(std::denorm_indeterminate == -1,
+                 "std::denorm_indeterminate == -1");
+    static_assert(std::denorm_absent == 0,
+                 "std::denorm_absent == 0");
+    static_assert(std::denorm_present == 1,
+                 "std::denorm_present == 1");
+    static_assert(sizeof(test(std::denorm_present)) == 1,
+                 "sizeof(test(std::denorm_present)) == 1");
+    static_assert(sizeof(test(1)) == 2,
+                 "sizeof(test(1)) == 2");
+}

Added: libcxx/trunk/test/std/language.support/support.limits/limits/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <limits>
+
+#include <limits>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.limits/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.limits/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_cast
+
+#include <typeinfo>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_base_of<std::exception, std::bad_cast>::value),
+                 "std::is_base_of<std::exception, std::bad_cast>::value");
+    static_assert(std::is_polymorphic<std::bad_cast>::value,
+                 "std::is_polymorphic<std::bad_cast>::value");
+    std::bad_cast b;
+    std::bad_cast b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test bad_typeid
+
+#include <typeinfo>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_base_of<std::exception, std::bad_typeid>::value),
+                 "std::is_base_of<std::exception, std::bad_typeid>::value");
+    static_assert(std::is_polymorphic<std::bad_typeid>::value,
+                 "std::is_polymorphic<std::bad_typeid>::value");
+    std::bad_typeid b;
+    std::bad_typeid b2 = b;
+    b2 = b;
+    const char* w = b2.what();
+    assert(w);
+}

Added: libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test type_info
+
+#include <typeinfo>
+#include <cstring>
+#include <cassert>
+
+int main()
+{
+    const std::type_info& t1 = typeid(int);
+    const std::type_info& t2 = typeid(int);
+    assert(t1 == t2);
+    const std::type_info& t3 = typeid(short);
+    assert(t1 != t3);
+    assert(!t1.before(t2));
+    assert(strcmp(t1.name(), t2.name()) == 0);
+    assert(strcmp(t1.name(), t3.name()) != 0);
+}

Added: libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info_hash.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info_hash.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info_hash.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.rtti/type.info/type_info_hash.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test type_info
+
+#include <typeinfo>
+#include <cstring>
+#include <cassert>
+
+int main()
+{
+    const std::type_info& t1 = typeid(int);
+    const std::type_info& t2 = typeid(int);
+    const std::type_info& t3 = typeid(short);
+    assert(t1.hash_code() == t2.hash_code());
+    assert(t1.hash_code() != t3.hash_code());
+}

Added: libcxx/trunk/test/std/language.support/support.rtti/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.rtti/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.rtti/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.rtti/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <typeinfo>
+
+#include <typeinfo>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/csetjmp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/csetjmp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/csetjmp.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/csetjmp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <csetjmp>
+
+#include <csetjmp>
+#include <type_traits>
+
+#ifndef setjmp
+#error setjmp not defined
+#endif
+
+int main()
+{
+    std::jmp_buf jb;
+    static_assert((std::is_same<decltype(std::longjmp(jb, 0)), void>::value),
+                  "std::is_same<decltype(std::longjmp(jb, 0)), void>::value");
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/csignal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/csignal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/csignal.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/csignal.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <csignal>
+
+#include <csignal>
+#include <type_traits>
+
+#ifndef SIG_DFL
+#error SIG_DFL not defined
+#endif
+
+#ifndef SIG_ERR
+#error SIG_ERR not defined
+#endif
+
+#ifndef SIG_IGN
+#error SIG_IGN not defined
+#endif
+
+#ifndef SIGABRT
+#error SIGABRT not defined
+#endif
+
+#ifndef SIGFPE
+#error SIGFPE not defined
+#endif
+
+#ifndef SIGILL
+#error SIGILL not defined
+#endif
+
+#ifndef SIGINT
+#error SIGINT not defined
+#endif
+
+#ifndef SIGSEGV
+#error SIGSEGV not defined
+#endif
+
+#ifndef SIGTERM
+#error SIGTERM not defined
+#endif
+
+int main()
+{
+    std::sig_atomic_t sig;
+    typedef void (*func)(int);
+    static_assert((std::is_same<decltype(std::signal(0, (func)0)), func>::value), "");
+    static_assert((std::is_same<decltype(std::raise(0)), int>::value), "");
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/cstdarg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/cstdarg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/cstdarg.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/cstdarg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdarg>
+
+#include <cstdarg>
+
+#ifndef va_arg
+#error va_arg not defined
+#endif
+
+#if __cplusplus >= 201103L
+#  ifndef va_copy
+#    error va_copy is not defined when c++ >= 11
+#  endif
+#endif
+
+#ifndef va_end
+#error va_end not defined
+#endif
+
+#ifndef va_start
+#error va_start not defined
+#endif
+
+int main()
+{
+    std::va_list va;
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/cstdbool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/cstdbool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/cstdbool.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/cstdbool.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdbool>
+
+#include <cstdbool>
+
+#ifndef __bool_true_false_are_defined
+#error __bool_true_false_are_defined not defined
+#endif
+
+#ifdef bool
+#error bool should not be defined
+#endif
+
+#ifdef true
+#error true should not be defined
+#endif
+
+#ifdef false
+#error false should not be defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdlib>
+
+#include <cstdlib>
+#include <type_traits>
+
+#ifndef EXIT_FAILURE
+#error EXIT_FAILURE not defined
+#endif
+
+#ifndef EXIT_SUCCESS
+#error EXIT_SUCCESS not defined
+#endif
+
+#ifndef MB_CUR_MAX
+#error MB_CUR_MAX not defined
+#endif
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef RAND_MAX
+#error RAND_MAX not defined
+#endif
+
+int main()
+{
+    std::size_t s = 0;
+    std::div_t d;
+    std::ldiv_t ld;
+    std::lldiv_t lld;
+    char** endptr = 0;
+    static_assert((std::is_same<decltype(std::atof("")), double>::value), "");
+    static_assert((std::is_same<decltype(std::atoi("")), int>::value), "");
+    static_assert((std::is_same<decltype(std::atol("")), long>::value), "");
+    static_assert((std::is_same<decltype(std::atoll("")), long long>::value), "");
+    static_assert((std::is_same<decltype(std::getenv("")), char*>::value), "");
+    static_assert((std::is_same<decltype(std::strtod("", endptr)), double>::value), "");
+    static_assert((std::is_same<decltype(std::strtof("", endptr)), float>::value), "");
+    static_assert((std::is_same<decltype(std::strtold("", endptr)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::strtol("", endptr,0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::strtoll("", endptr,0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::strtoul("", endptr,0)), unsigned long>::value), "");
+    static_assert((std::is_same<decltype(std::strtoull("", endptr,0)), unsigned long long>::value), "");
+    static_assert((std::is_same<decltype(std::rand()), int>::value), "");
+    static_assert((std::is_same<decltype(std::srand(0)), void>::value), "");
+    static_assert((std::is_same<decltype(std::calloc(0,0)), void*>::value), "");
+    static_assert((std::is_same<decltype(std::free(0)), void>::value), "");
+    static_assert((std::is_same<decltype(std::malloc(0)), void*>::value), "");
+    static_assert((std::is_same<decltype(std::realloc(0,0)), void*>::value), "");
+    static_assert((std::is_same<decltype(std::abort()), void>::value), "");
+    static_assert((std::is_same<decltype(std::atexit(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::exit(0)), void>::value), "");
+    static_assert((std::is_same<decltype(std::_Exit(0)), void>::value), "");
+    static_assert((std::is_same<decltype(std::getenv("")), char*>::value), "");
+    static_assert((std::is_same<decltype(std::system("")), int>::value), "");
+    static_assert((std::is_same<decltype(std::bsearch(0,0,0,0,0)), void*>::value), "");
+    static_assert((std::is_same<decltype(std::qsort(0,0,0,0)), void>::value), "");
+    static_assert((std::is_same<decltype(std::abs(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::abs((long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::abs((long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::labs((long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::llabs((long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::div(0,0)), std::div_t>::value), "");
+    static_assert((std::is_same<decltype(std::div(0L,0L)), std::ldiv_t>::value), "");
+    static_assert((std::is_same<decltype(std::div(0LL,0LL)), std::lldiv_t>::value), "");
+    static_assert((std::is_same<decltype(std::ldiv(0L,0L)), std::ldiv_t>::value), "");
+    static_assert((std::is_same<decltype(std::lldiv(0LL,0LL)), std::lldiv_t>::value), "");
+    static_assert((std::is_same<decltype(std::mblen("",0)), int>::value), "");
+    wchar_t* pw = 0;
+    const wchar_t* pwc = 0;
+    char* pc = 0;
+    static_assert((std::is_same<decltype(std::mbtowc(pw,"",0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::wctomb(pc,L' ')), int>::value), "");
+    static_assert((std::is_same<decltype(std::mbstowcs(pw,"",0)), std::size_t>::value), "");
+    static_assert((std::is_same<decltype(std::wcstombs(pc,pwc,0)), std::size_t>::value), "");
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/ctime.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <ctime>
+
+#include <ctime>
+#include <type_traits>
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef CLOCKS_PER_SEC
+#error CLOCKS_PER_SEC not defined
+#endif
+
+int main()
+{
+    std::clock_t c = 0;
+    std::size_t s = 0;
+    std::time_t t = 0;
+    std::tm tm = {0};
+    static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
+    static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
+    static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
+    static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
+    static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
+    static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
+    char* c1 = 0;
+    const char* c2 = 0;
+    static_assert((std::is_same<decltype(std::strftime(c1,s,c2,&tm)), std::size_t>::value), "");
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_csetjmp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_csetjmp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_csetjmp.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_csetjmp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <csetjmp>
+
+#include <csetjmp>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_csignal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_csignal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_csignal.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_csignal.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <csignal>
+
+#include <csignal>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_cstdarg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_cstdarg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_cstdarg.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_cstdarg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdarg>
+
+#include <cstdarg>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_cstdbool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_cstdbool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_cstdbool.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_cstdbool.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdbool>
+
+#include <cstdbool>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_cstdlib.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_cstdlib.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_cstdlib.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_cstdlib.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdlib>
+
+#include <cstdlib>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.runtime/version_ctime.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/version_ctime.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.runtime/version_ctime.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.runtime/version_ctime.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ctime>
+
+#include <ctime>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.start.term/quick_exit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// test quick_exit and at_quick_exit
+
+#include <cstdlib>
+
+void f() {}
+
+int main()
+{
+#ifdef _LIBCPP_HAS_QUICK_EXIT
+    std::at_quick_exit(f);
+    std::quick_exit(0);
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
+// results in a compile error.
+
+#include <cstdlib>
+
+void f() {}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_QUICK_EXIT
+    std::at_quick_exit(f);
+#else
+#error
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+
+// test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
+// results in a compile error.
+
+#include <cstdlib>
+
+void f() {}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_QUICK_EXIT
+    std::quick_exit(0);
+#else
+#error
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.types/max_align_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/max_align_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/max_align_t.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/max_align_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <type_traits>
+
+// max_align_t is a POD type whose alignment requirement is at least as
+//   great as that of every scalar type
+
+#include <stdio.h>
+
+int main()
+{
+    static_assert(std::is_pod<std::max_align_t>::value,
+                  "std::is_pod<std::max_align_t>::value");
+    static_assert((std::alignment_of<std::max_align_t>::value >=
+                  std::alignment_of<long long>::value),
+                  "std::alignment_of<std::max_align_t>::value >= "
+                  "std::alignment_of<long long>::value");
+    static_assert(std::alignment_of<std::max_align_t>::value >=
+                  std::alignment_of<long double>::value,
+                  "std::alignment_of<std::max_align_t>::value >= "
+                  "std::alignment_of<long double>::value");
+    static_assert(std::alignment_of<std::max_align_t>::value >=
+                  std::alignment_of<void*>::value,
+                  "std::alignment_of<std::max_align_t>::value >= "
+                  "std::alignment_of<void*>::value");
+}

Added: libcxx/trunk/test/std/language.support/support.types/null.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/null.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/null.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/null.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/nullptr_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <type_traits>
+#include <cassert>
+
+// typedef decltype(nullptr) nullptr_t;
+
+struct A
+{
+    A(std::nullptr_t) {}
+};
+
+template <class T>
+void test_conversions()
+{
+    {
+        T p = 0;
+        assert(p == nullptr);
+    }
+    {
+        T p = nullptr;
+        assert(p == nullptr);
+        assert(nullptr == p);
+        assert(!(p != nullptr));
+        assert(!(nullptr != p));
+    }
+}
+
+template <class T>
+void test_comparisons()
+{
+    T p = nullptr;
+    assert(p == nullptr);
+    assert(p <= nullptr);
+    assert(p >= nullptr);
+    assert(!(p != nullptr));
+    assert(!(p < nullptr));
+    assert(!(p > nullptr));
+    assert(nullptr == p);
+    assert(nullptr <= p);
+    assert(nullptr >= p);
+    assert(!(nullptr != p));
+    assert(!(nullptr < p));
+    assert(!(nullptr > p));
+}
+
+
+int main()
+{
+    static_assert(sizeof(std::nullptr_t) == sizeof(void*),
+                  "sizeof(std::nullptr_t) == sizeof(void*)");
+
+    {
+        test_conversions<std::nullptr_t>();
+        test_conversions<void*>();
+        test_conversions<A*>();
+        test_conversions<void(*)()>();
+        test_conversions<void(A::*)()>();
+        test_conversions<int A::*>();
+    }
+    {
+        test_comparisons<std::nullptr_t>();
+        test_comparisons<void*>();
+        test_comparisons<A*>();
+        test_comparisons<void(*)()>();
+    }
+    {
+        bool b = nullptr;
+        assert(!b);
+    }
+}

Added: libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.fail.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// typedef decltype(nullptr) nullptr_t;
+
+#include <cstddef>
+
+int main()
+{
+    std::ptrdiff_t i = static_cast<std::ptrdiff_t>(nullptr);
+}

Added: libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/nullptr_t_integral_cast.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: nullptr_t emulation cannot handle a reinterpret_cast to an
+// integral type
+// XFAIL: c++98, c++03
+
+// typedef decltype(nullptr) nullptr_t;
+
+
+#include <cstddef>
+#include <cassert>
+
+int main()
+{
+    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
+    assert(i == 0);
+}

Added: libcxx/trunk/test/std/language.support/support.types/offsetof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/offsetof.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/offsetof.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/offsetof.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+
+#ifndef offsetof
+#error offsetof not defined
+#endif
+
+struct A
+{
+    int x;
+};
+
+int main()
+{
+#if (__has_feature(cxx_noexcept))
+    static_assert(noexcept(offsetof(A, x)), "");
+#endif
+}

Added: libcxx/trunk/test/std/language.support/support.types/ptrdiff_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/ptrdiff_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/ptrdiff_t.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/ptrdiff_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <type_traits>
+
+// ptrdiff_t should:
+
+//  1. be in namespace std.
+//  2. be the same sizeof as void*.
+//  3. be a signed integral.
+
+int main()
+{
+    static_assert(sizeof(std::ptrdiff_t) == sizeof(void*),
+                  "sizeof(std::ptrdiff_t) == sizeof(void*)");
+    static_assert(std::is_signed<std::ptrdiff_t>::value,
+                  "std::is_signed<std::ptrdiff_t>::value");
+    static_assert(std::is_integral<std::ptrdiff_t>::value,
+                  "std::is_integral<std::ptrdiff_t>::value");
+}

Added: libcxx/trunk/test/std/language.support/support.types/size_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/size_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/size_t.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/size_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <type_traits>
+
+// size_t should:
+
+//  1. be in namespace std.
+//  2. be the same sizeof as void*.
+//  3. be an unsigned integral.
+
+int main()
+{
+    static_assert(sizeof(std::size_t) == sizeof(void*),
+                  "sizeof(std::size_t) == sizeof(void*)");
+    static_assert(std::is_unsigned<std::size_t>::value,
+                  "std::is_unsigned<std::size_t>::value");
+    static_assert(std::is_integral<std::size_t>::value,
+                  "std::is_integral<std::size_t>::value");
+}

Added: libcxx/trunk/test/std/language.support/support.types/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/language.support/support.types/version.pass.cpp (added)
+++ libcxx/trunk/test/std/language.support/support.types/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstddef>
+
+#include <cstddef>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/c.locales/clocale.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/c.locales/clocale.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/c.locales/clocale.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/c.locales/clocale.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <clocale>
+
+#include <clocale>
+#include <type_traits>
+
+#ifndef LC_ALL
+#error LC_ALL not defined
+#endif
+
+#ifndef LC_COLLATE
+#error LC_COLLATE not defined
+#endif
+
+#ifndef LC_CTYPE
+#error LC_CTYPE not defined
+#endif
+
+#ifndef LC_MONETARY
+#error LC_MONETARY not defined
+#endif
+
+#ifndef LC_NUMERIC
+#error LC_NUMERIC not defined
+#endif
+
+#ifndef LC_TIME
+#error LC_TIME not defined
+#endif
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+int main()
+{
+    std::lconv lc;
+    static_assert((std::is_same<decltype(std::setlocale(0, "")), char*>::value), "");
+    static_assert((std::is_same<decltype(std::localeconv()), std::lconv*>::value), "");
+}

Added: libcxx/trunk/test/std/localization/c.locales/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/c.locales/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/c.locales/version.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/c.locales/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <clocale>
+
+#include <clocale>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/__scan_keyword.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/__scan_keyword.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/__scan_keyword.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/__scan_keyword.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// Not a portable test
+
+// __scan_keyword
+// Scans [__b, __e) until a match is found in the basic_strings range
+//  [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke).
+//  __b will be incremented (visibly), consuming CharT until a match is found
+//  or proved to not exist.  A keyword may be "", in which will match anything.
+//  If one keyword is a prefix of another, and the next CharT in the input
+//  might match another keyword, the algorithm will attempt to find the longest
+//  matching keyword.  If the longer matching keyword ends up not matching, then
+//  no keyword match is found.  If no keyword match is found, __ke is returned.
+//  Else an iterator pointing to the matching keyword is found.  If more than
+//  one keyword matches, an iterator to the first matching keyword is returned.
+//  If on exit __b == __e, eofbit is set in __err.  If __case_sensitive is false,
+//  __ct is used to force to lower case before comparing characters.
+//  Examples:
+//  Keywords:  "a", "abb"
+//  If the input is "a", the first keyword matches and eofbit is set.
+//  If the input is "abc", no match is found and "ab" are consumed.
+//
+// template <class _InputIterator, class _ForwardIterator, class _Ctype>
+// _ForwardIterator
+// __scan_keyword(_InputIterator& __b, _InputIterator __e,
+//                _ForwardIterator __kb, _ForwardIterator __ke,
+//                const _Ctype& __ct, ios_base::iostate& __err,
+//                bool __case_sensitive = true);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic());
+    std::ios_base::iostate err = std::ios_base::goodbit;
+    {
+        const char input[] = "a";
+        const char* in = input;
+        std::string keys[] = {"a", "abb"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err);
+        assert(k - keys == 0);
+        assert(in == input+1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char input[] = "abc";
+        const char* in = input;
+        std::string keys[] = {"a", "abb"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err);
+        assert(k - keys == 2);
+        assert(in == input+2);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const char input[] = "abb";
+        const char* in = input;
+        std::string keys[] = {"a", "abb"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err);
+        assert(k - keys == 1);
+        assert(in == input+3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char input[] = "Tue ";
+        const char* in = input;
+        std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err);
+        assert(k - keys == 2);
+        assert(in == input+3);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const char input[] = "tue ";
+        const char* in = input;
+        std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err);
+        assert(k - keys == 4);
+        assert(in == input+0);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const char input[] = "tue ";
+        const char* in = input;
+        std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+        err = std::ios_base::goodbit;
+        std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+                                             keys, keys+sizeof(keys)/sizeof(keys[0]),
+                                             ct, err, false);
+        assert(k - keys == 2);
+        assert(in == input+3);
+        assert(err == std::ios_base::goodbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate_byname
+
+// int compare(const charT* low1, const charT* high1,
+//             const charT* low2, const charT* high2) const;
+
+//  I'm currently unable to confirm that collation based on named locales
+//     has any difference from "C" collation.  But I do believe I'm picking
+//     up the OS's collation files.
+
+// TODO investigation needed.
+// Glibc seems to collate files differently from the way Apple's C library does
+// it.
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            std::string s2("aaaaaaA");
+            std::string s3("BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+        {
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            std::wstring s2(L"aaaaaaA");
+            std::wstring s3(L"BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+    }
+    {
+        std::locale l("");
+        {
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            std::string s2("aaaaaaA");
+            std::string s3("BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+        {
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            std::wstring s2(L"aaaaaaA");
+            std::wstring s3(L"BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            std::string s2("aaaaaaA");
+            std::string s3("BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+        {
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            std::wstring s2(L"aaaaaaA");
+            std::wstring s3(L"BaaaaaA");
+            assert(f.compare(s2.data(), s2.data() + s2.size(),
+                             s3.data(), s3.data() + s3.size()) == 1);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate_byname
+
+// long hash(const charT* low, const charT* high) const;
+
+//   This test is not portable
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    std::locale l(LOCALE_en_US_UTF_8);
+    {
+        std::string x1("1234");
+        std::string x2("12345");
+        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+        assert(f.hash(x1.data(), x1.data() + x1.size())
+            != f.hash(x2.data(), x2.data() + x2.size()));
+    }
+    {
+        std::wstring x1(L"1234");
+        std::wstring x2(L"12345");
+        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+        assert(f.hash(x1.data(), x1.data() + x1.size())
+            != f.hash(x2.data(), x2.data() + x2.size()));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp Fri Dec 19 19:40:03 2014
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate_byname
+
+// string_type transform(const charT* low, const charT* high) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    // Ensure that the default locale is not C.  If it is, the second tests will fail.
+    putenv(const_cast<char*>("LANG=" LOCALE_en_US_UTF_8));
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            std::string x("1234");
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) != x);
+        }
+        {
+            std::wstring x(L"1234");
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) != x);
+        }
+    }
+    {
+        std::locale l("");
+        {
+            std::string x("1234");
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) != x);
+        }
+        {
+            std::wstring x(L"1234");
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) != x);
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            std::string x("1234");
+            const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) == x);
+        }
+        {
+            std::wstring x(L"1234");
+            const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+            assert(f.transform(x.data(), x.data() + x.size()) == x);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT>
+// class collate_byname
+//     : public collate<charT>
+// {
+// public:
+//     typedef basic_string<charT> string_type;
+//     explicit collate_byname(const char*, size_t refs = 0);
+//     explicit collate_byname(const string&, size_t refs = 0);
+// protected:
+//     ~collate_byname();
+// };
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    std::locale l(LOCALE_en_US_UTF_8);
+    {
+        assert(std::has_facet<std::collate_byname<char> >(l));
+        assert(&std::use_facet<std::collate<char> >(l)
+            == &std::use_facet<std::collate_byname<char> >(l));
+    }
+    {
+        assert(std::has_facet<std::collate_byname<wchar_t> >(l));
+        assert(&std::use_facet<std::collate<wchar_t> >(l)
+            == &std::use_facet<std::collate_byname<wchar_t> >(l));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate;
+
+// explicit collate(size_t refs = 0);
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+template <class C>
+class my_facet
+    : public std::collate<C>
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : std::collate<C>(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+template <class C> int my_facet<C>::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet<char>);
+        assert(my_facet<char>::count == 1);
+    }
+    assert(my_facet<char>::count == 0);
+    {
+        my_facet<char> f(1);
+        assert(my_facet<char>::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet<char>::count == 1);
+        }
+        assert(my_facet<char>::count == 1);
+    }
+    assert(my_facet<char>::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet<wchar_t>);
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+    {
+        my_facet<wchar_t> f(1);
+        assert(my_facet<wchar_t>::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet<wchar_t>::count == 1);
+        }
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/compare.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate;
+
+// int compare(const charT* low1, const charT* high1,
+//             const charT* low2, const charT* high2) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        const char ia[] = "1234";
+        const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+        const char ib[] = "123";
+        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+        assert(f.compare(ia, ia+sa, ib, ib+2) == 1);
+        assert(f.compare(ib, ib+2, ia, ia+sa) == -1);
+        assert(f.compare(ia, ia+sa, ib, ib+3) == 1);
+        assert(f.compare(ib, ib+3, ia, ia+sa) == -1);
+        assert(f.compare(ia, ia+sa, ib+1, ib+3) == -1);
+        assert(f.compare(ib+1, ib+3, ia, ia+sa) == 1);
+        assert(f.compare(ia, ia+3, ib, ib+3) == 0);
+    }
+    {
+        const wchar_t ia[] = L"1234";
+        const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+        const wchar_t ib[] = L"123";
+        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+        assert(f.compare(ia, ia+sa, ib, ib+2) == 1);
+        assert(f.compare(ib, ib+2, ia, ia+sa) == -1);
+        assert(f.compare(ia, ia+sa, ib, ib+3) == 1);
+        assert(f.compare(ib, ib+3, ia, ia+sa) == -1);
+        assert(f.compare(ia, ia+sa, ib+1, ib+3) == -1);
+        assert(f.compare(ib+1, ib+3, ia, ia+sa) == 1);
+        assert(f.compare(ia, ia+3, ib, ib+3) == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/hash.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/hash.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/hash.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/hash.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate;
+
+// long hash(const charT* low, const charT* high) const;
+
+//   This test is not portable
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        std::string x1("1234");
+        std::string x2("12345");
+        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+        assert(f.hash(x1.data(), x1.data() + x1.size())
+            != f.hash(x2.data(), x2.data() + x2.size()));
+    }
+    {
+        std::wstring x1(L"1234");
+        std::wstring x2(L"12345");
+        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+        assert(f.hash(x1.data(), x1.data() + x1.size())
+            != f.hash(x2.data(), x2.data() + x2.size()));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/transform.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/transform.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/transform.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.members/transform.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class collate;
+
+// string_type transform(const charT* low, const charT* high) const;
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        std::string x("1234");
+        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+        assert(f.transform(x.data(), x.data() + x.size()) == x);
+    }
+    {
+        std::wstring x(L"1234");
+        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+        assert(f.transform(x.data(), x.data() + x.size()) == x);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/locale.collate.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT>
+// class collate
+//     : public locale::facet {
+// public:
+//     typedef charT char_type;
+//     typedef basic_string<charT>string_type;
+//
+//     static locale::id id;
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        assert(std::has_facet<std::collate<char> >(l));
+        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+        {
+            (void)std::collate<char>::id;
+        }
+        static_assert((std::is_same<std::collate<char>::char_type, char>::value), "");
+        static_assert((std::is_same<std::collate<char>::string_type, std::string>::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::collate<char> >::value), "");
+    }
+    {
+        assert(std::has_facet<std::collate<wchar_t> >(l));
+        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+        {
+            (void)std::collate<wchar_t>::id;
+        }
+        static_assert((std::is_same<std::collate<wchar_t>::char_type, wchar_t>::value), "");
+        static_assert((std::is_same<std::collate<wchar_t>::string_type, std::wstring>::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::collate<wchar_t> >::value), "");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.collate/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.collate/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// This test uses new symbols that were not defined in the libc++ shipped on
+// darwin11 and darwin12:
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+
+// <locale>
+
+// class ctype_base
+// {
+// public:
+//     typedef T mask;
+//
+//     // numeric values are for exposition only.
+//     static const mask space = 1 << 0;
+//     static const mask print = 1 << 1;
+//     static const mask cntrl = 1 << 2;
+//     static const mask upper = 1 << 3;
+//     static const mask lower = 1 << 4;
+//     static const mask alpha = 1 << 5;
+//     static const mask digit = 1 << 6;
+//     static const mask punct = 1 << 7;
+//     static const mask xdigit = 1 << 8;
+//     static const mask alnum = alpha | digit;
+//     static const mask graph = alnum | punct;
+// };
+
+#include <locale>
+#include <cassert>
+
+template <class _Tp>
+void test(const _Tp &) {}
+
+int main()
+{
+    assert(std::ctype_base::space);
+    assert(std::ctype_base::print);
+    assert(std::ctype_base::cntrl);
+    assert(std::ctype_base::upper);
+    assert(std::ctype_base::lower);
+    assert(std::ctype_base::alpha);
+    assert(std::ctype_base::digit);
+    assert(std::ctype_base::punct);
+    assert(std::ctype_base::xdigit);
+    assert(
+      ( std::ctype_base::space
+      & std::ctype_base::print
+      & std::ctype_base::cntrl
+      & std::ctype_base::upper
+      & std::ctype_base::lower
+      & std::ctype_base::alpha
+      & std::ctype_base::digit
+      & std::ctype_base::punct
+      & std::ctype_base::xdigit) == 0);
+    assert(std::ctype_base::alnum == (std::ctype_base::alpha | std::ctype_base::digit));
+    assert(std::ctype_base::graph == (std::ctype_base::alnum | std::ctype_base::punct));
+
+    test(std::ctype_base::space);
+    test(std::ctype_base::print);
+    test(std::ctype_base::cntrl);
+    test(std::ctype_base::upper);
+    test(std::ctype_base::lower);
+    test(std::ctype_base::alpha);
+    test(std::ctype_base::digit);
+    test(std::ctype_base::punct);
+    test(std::ctype_base::xdigit);
+    test(std::ctype_base::blank);
+    test(std::ctype_base::alnum);
+    test(std::ctype_base::graph);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>
+
+// ~ctype();
+
+// UNSUPPORTED: asan, msan
+
+#include <locale>
+#include <cassert>
+#include <new>
+
+unsigned delete_called = 0;
+
+void* operator new[](size_t sz) throw(std::bad_alloc)
+{
+    return operator new(sz);
+}
+
+void operator delete[](void* p) throw()
+{
+    operator delete(p);
+    ++delete_called;
+}
+
+int main()
+{
+    {
+        delete_called = 0;
+        std::locale l(std::locale::classic(), new std::ctype<char>);
+        assert(delete_called == 0);
+    }
+    assert(delete_called == 0);
+    {
+        std::ctype<char>::mask table[256];
+        delete_called = 0;
+        std::locale l(std::locale::classic(), new std::ctype<char>(table));
+        assert(delete_called == 0);
+    }
+    assert(delete_called == 0);
+    {
+        delete_called = 0;
+        std::locale l(std::locale::classic(),
+            new std::ctype<char>(new std::ctype<char>::mask[256], true));
+        assert(delete_called == 0);
+    }
+    assert(delete_called == 1);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// explicit ctype(const mask* tbl = 0, bool del = false, size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+class my_facet
+    : public std::ctype<char>
+{
+public:
+    static int count;
+
+    explicit my_facet(const mask* tbl = 0, bool del = false, std::size_t refs = 0)
+        : std::ctype<char>(tbl, del, refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(0, false, 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// bool is(mask m, char c) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.is(F::space, ' '));
+        assert(!f.is(F::space, 'A'));
+
+        assert(f.is(F::print, ' '));
+        assert(!f.is(F::print, '\x07'));
+
+        assert(f.is(F::cntrl, '\x07'));
+        assert(!f.is(F::cntrl, ' '));
+
+        assert(f.is(F::upper, 'A'));
+        assert(!f.is(F::upper, 'a'));
+
+        assert(f.is(F::lower, 'a'));
+        assert(!f.is(F::lower, 'A'));
+
+        assert(f.is(F::alpha, 'a'));
+        assert(!f.is(F::alpha, '1'));
+
+        assert(f.is(F::digit, '1'));
+        assert(!f.is(F::digit, 'a'));
+
+        assert(f.is(F::punct, '.'));
+        assert(!f.is(F::punct, 'a'));
+
+        assert(f.is(F::xdigit, 'a'));
+        assert(!f.is(F::xdigit, 'g'));
+
+        assert(f.is(F::alnum, 'a'));
+        assert(!f.is(F::alnum, '.'));
+
+        assert(f.is(F::graph, '.'));
+        assert(!f.is(F::graph,  '\x07'));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/is_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* is(const char* low, const char* high, mask* vec) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        const std::string in(" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        const char* h = f.is(in.data(), in.data() + in.size(), m.data());
+        assert(h == in.data() + in.size());
+
+        // ' '
+        assert( (m[0] & F::space));
+        assert( (m[0] & F::print));
+        assert(!(m[0] & F::cntrl));
+        assert(!(m[0] & F::upper));
+        assert(!(m[0] & F::lower));
+        assert(!(m[0] & F::alpha));
+        assert(!(m[0] & F::digit));
+        assert(!(m[0] & F::punct));
+        assert(!(m[0] & F::xdigit));
+        assert( (m[0] & F::blank));
+        assert(!(m[0] & F::alnum));
+        assert(!(m[0] & F::graph));
+
+        // 'A'
+        assert(!(m[1] & F::space));
+        assert( (m[1] & F::print));
+        assert(!(m[1] & F::cntrl));
+        assert( (m[1] & F::upper));
+        assert(!(m[1] & F::lower));
+        assert( (m[1] & F::alpha));
+        assert(!(m[1] & F::digit));
+        assert(!(m[1] & F::punct));
+        assert( (m[1] & F::xdigit));
+        assert(!(m[1] & F::blank));
+        assert( (m[1] & F::alnum));
+        assert( (m[1] & F::graph));
+
+        // '\x07'
+        assert(!(m[2] & F::space));
+        assert(!(m[2] & F::print));
+        assert( (m[2] & F::cntrl));
+        assert(!(m[2] & F::upper));
+        assert(!(m[2] & F::lower));
+        assert(!(m[2] & F::alpha));
+        assert(!(m[2] & F::digit));
+        assert(!(m[2] & F::punct));
+        assert(!(m[2] & F::xdigit));
+        assert(!(m[2] & F::blank));
+        assert(!(m[2] & F::alnum));
+        assert(!(m[2] & F::graph));
+
+        // '.'
+        assert(!(m[3] & F::space));
+        assert( (m[3] & F::print));
+        assert(!(m[3] & F::cntrl));
+        assert(!(m[3] & F::upper));
+        assert(!(m[3] & F::lower));
+        assert(!(m[3] & F::alpha));
+        assert(!(m[3] & F::digit));
+        assert( (m[3] & F::punct));
+        assert(!(m[3] & F::xdigit));
+        assert(!(m[3] & F::blank));
+        assert(!(m[3] & F::alnum));
+        assert( (m[3] & F::graph));
+
+        // 'a'
+        assert(!(m[4] & F::space));
+        assert( (m[4] & F::print));
+        assert(!(m[4] & F::cntrl));
+        assert(!(m[4] & F::upper));
+        assert( (m[4] & F::lower));
+        assert( (m[4] & F::alpha));
+        assert(!(m[4] & F::digit));
+        assert(!(m[4] & F::punct));
+        assert( (m[4] & F::xdigit));
+        assert(!(m[4] & F::blank));
+        assert( (m[4] & F::alnum));
+        assert( (m[4] & F::graph));
+
+        // '1'
+        assert(!(m[5] & F::space));
+        assert( (m[5] & F::print));
+        assert(!(m[5] & F::cntrl));
+        assert(!(m[5] & F::upper));
+        assert(!(m[5] & F::lower));
+        assert(!(m[5] & F::alpha));
+        assert( (m[5] & F::digit));
+        assert(!(m[5] & F::punct));
+        assert( (m[5] & F::xdigit));
+        assert(!(m[5] & F::blank));
+        assert( (m[5] & F::alnum));
+        assert( (m[5] & F::graph));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// char narrow(char c, char dfault) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.narrow(' ', '*') == ' ');
+        assert(f.narrow('A', '*') == 'A');
+        assert(f.narrow('\x07', '*') == '\x07');
+        assert(f.narrow('.', '*') == '.');
+        assert(f.narrow('a', '*') == 'a');
+        assert(f.narrow('1', '*') == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/narrow_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* narrow(const char* low, const char*, char dfault, char* to) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        std::string in(" A\x07.a1");
+        std::vector<char> v(in.size());
+
+        assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
+        assert(v[0] == ' ');
+        assert(v[1] == 'A');
+        assert(v[2] == '\x07');
+        assert(v[3] == '.');
+        assert(v[4] == 'a');
+        assert(v[5] == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_is.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_is.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_is.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_is.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* scan_is(mask m, const char* low, const char* high) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        const std::string in(" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        assert(f.scan_is(F::space, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::print, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 2);
+        assert(f.scan_is(F::upper, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::lower, in.data(), in.data() + in.size()) - in.data() == 4);
+        assert(f.scan_is(F::alpha, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::digit, in.data(), in.data() + in.size()) - in.data() == 5);
+        assert(f.scan_is(F::punct, in.data(), in.data() + in.size()) - in.data() == 3);
+        assert(f.scan_is(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::blank, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::alnum, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::graph, in.data(), in.data() + in.size()) - in.data() == 1);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_not.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_not.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/scan_not.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* scan_not(mask m, const char* low, const char* high) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        const std::string in(" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        assert(f.scan_not(F::space, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_not(F::print, in.data(), in.data() + in.size()) - in.data() == 2);
+        assert(f.scan_not(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::upper, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::lower, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::alpha, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::digit, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::punct, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::blank, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_not(F::alnum, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::graph, in.data(), in.data() + in.size()) - in.data() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/table.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/table.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/table.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/table.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>
+
+// const mask* table() const throw();
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    typedef std::ctype<char> F;
+    {
+        std::locale l(std::locale::classic(), new std::ctype<char>);
+        const F& f = std::use_facet<F>(l);
+        assert(f.table() == f.classic_table());
+    }
+    {
+        std::ctype<char>::mask table[256];
+        std::locale l(std::locale::classic(), new std::ctype<char>(table));
+        const F& f = std::use_facet<F>(l);
+        assert(f.table() == table);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// char tolower(char) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.tolower(' ') == ' ');
+        assert(f.tolower('A') == 'a');
+        assert(f.tolower('\x07') == '\x07');
+        assert(f.tolower('.') == '.');
+        assert(f.tolower('a') == 'a');
+        assert(f.tolower('1') == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/tolower_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* tolower(char* low, const char* high) const;
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        std::string in(" A\x07.a1");
+
+        assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+        assert(in[0] == ' ');
+        assert(in[1] == 'a');
+        assert(in[2] == '\x07');
+        assert(in[3] == '.');
+        assert(in[4] == 'a');
+        assert(in[5] == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// char toupper(char) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.toupper(' ') == ' ');
+        assert(f.toupper('A') == 'A');
+        assert(f.toupper('\x07') == '\x07');
+        assert(f.toupper('.') == '.');
+        assert(f.toupper('a') == 'A');
+        assert(f.toupper('1') == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/toupper_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* toupper(char* low, const char* high) const;
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        std::string in(" A\x07.a1");
+
+        assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+        assert(in[0] == ' ');
+        assert(in[1] == 'A');
+        assert(in[2] == '\x07');
+        assert(in[3] == '.');
+        assert(in[4] == 'A');
+        assert(in[5] == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// char widen(char c) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.widen(' ') == ' ');
+        assert(f.widen('A') == 'A');
+        assert(f.widen('\x07') == '\x07');
+        assert(f.widen('.') == '.');
+        assert(f.widen('a') == 'a');
+        assert(f.widen('1') == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.members/widen_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>;
+
+// const char* widen(const char* low, const char* high, char* to) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<char> F;
+        const F& f = std::use_facet<F>(l);
+        std::string in(" A\x07.a1");
+        std::vector<char> v(in.size());
+
+        assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
+        assert(v[0] == ' ');
+        assert(v[1] == 'A');
+        assert(v[2] == '\x07');
+        assert(v[3] == '.');
+        assert(v[4] == 'a');
+        assert(v[5] == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class ctype<char>
+
+// static const mask* classic_table() throw();
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    typedef std::ctype<char> F;
+    assert(F::classic_table() != 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <>
+// class ctype<char>
+//     : public locale::facet,
+//       public ctype_base
+// {
+// public:
+//     typedef char char_type;
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        assert(std::has_facet<std::ctype<char> >(l));
+        const std::ctype<char>& f = std::use_facet<std::ctype<char> >(l);
+        {
+            (void)std::ctype<char>::id;
+        }
+        static_assert((std::is_same<std::ctype<char>::char_type, char>::value), "");
+        static_assert((std::is_base_of<std::ctype_base, std::ctype<char> >::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::ctype<char> >::value), "");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt_byname<char, char, mbstate_t>
+
+// explicit codecvt_byname(const char* nm, size_t refs = 0);
+// explicit codecvt_byname(const string& nm, size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt_byname<char, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(const char* nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet("en_US"));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f("en_US", 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(std::string("en_US"), 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char16_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char16_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char16_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char16_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt_byname<char16_t, char, mbstate_t>
+
+// explicit codecvt_byname(const char* nm, size_t refs = 0);
+// explicit codecvt_byname(const string& nm, size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt_byname<char16_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(const char* nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet("en_US"));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f("en_US", 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(std::string("en_US"), 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char32_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char32_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char32_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char32_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt_byname<char32_t, char, mbstate_t>
+
+// explicit codecvt_byname(const char* nm, size_t refs = 0);
+// explicit codecvt_byname(const string& nm, size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt_byname<char32_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(const char* nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet("en_US"));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f("en_US", 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(std::string("en_US"), 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt_byname<wchar_t, char, mbstate_t>
+
+// explicit codecvt_byname(const char* nm, size_t refs = 0);
+// explicit codecvt_byname(const string& nm, size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(const char* nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet(LOCALE_en_US_UTF_8));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(LOCALE_en_US_UTF_8, 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet(std::string(LOCALE_en_US_UTF_8)));
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(std::string(LOCALE_en_US_UTF_8), 1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/codecvt_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/codecvt_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/codecvt_base.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/codecvt_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class codecvt_base
+// {
+// public:
+//     enum result {ok, partial, error, noconv};
+// };
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    assert(std::codecvt_base::ok == 0);
+    assert(std::codecvt_base::partial == 1);
+    assert(std::codecvt_base::error == 2);
+    assert(std::codecvt_base::noconv == 3);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// explicit codecvt(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char16_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char16_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char16_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char16_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// explicit codecvt(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+//#endif
+
+int main()
+{
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+//#endif
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char32_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char32_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char32_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_char32_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// explicit codecvt(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+//#endif
+
+int main()
+{
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+//#endif
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_wchar_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_wchar_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_wchar_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/ctor_wchar_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// explicit codecvt(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// bool always_noconv() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(!f.always_noconv());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// int encoding() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.encoding() == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// result in(stateT& state,
+//           const externT* from, const externT* from_end, const externT*& from_next,
+//           internT* to, internT* to_end, internT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const char from[] = "some text";
+    F::intern_type to[9];
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char* from_next = 0;
+    F::intern_type* to_next = 0;
+    assert(f.in(mbs, from, from + 9, from_next,
+                     to, to + 9, to_next) == F::ok);
+    assert(from_next - from == 9);
+    assert(to_next - to == 9);
+    for (unsigned i = 0; i < 9; ++i)
+        assert(to[i] == from[i]);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char from[] = "some text";
+    assert(f.length(mbs, from, from+10, 0) == 0);
+    assert(f.length(mbs, from, from+10, 8) == 8);
+    assert(f.length(mbs, from, from+10, 9) == 9);
+    assert(f.length(mbs, from, from+10, 10) == 10);
+    assert(f.length(mbs, from, from+10, 100) == 10);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// int max_length() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.max_length() == 4);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// result out(stateT& state,
+//            const internT* from, const internT* from_end, const internT*& from_next,
+//            externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    {
+        F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
+        char to[9] = {0};
+        std::mbstate_t mbs = {0};
+        const F::intern_type* from_next = 0;
+        char* to_next = 0;
+        F::result r = f.out(mbs, from, from + 9, from_next,
+                                 to, to + 9, to_next);
+        assert(r == F::ok);
+        assert(from_next - from == 9);
+        assert(to_next - to == 9);
+        for (unsigned i = 0; i < 9; ++i)
+            assert(to[i] == from[i]);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char16_t, char, mbstate_t>
+
+// result unshift(stateT& state,
+//                externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    std::vector<char> to(3);
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    char* to_next = 0;
+    assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// bool always_noconv() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(!f.always_noconv());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// int encoding() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.encoding() == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// result in(stateT& state,
+//           const externT* from, const externT* from_end, const externT*& from_next,
+//           internT* to, internT* to_end, internT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const char from[] = "some text";
+    F::intern_type to[9];
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char* from_next = 0;
+    F::intern_type* to_next = 0;
+    assert(f.in(mbs, from, from + 9, from_next,
+                     to, to + 9, to_next) == F::ok);
+    assert(from_next - from == 9);
+    assert(to_next - to == 9);
+    for (unsigned i = 0; i < 9; ++i)
+        assert(to[i] == from[i]);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char from[] = "some text";
+    assert(f.length(mbs, from, from+10, 0) == 0);
+    assert(f.length(mbs, from, from+10, 8) == 8);
+    assert(f.length(mbs, from, from+10, 9) == 9);
+    assert(f.length(mbs, from, from+10, 10) == 10);
+    assert(f.length(mbs, from, from+10, 100) == 10);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// int max_length() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.max_length() == 4);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// result out(stateT& state,
+//            const internT* from, const internT* from_end, const internT*& from_next,
+//            externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    {
+        F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
+        char to[9] = {0};
+        std::mbstate_t mbs = {0};
+        const F::intern_type* from_next = 0;
+        char* to_next = 0;
+        F::result r = f.out(mbs, from, from + 9, from_next,
+                                 to, to + 9, to_next);
+        assert(r == F::ok);
+        assert(from_next - from == 9);
+        assert(to_next - to == 9);
+        for (unsigned i = 0; i < 9; ++i)
+            assert(to[i] == from[i]);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+
+// result unshift(stateT& state,
+//                externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    std::vector<char> to(3);
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    char* to_next = 0;
+    assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// bool always_noconv() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.always_noconv());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// int encoding() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.encoding() == 1);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// result in(stateT& state,
+//           const externT* from, const externT* from_end, const externT*& from_next,
+//           internT* to, internT* to_end, internT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const std::basic_string<F::intern_type> from("some text");
+    std::vector<char> to(from.size());
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char* from_next = 0;
+    char* to_next = 0;
+    assert(f.in(mbs, from.data(), from.data() + from.size(), from_next,
+                     to.data(), to.data() + to.size(), to_next) == F::noconv);
+    assert(from_next == from.data());
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char from[10]= {0};
+    assert(f.length(mbs, from, from+10, 0) == 0);
+    assert(f.length(mbs, from, from+10, 9) == 9);
+    assert(f.length(mbs, from, from+10, 10) == 10);
+    assert(f.length(mbs, from, from+10, 11) == 10);
+    assert(f.length(mbs, from, from+10, 100) == 10);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// int max_length() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.max_length() == 1);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// result out(stateT& state,
+//            const internT* from, const internT* from_end, const internT*& from_next,
+//            externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const std::basic_string<F::intern_type> from("some text");
+    std::vector<char> to(from.size());
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char* from_next = 0;
+    char* to_next = 0;
+    assert(f.out(mbs, from.data(), from.data() + from.size(), from_next,
+                      to.data(), to.data() + to.size(), to_next) == F::noconv);
+    assert(from_next == from.data());
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char, char, mbstate_t>
+
+// result unshift(stateT& state,
+//                externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<char, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    std::vector<char> to(3);
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    char* to_next = 0;
+    assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,127 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<char32_t, char, mbstate_t>
+// template <> class codecvt<char16_t, char, mbstate_t>
+// template <> class codecvt<char32_t, char16_t, mbstate_t>  // extension
+
+// sanity check
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    typedef std::codecvt<char32_t, char, std::mbstate_t> F32_8;
+    typedef std::codecvt<char16_t, char, std::mbstate_t> F16_8;
+    typedef std::codecvt_utf16<char32_t> F32_16;
+    std::locale l = std::locale(std::locale::classic(), new F32_16);
+    const F32_8& f32_8 = std::use_facet<F32_8>(std::locale::classic());
+    const F32_16& f32_16 = std::use_facet<F32_16>(l);
+    const F16_8& f16_8 = std::use_facet<F16_8>(std::locale::classic());
+    std::mbstate_t mbs = {0};
+    F32_8::intern_type* c32p;
+    F16_8::intern_type* c16p;
+    F32_8::extern_type* c8p;
+    const F32_8::intern_type* c_c32p;
+    const F16_8::intern_type* c_c16p;
+    const F32_8::extern_type* c_c8p;
+    F32_8::intern_type c32;
+    F16_8::intern_type c16[2];
+    char c16c[4];
+    char* c16cp;
+    F32_8::extern_type c8[4];
+    for (F32_8::intern_type c32x = 0; c32x < 0x110003; ++c32x)
+    {
+        if ((0xD800 <= c32x && c32x < 0xE000) || c32x >= 0x110000)
+        {
+            assert(f32_16.out(mbs, &c32x, &c32x+1, c_c32p, c16c+0, c16c+4, c16cp) == F32_8::error);
+            assert(f32_8.out(mbs, &c32x, &c32x+1, c_c32p, c8, c8+4, c8p) == F32_8::error);
+        }
+        else
+        {
+            assert(f32_16.out(mbs, &c32x, &c32x+1, c_c32p, c16c, c16c+4, c16cp) == F32_8::ok);
+            assert(c_c32p-&c32x == 1);
+            if (c32x < 0x10000)
+                assert(c16cp-c16c == 2);
+            else
+                assert(c16cp-c16c == 4);
+            for (int i = 0; i < (c16cp - c16c) / 2; ++i)
+                c16[i] = (unsigned char)c16c[2*i] << 8 | (unsigned char)c16c[2*i+1];
+            c_c16p = c16 + (c16cp - c16c) / 2;
+            assert(f16_8.out(mbs, c16, c_c16p, c_c16p, c8, c8+4, c8p) == F32_8::ok);
+            if (c32x < 0x10000)
+                assert(c_c16p-c16 == 1);
+            else
+                assert(c_c16p-c16 == 2);
+            if (c32x < 0x80)
+                assert(c8p-c8 == 1);
+            else if (c32x < 0x800)
+                assert(c8p-c8 == 2);
+            else if (c32x < 0x10000)
+                assert(c8p-c8 == 3);
+            else
+                assert(c8p-c8 == 4);
+            c_c8p = c8p;
+            assert(f32_8.in(mbs, c8, c_c8p, c_c8p, &c32, &c32+1, c32p) == F32_8::ok);
+            if (c32x < 0x80)
+                assert(c_c8p-c8 == 1);
+            else if (c32x < 0x800)
+                assert(c_c8p-c8 == 2);
+            else if (c32x < 0x10000)
+                assert(c_c8p-c8 == 3);
+            else
+                assert(c_c8p-c8 == 4);
+            assert(c32p-&c32 == 1);
+            assert(c32 == c32x);
+            assert(f32_8.out(mbs, &c32x, &c32x+1, c_c32p, c8, c8+4, c8p) == F32_8::ok);
+            assert(c_c32p-&c32x == 1);
+            if (c32x < 0x80)
+                assert(c8p-c8 == 1);
+            else if (c32x < 0x800)
+                assert(c8p-c8 == 2);
+            else if (c32x < 0x10000)
+                assert(c8p-c8 == 3);
+            else
+                assert(c8p-c8 == 4);
+            c_c8p = c8p;
+            assert(f16_8.in(mbs, c8, c_c8p, c_c8p, c16, c16+2, c16p) == F32_8::ok);
+            if (c32x < 0x80)
+                assert(c_c8p-c8 == 1);
+            else if (c32x < 0x800)
+                assert(c_c8p-c8 == 2);
+            else if (c32x < 0x10000)
+                assert(c_c8p-c8 == 3);
+            else
+                assert(c_c8p-c8 == 4);
+            if (c32x < 0x10000)
+                assert(c16p-c16 == 1);
+            else
+                assert(c16p-c16 == 2);
+            for (int i = 0; i < c16p-c16; ++i)
+            {
+                c16c[2*i] = static_cast<char>(c16[i] >> 8);
+                c16c[2*i+1] = static_cast<char>(c16[i]);
+            }
+            const char* c_c16cp = c16c + (c16p-c16)*2;
+            assert(f32_16.in(mbs, c16c, c_c16cp, c_c16cp, &c32, &c32+1, c32p) == F32_8::ok);
+            if (c32x < 0x10000)
+                assert(c_c16cp-c16c == 2);
+            else
+                assert(c_c16cp-c16c == 4);
+            assert(c32p-&c32 == 1);
+            assert(c32 == c32x);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// bool always_noconv() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(!f.always_noconv());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// int encoding() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.encoding() == 1);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// result in(stateT& state,
+//           const externT* from, const externT* from_end, const externT*& from_next,
+//           internT* to, internT* to_end, internT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const std::basic_string<F::extern_type> from("some text");
+    const std::basic_string<F::intern_type> expected(from.begin(), from.end());
+    std::basic_string<F::intern_type> to(from.size(), F::intern_type());
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const F::extern_type* from_next = 0;
+    F::intern_type* to_next = 0;
+    F::result r = f.in(mbs, from.data(), from.data() + from.size(), from_next,
+                            &to[0], &to[0] + to.size(), to_next);
+    assert(r == F::ok);
+    assert(from_next - from.data() == from.size());
+    assert(to_next - to.data() == expected.size());
+    assert(to_next - to.data() == expected.size());
+    assert(to == expected);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    const char* from = "123467890";
+    assert(f.length(mbs, from, from+10, 0) == 0);
+    assert(f.length(mbs, from, from+10, 9) == 9);
+    assert(f.length(mbs, from, from+10, 10) == 10);
+    assert(f.length(mbs, from, from+10, 11) == 10);
+    assert(f.length(mbs, from, from+10, 100) == 10);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// int max_length() const throw();
+
+#include <locale>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    assert(f.max_length() == 1);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// result out(stateT& state,
+//            const internT* from, const internT* from_end, const internT*& from_next,
+//            externT* to, externT* to_end, externT*& to_next) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    const F& f = std::use_facet<F>(l);
+    {
+        const std::basic_string<F::intern_type> from(L"some text");
+        std::vector<char> to(from.size()+1);
+        std::mbstate_t mbs = {0};
+        const F::intern_type* from_next = 0;
+        char* to_next = 0;
+        F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
+                                 to.data(), to.data() + to.size(), to_next);
+        assert(r == F::ok);
+        assert(from_next - from.data() == from.size());
+        assert(to_next - to.data() == from.size());
+        assert(to.data() == std::string("some text"));
+    }
+    {
+        std::basic_string<F::intern_type> from(L"some text");
+        from[4] = '\0';
+        std::vector<char> to(from.size()+1);
+        std::mbstate_t mbs = {0};
+        const F::intern_type* from_next = 0;
+        char* to_next = 0;
+        F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
+                                 to.data(), to.data() + to.size(), to_next);
+        assert(r == F::ok);
+        assert(from_next - from.data() == from.size());
+        assert(to_next - to.data() == from.size());
+        assert(memcmp(to.data(), "some\0text", from.size()) == 0);
+    }
+    {
+        std::basic_string<F::intern_type> from(L"some text");
+        std::vector<char> to(from.size()-1);
+        std::mbstate_t mbs = {0};
+        const F::intern_type* from_next = 0;
+        char* to_next = 0;
+        F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
+                                 to.data(), to.data() + to.size()-1, to_next);
+        assert(r == F::partial);
+        assert(from_next - from.data() == to.size()-1);
+        assert(to_next - to.data() == to.size()-1);
+        assert(to.data() == std::string("some te"));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <> class codecvt<wchar_t, char, mbstate_t>
+
+// result unshift(stateT& state,
+//                externT* to, externT* to_end, externT*& to_next) const;
+
+// This is pretty much just an "are you breathing" test
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    std::vector<F::extern_type> to(3);
+    const F& f = std::use_facet<F>(l);
+    std::mbstate_t mbs = {0};
+    F::extern_type* to_next = 0;
+    assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::ok);
+    assert(to_next == to.data());
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <>
+// class codecvt<char, char, mbstate_t>
+//     : public locale::facet,
+//       public codecvt_base
+// {
+// public:
+//     typedef char      intern_type;
+//     typedef char      extern_type;
+//     typedef mbstate_t state_type;
+//     ...
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::codecvt<char, char, std::mbstate_t> F;
+    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
+    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
+    static_assert((std::is_same<F::intern_type, char>::value), "");
+    static_assert((std::is_same<F::extern_type, char>::value), "");
+    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
+    std::locale l = std::locale::classic();
+    assert(std::has_facet<F>(l));
+    const F& f = std::use_facet<F>(l);
+    (void)F::id;
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <>
+// class codecvt<char16_t, char, mbstate_t>
+//     : public locale::facet,
+//       public codecvt_base
+// {
+// public:
+//     typedef char16_t  intern_type;
+//     typedef char      extern_type;
+//     typedef mbstate_t state_type;
+//     ...
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    typedef std::codecvt<char16_t, char, std::mbstate_t> F;
+    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
+    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
+    static_assert((std::is_same<F::intern_type, char16_t>::value), "");
+    static_assert((std::is_same<F::extern_type, char>::value), "");
+    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
+    std::locale l = std::locale::classic();
+    assert(std::has_facet<F>(l));
+    const F& f = std::use_facet<F>(l);
+    (void)F::id;
+//#endif
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <>
+// class codecvt<char32_t, char, mbstate_t>
+//     : public locale::facet,
+//       public codecvt_base
+// {
+// public:
+//     typedef char32_t  intern_type;
+//     typedef char      extern_type;
+//     typedef mbstate_t state_type;
+//     ...
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    typedef std::codecvt<char32_t, char, std::mbstate_t> F;
+    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
+    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
+    static_assert((std::is_same<F::intern_type, char32_t>::value), "");
+    static_assert((std::is_same<F::extern_type, char>::value), "");
+    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
+    std::locale l = std::locale::classic();
+    assert(std::has_facet<F>(l));
+    const F& f = std::use_facet<F>(l);
+    (void)F::id;
+//#endif
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <>
+// class codecvt<wchar_t, char, mbstate_t>
+//     : public locale::facet,
+//       public codecvt_base
+// {
+// public:
+//     typedef wchar_t   intern_type;
+//     typedef char      extern_type;
+//     typedef mbstate_t state_type;
+//     ...
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
+    static_assert((std::is_base_of<std::locale::facet, F>::value), "");
+    static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
+    static_assert((std::is_same<F::intern_type, wchar_t>::value), "");
+    static_assert((std::is_same<F::extern_type, char>::value), "");
+    static_assert((std::is_same<F::state_type, std::mbstate_t>::value), "");
+    std::locale l = std::locale::classic();
+    assert(std::has_facet<F>(l));
+    const F& f = std::use_facet<F>(l);
+    (void)F::id;
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// bool is(mask m, charT c) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.is(F::space, L' '));
+            assert(!f.is(F::space, L'A'));
+
+            assert(f.is(F::print, L' '));
+            assert(!f.is(F::print, L'\x07'));
+
+            assert(f.is(F::cntrl, L'\x07'));
+            assert(!f.is(F::cntrl, L' '));
+
+            assert(f.is(F::upper, L'A'));
+            assert(!f.is(F::upper, L'a'));
+
+            assert(f.is(F::lower, L'a'));
+            assert(!f.is(F::lower, L'A'));
+
+            assert(f.is(F::alpha, L'a'));
+            assert(!f.is(F::alpha, L'1'));
+
+            assert(f.is(F::digit, L'1'));
+            assert(!f.is(F::digit, L'a'));
+
+            assert(f.is(F::punct, L'.'));
+            assert(!f.is(F::punct, L'a'));
+
+            assert(f.is(F::xdigit, L'a'));
+            assert(!f.is(F::xdigit, L'g'));
+
+            assert(f.is(F::alnum, L'a'));
+            assert(!f.is(F::alnum, L'.'));
+
+            assert(f.is(F::graph, L'.'));
+            assert(!f.is(F::graph,  L'\x07'));
+
+            assert(f.is(F::alpha, L'\x00DA'));
+            assert(f.is(F::upper, L'\x00DA'));
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.is(F::space, L' '));
+            assert(!f.is(F::space, L'A'));
+
+            assert(f.is(F::print, L' '));
+            assert(!f.is(F::print, L'\x07'));
+
+            assert(f.is(F::cntrl, L'\x07'));
+            assert(!f.is(F::cntrl, L' '));
+
+            assert(f.is(F::upper, L'A'));
+            assert(!f.is(F::upper, L'a'));
+
+            assert(f.is(F::lower, L'a'));
+            assert(!f.is(F::lower, L'A'));
+
+            assert(f.is(F::alpha, L'a'));
+            assert(!f.is(F::alpha, L'1'));
+
+            assert(f.is(F::digit, L'1'));
+            assert(!f.is(F::digit, L'a'));
+
+            assert(f.is(F::punct, L'.'));
+            assert(!f.is(F::punct, L'a'));
+
+            assert(f.is(F::xdigit, L'a'));
+            assert(!f.is(F::xdigit, L'g'));
+
+            assert(f.is(F::alnum, L'a'));
+            assert(!f.is(F::alnum, L'.'));
+
+            assert(f.is(F::graph, L'.'));
+            assert(!f.is(F::graph,  L'\x07'));
+
+            assert(!f.is(F::alpha, L'\x00DA'));
+            assert(!f.is(F::upper, L'\x00DA'));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,247 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* do_is(const charT* low, const charT* high, mask* vec) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            const wchar_t* h = f.is(in.data(), in.data() + in.size(), m.data());
+            assert(h == in.data() + in.size());
+
+            // L'\x00DA'
+            assert(!(m[0] & F::space));
+            assert( (m[0] & F::print));
+            assert(!(m[0] & F::cntrl));
+            assert( (m[0] & F::upper));
+            assert(!(m[0] & F::lower));
+            assert( (m[0] & F::alpha));
+            assert(!(m[0] & F::digit));
+            assert(!(m[0] & F::punct));
+            assert(!(m[0] & F::xdigit));
+            assert(!(m[0] & F::blank));
+            assert( (m[0] & F::alnum));
+            assert( (m[0] & F::graph));
+
+            // L' '
+            assert( (m[1] & F::space));
+            assert( (m[1] & F::print));
+            assert(!(m[1] & F::cntrl));
+            assert(!(m[1] & F::upper));
+            assert(!(m[1] & F::lower));
+            assert(!(m[1] & F::alpha));
+            assert(!(m[1] & F::digit));
+            assert(!(m[1] & F::punct));
+            assert(!(m[1] & F::xdigit));
+            assert( (m[1] & F::blank));
+            assert(!(m[1] & F::alnum));
+            assert(!(m[1] & F::graph));
+
+            // L'A'
+            assert(!(m[2] & F::space));
+            assert( (m[2] & F::print));
+            assert(!(m[2] & F::cntrl));
+            assert( (m[2] & F::upper));
+            assert(!(m[2] & F::lower));
+            assert( (m[2] & F::alpha));
+            assert(!(m[2] & F::digit));
+            assert(!(m[2] & F::punct));
+            assert( (m[2] & F::xdigit));
+            assert(!(m[2] & F::blank));
+            assert( (m[2] & F::alnum));
+            assert( (m[2] & F::graph));
+
+            // L'\x07'
+            assert(!(m[3] & F::space));
+            assert(!(m[3] & F::print));
+            assert( (m[3] & F::cntrl));
+            assert(!(m[3] & F::upper));
+            assert(!(m[3] & F::lower));
+            assert(!(m[3] & F::alpha));
+            assert(!(m[3] & F::digit));
+            assert(!(m[3] & F::punct));
+            assert(!(m[3] & F::xdigit));
+            assert(!(m[3] & F::blank));
+            assert(!(m[3] & F::alnum));
+            assert(!(m[3] & F::graph));
+
+            // L'.'
+            assert(!(m[4] & F::space));
+            assert( (m[4] & F::print));
+            assert(!(m[4] & F::cntrl));
+            assert(!(m[4] & F::upper));
+            assert(!(m[4] & F::lower));
+            assert(!(m[4] & F::alpha));
+            assert(!(m[4] & F::digit));
+            assert( (m[4] & F::punct));
+            assert(!(m[4] & F::xdigit));
+            assert(!(m[4] & F::blank));
+            assert(!(m[4] & F::alnum));
+            assert( (m[4] & F::graph));
+
+            // L'a'
+            assert(!(m[5] & F::space));
+            assert( (m[5] & F::print));
+            assert(!(m[5] & F::cntrl));
+            assert(!(m[5] & F::upper));
+            assert( (m[5] & F::lower));
+            assert( (m[5] & F::alpha));
+            assert(!(m[5] & F::digit));
+            assert(!(m[5] & F::punct));
+            assert( (m[5] & F::xdigit));
+            assert(!(m[5] & F::blank));
+            assert( (m[5] & F::alnum));
+            assert( (m[5] & F::graph));
+
+            // L'1'
+            assert(!(m[6] & F::space));
+            assert( (m[6] & F::print));
+            assert(!(m[6] & F::cntrl));
+            assert(!(m[6] & F::upper));
+            assert(!(m[6] & F::lower));
+            assert(!(m[6] & F::alpha));
+            assert( (m[6] & F::digit));
+            assert(!(m[6] & F::punct));
+            assert( (m[6] & F::xdigit));
+            assert(!(m[6] & F::blank));
+            assert( (m[6] & F::alnum));
+            assert( (m[6] & F::graph));
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            const wchar_t* h = f.is(in.data(), in.data() + in.size(), m.data());
+            assert(h == in.data() + in.size());
+
+            // L'\x00DA'
+            assert(!(m[0] & F::space));
+            assert(!(m[0] & F::print));
+            assert(!(m[0] & F::cntrl));
+            assert(!(m[0] & F::upper));
+            assert(!(m[0] & F::lower));
+            assert(!(m[0] & F::alpha));
+            assert(!(m[0] & F::digit));
+            assert(!(m[0] & F::punct));
+            assert(!(m[0] & F::xdigit));
+            assert(!(m[0] & F::blank));
+            assert(!(m[0] & F::alnum));
+            assert(!(m[0] & F::graph));
+
+            // L' '
+            assert( (m[1] & F::space));
+            assert( (m[1] & F::print));
+            assert(!(m[1] & F::cntrl));
+            assert(!(m[1] & F::upper));
+            assert(!(m[1] & F::lower));
+            assert(!(m[1] & F::alpha));
+            assert(!(m[1] & F::digit));
+            assert(!(m[1] & F::punct));
+            assert(!(m[1] & F::xdigit));
+            assert( (m[1] & F::blank));
+            assert(!(m[1] & F::alnum));
+            assert(!(m[1] & F::graph));
+
+            // L'A'
+            assert(!(m[2] & F::space));
+            assert( (m[2] & F::print));
+            assert(!(m[2] & F::cntrl));
+            assert( (m[2] & F::upper));
+            assert(!(m[2] & F::lower));
+            assert( (m[2] & F::alpha));
+            assert(!(m[2] & F::digit));
+            assert(!(m[2] & F::punct));
+            assert( (m[2] & F::xdigit));
+            assert(!(m[2] & F::blank));
+            assert( (m[2] & F::alnum));
+            assert( (m[2] & F::graph));
+
+            // L'\x07'
+            assert(!(m[3] & F::space));
+            assert(!(m[3] & F::print));
+            assert( (m[3] & F::cntrl));
+            assert(!(m[3] & F::upper));
+            assert(!(m[3] & F::lower));
+            assert(!(m[3] & F::alpha));
+            assert(!(m[3] & F::digit));
+            assert(!(m[3] & F::punct));
+            assert(!(m[3] & F::xdigit));
+            assert(!(m[3] & F::blank));
+            assert(!(m[3] & F::alnum));
+            assert(!(m[3] & F::graph));
+
+            // L'.'
+            assert(!(m[4] & F::space));
+            assert( (m[4] & F::print));
+            assert(!(m[4] & F::cntrl));
+            assert(!(m[4] & F::upper));
+            assert(!(m[4] & F::lower));
+            assert(!(m[4] & F::alpha));
+            assert(!(m[4] & F::digit));
+            assert( (m[4] & F::punct));
+            assert(!(m[4] & F::xdigit));
+            assert(!(m[4] & F::blank));
+            assert(!(m[4] & F::alnum));
+            assert( (m[4] & F::graph));
+
+            // L'a'
+            assert(!(m[5] & F::space));
+            assert( (m[5] & F::print));
+            assert(!(m[5] & F::cntrl));
+            assert(!(m[5] & F::upper));
+            assert( (m[5] & F::lower));
+            assert( (m[5] & F::alpha));
+            assert(!(m[5] & F::digit));
+            assert(!(m[5] & F::punct));
+            assert( (m[5] & F::xdigit));
+            assert(!(m[5] & F::blank));
+            assert( (m[5] & F::alnum));
+            assert( (m[5] & F::graph));
+
+            // L'1'
+            assert(!(m[6] & F::space));
+            assert( (m[6] & F::print));
+            assert(!(m[6] & F::cntrl));
+            assert(!(m[6] & F::upper));
+            assert(!(m[6] & F::lower));
+            assert(!(m[6] & F::alpha));
+            assert( (m[6] & F::digit));
+            assert(!(m[6] & F::punct));
+            assert( (m[6] & F::xdigit));
+            assert(!(m[6] & F::blank));
+            assert( (m[6] & F::alnum));
+            assert( (m[6] & F::graph));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_CA.ISO8859-1
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// char narrow(charT c, char dfault) const;
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(std::string(LOCALE_fr_CA_ISO8859_1));
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.narrow(L' ', '*') == ' ');
+            assert(f.narrow(L'A', '*') == 'A');
+            assert(f.narrow(L'\x07', '*') == '\x07');
+            assert(f.narrow(L'.', '*') == '.');
+            assert(f.narrow(L'a', '*') == 'a');
+            assert(f.narrow(L'1', '*') == '1');
+            assert(f.narrow(L'\xDA', '*') == '\xDA');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.narrow(L' ', '*') == ' ');
+            assert(f.narrow(L'A', '*') == 'A');
+            assert(f.narrow(L'\x07', '*') == '\x07');
+            assert(f.narrow(L'.', '*') == '.');
+            assert(f.narrow(L'a', '*') == 'a');
+            assert(f.narrow(L'1', '*') == '1');
+            assert(f.narrow(L'\xDA', '*') == '*');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_CA.ISO8859-1
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* narrow(const charT* low, const charT*, char dfault, char* to) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_fr_CA_ISO8859_1);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L" A\x07.a1\xDA");
+            std::vector<char> v(in.size());
+
+            assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
+            assert(v[0] == ' ');
+            assert(v[1] == 'A');
+            assert(v[2] == '\x07');
+            assert(v[3] == '.');
+            assert(v[4] == 'a');
+            assert(v[5] == '1');
+            assert(v[6] == '\xDA');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L" A\x07.a1\xDA");
+            std::vector<char> v(in.size());
+
+            assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
+            assert(v[0] == ' ');
+            assert(v[1] == 'A');
+            assert(v[2] == '\x07');
+            assert(v[3] == '.');
+            assert(v[4] == 'a');
+            assert(v[5] == '1');
+            assert(v[6] == '*');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* scan_is(mask m, const charT* low, const charT* high) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            assert(f.scan_is(F::space, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_is(F::print, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_is(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 3);
+            assert(f.scan_is(F::upper, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_is(F::lower, in.data(), in.data() + in.size()) - in.data() == 5);
+            assert(f.scan_is(F::alpha, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_is(F::digit, in.data(), in.data() + in.size()) - in.data() == 6);
+            assert(f.scan_is(F::punct, in.data(), in.data() + in.size()) - in.data() == 4);
+            assert(f.scan_is(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 2);
+            assert(f.scan_is(F::blank, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_is(F::alnum, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_is(F::graph, in.data(), in.data() + in.size()) - in.data() == 0);
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            assert(f.scan_is(F::space, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_is(F::print, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_is(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 3);
+            assert(f.scan_is(F::upper, in.data(), in.data() + in.size()) - in.data() == 2);
+            assert(f.scan_is(F::lower, in.data(), in.data() + in.size()) - in.data() == 5);
+            assert(f.scan_is(F::alpha, in.data(), in.data() + in.size()) - in.data() == 2);
+            assert(f.scan_is(F::digit, in.data(), in.data() + in.size()) - in.data() == 6);
+            assert(f.scan_is(F::punct, in.data(), in.data() + in.size()) - in.data() == 4);
+            assert(f.scan_is(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 2);
+            assert(f.scan_is(F::blank, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_is(F::alnum, in.data(), in.data() + in.size()) - in.data() == 2);
+            assert(f.scan_is(F::graph, in.data(), in.data() + in.size()) - in.data() == 2);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* scan_not(mask m, const charT* low, const charT* high) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            assert(f.scan_not(F::space, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::print, in.data(), in.data() + in.size()) - in.data() == 3);
+            assert(f.scan_not(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::upper, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_not(F::lower, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::alpha, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_not(F::digit, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::punct, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::blank, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::alnum, in.data(), in.data() + in.size()) - in.data() == 1);
+            assert(f.scan_not(F::graph, in.data(), in.data() + in.size()) - in.data() == 1);
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            const std::wstring in(L"\x00DA A\x07.a1");
+            std::vector<F::mask> m(in.size());
+            assert(f.scan_not(F::space, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::print, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::upper, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::lower, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::alpha, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::digit, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::punct, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::blank, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::alnum, in.data(), in.data() + in.size()) - in.data() == 0);
+            assert(f.scan_not(F::graph, in.data(), in.data() + in.size()) - in.data() == 0);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// charT tolower(charT) const;
+
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.tolower(' ') == ' ');
+            assert(f.tolower('A') == 'a');
+            assert(f.tolower('\x07') == '\x07');
+            assert(f.tolower('.') == '.');
+            assert(f.tolower('a') == 'a');
+            assert(f.tolower('1') == '1');
+            assert(f.tolower('\xDA') == '\xFA');
+            assert(f.tolower('\xFA') == '\xFA');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.tolower(' ') == ' ');
+            assert(f.tolower('A') == 'a');
+            assert(f.tolower('\x07') == '\x07');
+            assert(f.tolower('.') == '.');
+            assert(f.tolower('a') == 'a');
+            assert(f.tolower('1') == '1');
+            assert(f.tolower('\xDA') == '\xDA');
+            assert(f.tolower('\xFA') == '\xFA');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.tolower(L' ') == L' ');
+            assert(f.tolower(L'A') == L'a');
+            assert(f.tolower(L'\x07') == L'\x07');
+            assert(f.tolower(L'.') == L'.');
+            assert(f.tolower(L'a') == L'a');
+            assert(f.tolower(L'1') == L'1');
+            assert(f.tolower(L'\xDA') == L'\xFA');
+            assert(f.tolower(L'\xFA') == L'\xFA');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.tolower(L' ') == L' ');
+            assert(f.tolower(L'A') == L'a');
+            assert(f.tolower(L'\x07') == L'\x07');
+            assert(f.tolower(L'.') == L'.');
+            assert(f.tolower(L'a') == L'a');
+            assert(f.tolower(L'1') == L'1');
+            assert(f.tolower(L'\xDA') == L'\xDA');
+            assert(f.tolower(L'\xFA') == L'\xFA');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* tolower(charT* low, const charT* high) const;
+
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in("\xDA A\x07.a1");
+
+            assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == '\xFA');
+            assert(in[1] == ' ');
+            assert(in[2] == 'a');
+            assert(in[3] == '\x07');
+            assert(in[4] == '.');
+            assert(in[5] == 'a');
+            assert(in[6] == '1');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in("\xDA A\x07.a1");
+
+            assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == '\xDA');
+            assert(in[1] == ' ');
+            assert(in[2] == 'a');
+            assert(in[3] == '\x07');
+            assert(in[4] == '.');
+            assert(in[5] == 'a');
+            assert(in[6] == '1');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L"\xDA A\x07.a1");
+
+            assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == L'\xFA');
+            assert(in[1] == L' ');
+            assert(in[2] == L'a');
+            assert(in[3] == L'\x07');
+            assert(in[4] == L'.');
+            assert(in[5] == L'a');
+            assert(in[6] == L'1');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L"\xDA A\x07.a1");
+
+            assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == L'\xDA');
+            assert(in[1] == L' ');
+            assert(in[2] == L'a');
+            assert(in[3] == L'\x07');
+            assert(in[4] == L'.');
+            assert(in[5] == L'a');
+            assert(in[6] == L'1');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// charT toupper(charT) const;
+
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.toupper(' ') == ' ');
+            assert(f.toupper('A') == 'A');
+            assert(f.toupper('\x07') == '\x07');
+            assert(f.toupper('.') == '.');
+            assert(f.toupper('a') == 'A');
+            assert(f.toupper('1') == '1');
+            assert(f.toupper('\xDA') == '\xDA');
+            assert(f.toupper('\xFA') == '\xDA');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.toupper(' ') == ' ');
+            assert(f.toupper('A') == 'A');
+            assert(f.toupper('\x07') == '\x07');
+            assert(f.toupper('.') == '.');
+            assert(f.toupper('a') == 'A');
+            assert(f.toupper('1') == '1');
+            assert(f.toupper('\xDA') == '\xDA');
+            assert(f.toupper('\xFA') == '\xFA');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.toupper(L' ') == L' ');
+            assert(f.toupper(L'A') == L'A');
+            assert(f.toupper(L'\x07') == L'\x07');
+            assert(f.toupper(L'.') == L'.');
+            assert(f.toupper(L'a') == L'A');
+            assert(f.toupper(L'1') == L'1');
+            assert(f.toupper(L'\xDA') == L'\xDA');
+            assert(f.toupper(L'\xFA') == L'\xDA');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.toupper(L' ') == L' ');
+            assert(f.toupper(L'A') == L'A');
+            assert(f.toupper(L'\x07') == L'\x07');
+            assert(f.toupper(L'.') == L'.');
+            assert(f.toupper(L'a') == L'A');
+            assert(f.toupper(L'1') == L'1');
+            assert(f.toupper(L'\xDA') == L'\xDA');
+            assert(f.toupper(L'\xFA') == L'\xFA');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const charT* toupper(charT* low, const charT* high) const;
+
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in("\xFA A\x07.a1");
+
+            assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == '\xDA');
+            assert(in[1] == ' ');
+            assert(in[2] == 'A');
+            assert(in[3] == '\x07');
+            assert(in[4] == '.');
+            assert(in[5] == 'A');
+            assert(in[6] == '1');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<char> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in("\xFA A\x07.a1");
+
+            assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == '\xFA');
+            assert(in[1] == ' ');
+            assert(in[2] == 'A');
+            assert(in[3] == '\x07');
+            assert(in[4] == '.');
+            assert(in[5] == 'A');
+            assert(in[6] == '1');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L"\xFA A\x07.a1");
+
+            assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == L'\xDA');
+            assert(in[1] == L' ');
+            assert(in[2] == L'A');
+            assert(in[3] == L'\x07');
+            assert(in[4] == L'.');
+            assert(in[5] == L'A');
+            assert(in[6] == L'1');
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::wstring in(L"\xFA A\x07.a1");
+
+            assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+            assert(in[0] == L'\xFA');
+            assert(in[1] == L' ');
+            assert(in[2] == L'A');
+            assert(in[3] == L'\x07');
+            assert(in[4] == L'.');
+            assert(in[5] == L'A');
+            assert(in[6] == L'1');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class CharT>
+// class ctype_byname
+//     : public ctype<CharT>
+// {
+// public:
+//     explicit ctype_byname(const char*, size_t = 0);
+//     explicit ctype_byname(const string&, size_t = 0);
+//
+// protected:
+//     ~ctype_byname();
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            assert(std::has_facet<std::ctype_byname<char> >(l));
+            assert(&std::use_facet<std::ctype<char> >(l)
+                == &std::use_facet<std::ctype_byname<char> >(l));
+        }
+        {
+            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
+            assert(&std::use_facet<std::ctype<wchar_t> >(l)
+                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
+        }
+    }
+    {
+        std::locale l("");
+        {
+            assert(std::has_facet<std::ctype_byname<char> >(l));
+            assert(&std::use_facet<std::ctype<char> >(l)
+                == &std::use_facet<std::ctype_byname<char> >(l));
+        }
+        {
+            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
+            assert(&std::use_facet<std::ctype<wchar_t> >(l)
+                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            assert(std::has_facet<std::ctype_byname<char> >(l));
+            assert(&std::use_facet<std::ctype<char> >(l)
+                == &std::use_facet<std::ctype_byname<char> >(l));
+        }
+        {
+            assert(std::has_facet<std::ctype_byname<wchar_t> >(l));
+            assert(&std::use_facet<std::ctype<wchar_t> >(l)
+                == &std::use_facet<std::ctype_byname<wchar_t> >(l));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// charT widen(char c) const;
+
+// I doubt this test is portable
+
+// XFAIL: linux
+
+#include <locale>
+#include <cassert>
+#include <limits.h>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.widen(' ') == L' ');
+            assert(f.widen('A') == L'A');
+            assert(f.widen('\x07') == L'\x07');
+            assert(f.widen('.') == L'.');
+            assert(f.widen('a') == L'a');
+            assert(f.widen('1') == L'1');
+            assert(f.widen(char(-5)) == wchar_t(-1));
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+
+            assert(f.widen(' ') == L' ');
+            assert(f.widen('A') == L'A');
+            assert(f.widen('\x07') == L'\x07');
+            assert(f.widen('.') == L'.');
+            assert(f.widen('a') == L'a');
+            assert(f.widen('1') == L'1');
+            assert(f.widen(char(-5)) == wchar_t(251));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype_byname;
+
+// const char* widen(const char* low, const char* high, charT* to) const;
+
+// I doubt this test is portable
+
+// XFAIL: linux
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in(" A\x07.a1\x85");
+            std::vector<wchar_t> v(in.size());
+
+            assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
+            assert(v[0] == L' ');
+            assert(v[1] == L'A');
+            assert(v[2] == L'\x07');
+            assert(v[3] == L'.');
+            assert(v[4] == L'a');
+            assert(v[5] == L'1');
+            assert(v[6] == wchar_t(-1));
+        }
+    }
+    {
+        std::locale l("C");
+        {
+            typedef std::ctype<wchar_t> F;
+            const F& f = std::use_facet<F>(l);
+            std::string in(" A\x07.a1\x85");
+            std::vector<wchar_t> v(in.size());
+
+            assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
+            assert(v[0] == L' ');
+            assert(v[1] == L'A');
+            assert(v[2] == L'\x07');
+            assert(v[3] == L'.');
+            assert(v[4] == L'a');
+            assert(v[5] == L'1');
+            assert(v[6] == wchar_t(133));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// explicit ctype(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+template <class C>
+class my_facet
+    : public std::ctype<C>
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : std::ctype<C>(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+template <class C> int my_facet<C>::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet<wchar_t>);
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+    {
+        my_facet<wchar_t> f(1);
+        assert(my_facet<wchar_t>::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet<wchar_t>::count == 1);
+        }
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// bool is(mask m, charT c) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.is(F::space, L' '));
+        assert(!f.is(F::space, L'A'));
+
+        assert(f.is(F::print, L' '));
+        assert(!f.is(F::print, L'\x07'));
+
+        assert(f.is(F::cntrl, L'\x07'));
+        assert(!f.is(F::cntrl, L' '));
+
+        assert(f.is(F::upper, L'A'));
+        assert(!f.is(F::upper, L'a'));
+
+        assert(f.is(F::lower, L'a'));
+        assert(!f.is(F::lower, L'A'));
+
+        assert(f.is(F::alpha, L'a'));
+        assert(!f.is(F::alpha, L'1'));
+
+        assert(f.is(F::digit, L'1'));
+        assert(!f.is(F::digit, L'a'));
+
+        assert(f.is(F::punct, L'.'));
+        assert(!f.is(F::punct, L'a'));
+
+        assert(f.is(F::xdigit, L'a'));
+        assert(!f.is(F::xdigit, L'g'));
+
+        assert(f.is(F::alnum, L'a'));
+        assert(!f.is(F::alnum, L'.'));
+
+        assert(f.is(F::graph, L'.'));
+        assert(!f.is(F::graph,  L'\x07'));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* do_is(const charT* low, const charT* high, mask* vec) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        const std::wstring in(L" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        const wchar_t* h = f.is(in.data(), in.data() + in.size(), m.data());
+        assert(h == in.data() + in.size());
+
+        // L' '
+        assert( (m[0] & F::space));
+        assert( (m[0] & F::print));
+        assert(!(m[0] & F::cntrl));
+        assert(!(m[0] & F::upper));
+        assert(!(m[0] & F::lower));
+        assert(!(m[0] & F::alpha));
+        assert(!(m[0] & F::digit));
+        assert(!(m[0] & F::punct));
+        assert(!(m[0] & F::xdigit));
+        assert( (m[0] & F::blank));
+        assert(!(m[0] & F::alnum));
+        assert(!(m[0] & F::graph));
+
+        // L'A'
+        assert(!(m[1] & F::space));
+        assert( (m[1] & F::print));
+        assert(!(m[1] & F::cntrl));
+        assert( (m[1] & F::upper));
+        assert(!(m[1] & F::lower));
+        assert( (m[1] & F::alpha));
+        assert(!(m[1] & F::digit));
+        assert(!(m[1] & F::punct));
+        assert( (m[1] & F::xdigit));
+        assert(!(m[1] & F::blank));
+        assert( (m[1] & F::alnum));
+        assert( (m[1] & F::graph));
+
+        // L'\x07'
+        assert(!(m[2] & F::space));
+        assert(!(m[2] & F::print));
+        assert( (m[2] & F::cntrl));
+        assert(!(m[2] & F::upper));
+        assert(!(m[2] & F::lower));
+        assert(!(m[2] & F::alpha));
+        assert(!(m[2] & F::digit));
+        assert(!(m[2] & F::punct));
+        assert(!(m[2] & F::xdigit));
+        assert(!(m[2] & F::blank));
+        assert(!(m[2] & F::alnum));
+        assert(!(m[2] & F::graph));
+
+        // L'.'
+        assert(!(m[3] & F::space));
+        assert( (m[3] & F::print));
+        assert(!(m[3] & F::cntrl));
+        assert(!(m[3] & F::upper));
+        assert(!(m[3] & F::lower));
+        assert(!(m[3] & F::alpha));
+        assert(!(m[3] & F::digit));
+        assert( (m[3] & F::punct));
+        assert(!(m[3] & F::xdigit));
+        assert(!(m[3] & F::blank));
+        assert(!(m[3] & F::alnum));
+        assert( (m[3] & F::graph));
+
+        // L'a'
+        assert(!(m[4] & F::space));
+        assert( (m[4] & F::print));
+        assert(!(m[4] & F::cntrl));
+        assert(!(m[4] & F::upper));
+        assert( (m[4] & F::lower));
+        assert( (m[4] & F::alpha));
+        assert(!(m[4] & F::digit));
+        assert(!(m[4] & F::punct));
+        assert( (m[4] & F::xdigit));
+        assert(!(m[4] & F::blank));
+        assert( (m[4] & F::alnum));
+        assert( (m[4] & F::graph));
+
+        // L'1'
+        assert(!(m[5] & F::space));
+        assert( (m[5] & F::print));
+        assert(!(m[5] & F::cntrl));
+        assert(!(m[5] & F::upper));
+        assert(!(m[5] & F::lower));
+        assert(!(m[5] & F::alpha));
+        assert( (m[5] & F::digit));
+        assert(!(m[5] & F::punct));
+        assert( (m[5] & F::xdigit));
+        assert(!(m[5] & F::blank));
+        assert( (m[5] & F::alnum));
+        assert( (m[5] & F::graph));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// char narrow(charT c, char dfault) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.narrow(L' ', '*') == ' ');
+        assert(f.narrow(L'A', '*') == 'A');
+        assert(f.narrow(L'\x07', '*') == '\x07');
+        assert(f.narrow(L'.', '*') == '.');
+        assert(f.narrow(L'a', '*') == 'a');
+        assert(f.narrow(L'1', '*') == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/narrow_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* narrow(const charT* low, const charT*, char dfault, char* to) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        std::wstring in(L" A\x07.a1");
+        std::vector<char> v(in.size());
+
+        assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
+        assert(v[0] == ' ');
+        assert(v[1] == 'A');
+        assert(v[2] == '\x07');
+        assert(v[3] == '.');
+        assert(v[4] == 'a');
+        assert(v[5] == '1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_is.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_is.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_is.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_is.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* scan_is(mask m, const charT* low, const charT* high) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        const std::wstring in(L" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        assert(f.scan_is(F::space, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::print, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 2);
+        assert(f.scan_is(F::upper, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::lower, in.data(), in.data() + in.size()) - in.data() == 4);
+        assert(f.scan_is(F::alpha, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::digit, in.data(), in.data() + in.size()) - in.data() == 5);
+        assert(f.scan_is(F::punct, in.data(), in.data() + in.size()) - in.data() == 3);
+        assert(f.scan_is(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::blank, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_is(F::alnum, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_is(F::graph, in.data(), in.data() + in.size()) - in.data() == 1);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_not.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_not.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/scan_not.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* scan_not(mask m, const charT* low, const charT* high) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+#include <stdio.h>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        const std::wstring in(L" A\x07.a1");
+        std::vector<F::mask> m(in.size());
+        assert(f.scan_not(F::space, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_not(F::print, in.data(), in.data() + in.size()) - in.data() == 2);
+        assert(f.scan_not(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::upper, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::lower, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::alpha, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::digit, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::punct, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::blank, in.data(), in.data() + in.size()) - in.data() == 1);
+        assert(f.scan_not(F::alnum, in.data(), in.data() + in.size()) - in.data() == 0);
+        assert(f.scan_not(F::graph, in.data(), in.data() + in.size()) - in.data() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// charT tolower(charT) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.tolower(L' ') == L' ');
+        assert(f.tolower(L'A') == L'a');
+        assert(f.tolower(L'\x07') == L'\x07');
+        assert(f.tolower(L'.') == L'.');
+        assert(f.tolower(L'a') == L'a');
+        assert(f.tolower(L'1') == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/tolower_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* tolower(charT* low, const charT* high) const;
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        std::wstring in(L" A\x07.a1");
+
+        assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+        assert(in[0] == L' ');
+        assert(in[1] == L'a');
+        assert(in[2] == L'\x07');
+        assert(in[3] == L'.');
+        assert(in[4] == L'a');
+        assert(in[5] == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// charT toupper(charT) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.toupper(L' ') == L' ');
+        assert(f.toupper(L'A') == L'A');
+        assert(f.toupper(L'\x07') == L'\x07');
+        assert(f.toupper(L'.') == L'.');
+        assert(f.toupper(L'a') == L'A');
+        assert(f.toupper(L'1') == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/toupper_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const charT* toupper(charT* low, const charT* high) const;
+
+#include <locale>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        std::wstring in(L" A\x07.a1");
+
+        assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+        assert(in[0] == L' ');
+        assert(in[1] == L'A');
+        assert(in[2] == L'\x07');
+        assert(in[3] == L'.');
+        assert(in[4] == L'A');
+        assert(in[5] == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// charT widen(char c) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+
+        assert(f.widen(' ') == L' ');
+        assert(f.widen('A') == L'A');
+        assert(f.widen('\x07') == L'\x07');
+        assert(f.widen('.') == L'.');
+        assert(f.widen('a') == L'a');
+        assert(f.widen('1') == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/widen_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class ctype;
+
+// const char* widen(const char* low, const char* high, charT* to) const;
+
+#include <locale>
+#include <string>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef std::ctype<wchar_t> F;
+        const F& f = std::use_facet<F>(l);
+        std::string in(" A\x07.a1");
+        std::vector<wchar_t> v(in.size());
+
+        assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
+        assert(v[0] == L' ');
+        assert(v[1] == L'A');
+        assert(v[2] == L'\x07');
+        assert(v[3] == L'.');
+        assert(v[4] == L'a');
+        assert(v[5] == L'1');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class CharT>
+// class ctype
+//     : public locale::facet,
+//       public ctype_base
+// {
+// public:
+//     typedef CharT char_type;
+// };
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        assert(std::has_facet<std::ctype<wchar_t> >(l));
+        const std::ctype<wchar_t>& f = std::use_facet<std::ctype<wchar_t> >(l);
+        {
+            (void)std::ctype<wchar_t>::id;
+        }
+        static_assert((std::is_same<std::ctype<wchar_t>::char_type, wchar_t>::value), "");
+        static_assert((std::is_base_of<std::ctype_base, std::ctype<wchar_t> >::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::ctype<wchar_t> >::value), "");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages.byname/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages.byname/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages.byname/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages.byname/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class messages<charT>
+
+// explicit messages(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::messages<char> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.members/not_testable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.members/not_testable.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.members/not_testable.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.members/not_testable.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class messages<charT>
+
+// catalog open(const basic_string<char>& name, const locale&) const;
+
+#include <locale>
+#include <cassert>
+
+// As far as I can tell, the messages facet is untestable.  I have a best
+// effort implementation in the hopes that in the future I will learn how
+// to test it.
+
+template <class CharT>
+class F
+    : public std::messages<CharT>
+{
+public:
+    explicit F(std::size_t refs = 0)
+        : std::messages<CharT>(refs) {}
+};
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/locale.messages.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/messages_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/messages_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/messages_base.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/messages_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class messages_base
+// {
+// public:
+//     typedef unspecified catalog;
+// };
+
+#include <locale>
+#include <type_traits>
+
+int main()
+{
+    std::messages_base mb;
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/locale.messages/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class _CharT>
+// class messages
+//     : public locale::facet,
+//       public messages_base
+// {
+// public:
+//     typedef _CharT               char_type;
+//     typedef basic_string<_CharT> string_type;
+
+#include <locale>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::messages<char> >::value), "");
+    static_assert((std::is_base_of<std::messages_base, std::messages<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::messages<wchar_t> >::value), "");
+    static_assert((std::is_base_of<std::messages_base, std::messages<wchar_t> >::value), "");
+    static_assert((std::is_same<std::messages<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::messages<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::messages<char>::string_type, std::string>::value), "");
+    static_assert((std::is_same<std::messages<wchar_t>::string_type, std::wstring>::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.messages/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.messages/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.messages/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.messages/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// explicit money_get(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::money_get<char, const char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,723 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
+//               ios_base::iostate& err, long double& v) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_get<char, input_iterator<const char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_en_US_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+    {
+        const my_facet f(1);
+        // char, national
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "$0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "$0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-$0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-$0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "$1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facet f(1);
+        // char, international
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "USD 0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "USD 0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-USD 0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-USD 0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "USD 1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, national
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"$0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"$0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-$0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-$0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"$1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, international
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"USD 0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"USD 0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-USD 0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-USD 0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"USD 1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,726 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
+//               ios_base::iostate& err, long double& v) const;
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_get<char, input_iterator<const char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_fr_FR_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+    {
+        const my_facet f(1);
+        // char, national
+        {   // zero
+            std::string v = "0,00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0,01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1 234 567,89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567,89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 \u20ac";  // €
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 \u20ac";  // €
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 \u20ac";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 \u20ac";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "1 234 567,89 EUR -";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "1 234 567,89 EUR -";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+        noshowbase(ios);
+    }
+    {
+        const my_facet f(1);
+        // char, international
+        {   // zero
+            std::string v = "0,00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0,01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1 234 567,89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567,89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 EUR";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 EUR";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 EUR";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 EUR";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 EUR";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 EUR";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 EUR";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "1 234 567,89 Eu-";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "1 234 567,89 Eu-";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, national
+        {   // zero
+            std::wstring v = L"0,00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0,01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1 234 567,89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567,89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 \u20ac";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 \u20ac";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 \u20ac";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"1 234 567,89 EUR -";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"1 234 567,89 EUR -";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, international
+        {   // zero
+            std::wstring v = L"0,00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0,01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1 234 567,89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567,89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 EUR";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 EUR";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 EUR";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 EUR";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 EUR";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 EUR";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 EUR";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"1 234 567,89 Eu-";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"1 234 567,89 Eu-";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,735 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux
+
+// REQUIRES: locale.ru_RU.UTF-8
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
+//               ios_base::iostate& err, long double& v) const;
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_get<char, input_iterator<const char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_ru_RU_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+    {
+        const my_facet f(1);
+        // char, national
+        {   // zero
+            std::string v = "0,00 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0,01 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 \xD1\x80\xD1\x83\xD0\xB1"".";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 5);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 \xD1\x80\xD1\x83\xD0\xB1"".";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 \xD1\x80\xD1\x83\xD0\xB1"".";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 6);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 \xD1\x80\xD1\x83\xD0\xB1"".";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 RUB ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -123456789);
+        }
+    }
+    {
+        const my_facet f(1);
+        // char, international
+        {   // zero
+            std::string v = "0,00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0,01 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1 234 567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567,89 ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 RUB ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 5);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "0,00 RUB ";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 RUB ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 6);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "-0,01 RUB ";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 RUB ";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -123456789);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, national
+        {   // zero
+            std::wstring v = L"0,00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0,01 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 \x440\x443\x431"".";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 5);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 \x440\x443\x431"".";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 \x440\x443\x431"".";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 6);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 \x440\x443\x431"".";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 \x440\x443\x431"".";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 \x440\x443\x431"".";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 RUB ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -123456789);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, international
+        {   // zero
+            std::wstring v = L"0,00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0,01 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1 234 567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567,89 ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 RUB ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 5);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"0,00 RUB ";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 RUB ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 6);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-0,01 RUB ";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 RUB ";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 13);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 RUB ";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 14);
+            assert(err == std::ios_base::goodbit);
+            assert(ex == -123456789);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,726 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
+//               ios_base::iostate& err, long double& v) const;
+
+// TODO For zh_CN GLIBC puts the negative sign after the currency symbol.
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_get<char, input_iterator<const char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_zh_CN_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+    {
+        const my_facet f(1);
+        // char, national
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "\xEF\xBF\xA5""0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "\xEF\xBF\xA5""0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "\xEF\xBF\xA5""-0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "\xEF\xBF\xA5""-0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "\xEF\xBF\xA5""1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "\xEF\xBF\xA5""1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "CNY -1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "CNY -1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facet f(1);
+        // char, international
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::string v = "CNY 0.00";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::string v = "CNY 0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "CNY -0.01";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::string v = "CNY -0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "CNY 1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::string v = "CNY 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "CNY -1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, national
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"\xFFE5""0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"\xFFE5""0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"\xFFE5""-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"\xFFE5""-0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"\xFFE5""1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"\xFFE5""1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"\xFFE5""-1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"CNY -1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"CNY -1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, international
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+        }
+        {   // zero, showbase
+            std::wstring v = L"CNY 0.00";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+        }
+        {   // zero, showbase
+            std::wstring v = L"CNY 0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 0);
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"CNY -0.01";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"CNY -0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -1);
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"CNY 1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+        }
+        {   // positive, showbase
+            std::wstring v = L"CNY 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == 123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"CNY -1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == -123456789);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"\xFFE5""-1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"\xFFE5""-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            long double ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 0);
+            assert(err == std::ios_base::failbit);
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,731 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_get<charT, InputIterator>
+
+// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
+//               ios_base::iostate& err, string_type& v) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_get<char, input_iterator<const char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_en_US_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+    {
+        const my_facet f(1);
+        // char, national
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+        }
+        {   // zero, showbase
+            std::string v = "$0.00";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+        }
+        {   // zero, showbase
+            std::string v = "$0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-$0.01";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+        }
+        {   // negative one, showbase
+            std::string v = "-$0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "$1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+        }
+        {   // positive, showbase
+            std::string v = "$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == "");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == "");
+        }
+    }
+    {
+        const my_facet f(1);
+        // char, international
+        {   // zero
+            std::string v = "0.00";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+        }
+        {   // negative one
+            std::string v = "-0.01";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+        }
+        {   // positive
+            std::string v = "1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+        }
+        {   // negative
+            std::string v = "-1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+        }
+        {   // negative
+            std::string v = "-1234567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+        }
+        {   // zero, showbase
+            std::string v = "USD 0.00";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+        }
+        {   // zero, showbase
+            std::string v = "USD 0.00";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "0");
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::string v = "-USD 0.01";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+        }
+        {   // negative one, showbase
+            std::string v = "-USD 0.01";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-1");
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::string v = "USD 1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+        }
+        {   // positive, showbase
+            std::string v = "USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == "-123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == "");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::string v = "-$1,234,567.89";
+            typedef input_iterator<const char*> I;
+            std::string ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == "");
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, national
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+        }
+        {   // zero, showbase
+            std::wstring v = L"$0.00";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+        }
+        {   // zero, showbase
+            std::wstring v = L"$0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-$0.01";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-$0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"$1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+        }
+        {   // positive, showbase
+            std::wstring v = L"$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == L"");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                false, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == L"");
+        }
+    }
+    {
+        const my_facetw f(1);
+        // wchar_t, international
+        {   // zero
+            std::wstring v = L"0.00";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+        }
+        {   // negative one
+            std::wstring v = L"-0.01";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+        }
+        {   // positive
+            std::wstring v = L"1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+        }
+        {   // negative
+            std::wstring v = L"-1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+        }
+        {   // negative
+            std::wstring v = L"-1234567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+        }
+        {   // zero, showbase
+            std::wstring v = L"USD 0.00";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+        }
+        {   // zero, showbase
+            std::wstring v = L"USD 0.00";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"0");
+            noshowbase(ios);
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-USD 0.01";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+        }
+        {   // negative one, showbase
+            std::wstring v = L"-USD 0.01";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-1");
+            noshowbase(ios);
+        }
+        {   // positive, showbase
+            std::wstring v = L"USD 1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+        }
+        {   // positive, showbase
+            std::wstring v = L"USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-USD 1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + v.size());
+            assert(err == std::ios_base::eofbit);
+            assert(ex == L"-123456789");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            showbase(ios);
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == L"");
+            noshowbase(ios);
+        }
+        {   // negative, showbase
+            std::wstring v = L"-$1,234,567.89";
+            typedef input_iterator<const wchar_t*> I;
+            std::wstring ex;
+            std::ios_base::iostate err = std::ios_base::goodbit;
+            I iter = f.get(I(v.data()), I(v.data() + v.size()),
+                                                true, ios, err, ex);
+            assert(iter.base() == v.data() + 1);
+            assert(err == std::ios_base::failbit);
+            assert(ex == L"");
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.get/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class CharT, class InputIterator = istreambuf_iterator<CharT> >
+// class money_get
+//     : public locale::facet
+// {
+// public:
+//     typedef CharT                   char_type;
+//     typedef InputIterator           iter_type;
+//     typedef basic_string<char_type> string_type;
+
+#include <locale>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::money_get<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::money_get<wchar_t> >::value), "");
+    static_assert((std::is_same<std::money_get<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::money_get<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::money_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::money_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
+    static_assert((std::is_same<std::money_get<char>::string_type, std::string>::value), "");
+    static_assert((std::is_same<std::money_get<wchar_t>::string_type, std::wstring>::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// explicit money_put(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::money_put<char, char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,494 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
+//               long double units) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_put<char, output_iterator<char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_en_US_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+{
+    const my_facet f(1);
+    // char, national
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "$0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "$1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$1,234,567.89      ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$      1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "      -$1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // char, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "USD 0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "USD 1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD    1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "   -USD 1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+{
+
+    const my_facetw f(1);
+    // wchar_t, national
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"$0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"$1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$1,234,567.89      ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$      1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"      -$1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // wchar_t, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"USD 0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"USD 1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD    1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"   -USD 1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,495 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
+//               long double units) const;
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_put<char, output_iterator<char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_fr_FR_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+{
+    const my_facet f(1);
+    // char, national
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 \u20ac");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 \u20ac");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 \u20ac");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \u20ac");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \u20ac   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89    \u20ac");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "   -1 234 567,89 \u20ac");
+        assert(ios.width() == 0);
+    }
+
+    // char, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 EUR");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 EUR");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 EUR");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 EUR");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 EUR   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89    EUR");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "   -1 234 567,89 EUR");
+        assert(ios.width() == 0);
+    }
+}
+{
+    const my_facetw f(1);
+    // wchar_t, national
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 \u20ac");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 \u20ac");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 \u20ac");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 \u20ac");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 \u20ac     ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89      \u20ac");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"     -1 234 567,89 \u20ac");
+        assert(ios.width() == 0);
+    }
+
+    // wchar_t, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 EUR");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 EUR");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 EUR");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 EUR");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 EUR   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89    EUR");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"   -1 234 567,89 EUR");
+        assert(ios.width() == 0);
+    }
+}
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,501 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux
+
+// REQUIRES: locale.ru_RU.UTF-8
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
+//               long double units) const;
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_put<char, output_iterator<char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_ru_RU_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+{
+    const my_facet f(1);
+    // char, national
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 ");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 ");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 ");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 ");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 \xD1\x80\xD1\x83\xD0\xB1"".");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 \xD1\x80\xD1\x83\xD0\xB1"".");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".");
+        assert(ios.width() == 0);
+    }
+
+    // char, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 ");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 ");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 ");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 ");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0,00 RUB ");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0,01 RUB ");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1 234 567,89 RUB ");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 RUB ");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89 RUB   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1 234 567,89   RUB ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "  -1 234 567,89 RUB ");
+        assert(ios.width() == 0);
+    }
+}
+{
+    const my_facetw f(1);
+    // wchar_t, national
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 ");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 ");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 ");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 ");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 \x440\x443\x431"".");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 \x440\x443\x431"".");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 \x440\x443\x431"".");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 \x440\x443\x431"".");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 \x440\x443\x431"".  ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89   \x440\x443\x431"".");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"  -1 234 567,89 \x440\x443\x431"".");
+        assert(ios.width() == 0);
+    }
+
+    // wchar_t, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 ");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 ");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 ");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 ");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0,00 RUB ");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0,01 RUB ");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1 234 567,89 RUB ");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 RUB ");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89 RUB   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1 234 567,89   RUB ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"  -1 234 567,89 RUB ");
+        assert(ios.width() == 0);
+    }
+}
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,496 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
+//               long double units) const;
+
+// TODO For zh_CN GLIBC puts the negative sign after the currency symbol.
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_put<char, output_iterator<char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_zh_CN_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+{
+    const my_facet f(1);
+    // char, national
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""-0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""-1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""-1,234,567.89    ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "\xEF\xBF\xA5""-    1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "    \xEF\xBF\xA5""-1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // char, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY 0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY -0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY 1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY -1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY -1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "CNY -   1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "   CNY -1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+{
+    const my_facetw f(1);
+    // wchar_t, national
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""-0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""-1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""-1,234,567.89      ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"\xFFE5""-      1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"      \xFFE5""-1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // wchar_t, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        long double v = 0;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        long double v = -1;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        long double v = 123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        long double v = -123456789;
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        long double v = 0;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY 0.00");
+    }
+    {   // negative one, showbase
+        long double v = -1;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY -0.01");
+    }
+    {   // positive, showbase
+        long double v = 123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY 1,234,567.89");
+    }
+    {   // negative, showbase
+        long double v = -123456789;
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY -1,234,567.89");
+    }
+    {   // negative, showbase, left
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY -1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"CNY -   1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        long double v = -123456789;
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"   CNY -1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,494 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
+//               const string_type& units) const;
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <locale>
+#include <ios>
+#include <streambuf>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::money_put<char, output_iterator<char*> > Fn;
+
+class my_facet
+    : public Fn
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : Fn(refs) {}
+};
+
+typedef std::money_put<wchar_t, output_iterator<wchar_t*> > Fw;
+
+class my_facetw
+    : public Fw
+{
+public:
+    explicit my_facetw(std::size_t refs = 0)
+        : Fw(refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::string loc_name(LOCALE_en_US_UTF_8);
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<char, true>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, false>(loc_name)));
+    ios.imbue(std::locale(ios.getloc(),
+                          new std::moneypunct_byname<wchar_t, true>(loc_name)));
+{
+    const my_facet f(1);
+    // char, national
+    {   // zero
+        std::string v = "0";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        std::string v = "-1";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        std::string v = "123456789";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        std::string v = "-123456789";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        std::string v = "0";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "$0.00");
+    }
+    {   // negative one, showbase
+        std::string v = "-1";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$0.01");
+    }
+    {   // positive, showbase
+        std::string v = "123456789";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "$1,234,567.89");
+    }
+    {   // negative, showbase
+        std::string v = "-123456789";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$1,234,567.89");
+    }
+    {   // negative, showbase, left
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$1,234,567.89      ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-$      1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            false, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "      -$1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // char, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        std::string v = "0";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0.00");
+    }
+    {   // negative one
+        std::string v = "-1";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-0.01");
+    }
+    {   // positive
+        std::string v = "123456789";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1,234,567.89");
+    }
+    {   // negative
+        std::string v = "-123456789";
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1,234,567.89");
+    }
+    {   // zero, showbase
+        std::string v = "0";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "USD 0.00");
+    }
+    {   // negative one, showbase
+        std::string v = "-1";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 0.01");
+    }
+    {   // positive, showbase
+        std::string v = "123456789";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "USD 1,234,567.89");
+    }
+    {   // negative, showbase
+        std::string v = "-123456789";
+        showbase(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 1,234,567.89");
+    }
+    {   // negative, showbase, left
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD 1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-USD    1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        std::string v = "-123456789";
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        char str[100];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str),
+                                            true, ios, ' ', v);
+        std::string ex(str, iter.base());
+        assert(ex == "   -USD 1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+{
+
+    const my_facetw f(1);
+    // wchar_t, national
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        std::wstring v = L"0";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        std::wstring v = L"-1";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        std::wstring v = L"123456789";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        std::wstring v = L"-123456789";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        std::wstring v = L"0";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"$0.00");
+    }
+    {   // negative one, showbase
+        std::wstring v = L"-1";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$0.01");
+    }
+    {   // positive, showbase
+        std::wstring v = L"123456789";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"$1,234,567.89");
+    }
+    {   // negative, showbase
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$1,234,567.89");
+    }
+    {   // negative, showbase, left
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$1,234,567.89      ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-$      1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            false, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"      -$1,234,567.89");
+        assert(ios.width() == 0);
+    }
+
+    // wchar_t, international
+    noshowbase(ios);
+    ios.unsetf(std::ios_base::adjustfield);
+    {   // zero
+        std::wstring v = L"0";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"0.00");
+    }
+    {   // negative one
+        std::wstring v = L"-1";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-0.01");
+    }
+    {   // positive
+        std::wstring v = L"123456789";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"1,234,567.89");
+    }
+    {   // negative
+        std::wstring v = L"-123456789";
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-1,234,567.89");
+    }
+    {   // zero, showbase
+        std::wstring v = L"0";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"USD 0.00");
+    }
+    {   // negative one, showbase
+        std::wstring v = L"-1";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 0.01");
+    }
+    {   // positive, showbase
+        std::wstring v = L"123456789";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"USD 1,234,567.89");
+    }
+    {   // negative, showbase
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, '*', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 1,234,567.89");
+    }
+    {   // negative, showbase, left
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        left(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD 1,234,567.89   ");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, internal
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        internal(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"-USD    1,234,567.89");
+        assert(ios.width() == 0);
+    }
+    {   // negative, showbase, right
+        std::wstring v = L"-123456789";
+        showbase(ios);
+        ios.width(20);
+        right(ios);
+        wchar_t str[100];
+        output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
+                                            true, ios, ' ', v);
+        std::wstring ex(str, iter.base());
+        assert(ex == L"   -USD 1,234,567.89");
+        assert(ios.width() == 0);
+    }
+}
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.money.put/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class CharT, class OutputIterator = ostreambuf_iterator<CharT> >
+// class money_put
+//     : public locale::facet
+// {
+// public:
+//     typedef CharT                   char_type;
+//     typedef OutputIterator          iter_type;
+//     typedef basic_string<char_type> string_type;
+
+#include <locale>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::money_put<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::money_put<wchar_t> >::value), "");
+    static_assert((std::is_same<std::money_put<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::money_put<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::money_put<char>::iter_type, std::ostreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::money_put<wchar_t>::iter_type, std::ostreambuf_iterator<wchar_t> >::value), "");
+    static_assert((std::is_same<std::money_put<char>::string_type, std::string>::value), "");
+    static_assert((std::is_same<std::money_put<wchar_t>::string_type, std::wstring>::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,147 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// string_type curr_symbol() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.curr_symbol() == std::string());
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.curr_symbol() == std::string());
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.curr_symbol() == std::wstring());
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.curr_symbol() == std::wstring());
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.curr_symbol() == "$");
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.curr_symbol() == "USD ");
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.curr_symbol() == L"$");
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.curr_symbol() == L"USD ");
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.curr_symbol() == " \u20ac");
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.curr_symbol() == " EUR");
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.curr_symbol() == L" \u20ac");
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.curr_symbol() == L" EUR");
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.curr_symbol() == " RUB");
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.curr_symbol() == L" \x440\x443\x431");
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.curr_symbol() == L" RUB");
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.curr_symbol() == "\xEF\xBF\xA5");
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.curr_symbol() == "CNY ");
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.curr_symbol() == L"\xFFE5");
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.curr_symbol() == L"CNY ");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// Russia uses ',' for the decimal separator. GLIBC returns '.'
+// XFAIL: linux
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// charT decimal_point() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.decimal_point() == std::numeric_limits<char>::max());
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.decimal_point() == std::numeric_limits<char>::max());
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.decimal_point() == std::numeric_limits<wchar_t>::max());
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.decimal_point() == std::numeric_limits<wchar_t>::max());
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.decimal_point() == '.');
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.decimal_point() == '.');
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.decimal_point() == L'.');
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.decimal_point() == L'.');
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.decimal_point() == ',');
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.decimal_point() == ',');
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.decimal_point() == L',');
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.decimal_point() == L',');
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.decimal_point() == ',');
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.decimal_point() == ',');
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.decimal_point() == L',');
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.decimal_point() == L',');
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.decimal_point() == '.');
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.decimal_point() == '.');
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.decimal_point() == L'.');
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.decimal_point() == L'.');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// class moneypunct_byname<charT, International>
+
+// int frac_digits() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.frac_digits() == 0);
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.frac_digits() == 2);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// string grouping() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    // Monetary grouping strings may be terminated with 0 or CHAR_MAX, defining
+    // how the grouping is repeated.
+    std::string s = std::string(1, CHAR_MAX);
+    {
+        Fnf f("C", 1);
+        assert(f.grouping() == s || f.grouping() == "");
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.grouping() == s || f.grouping() == "");
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.grouping() == s || f.grouping() == "");
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.grouping() == s || f.grouping() == "");
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.grouping() == "\3\3");
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.grouping() == "\3");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,227 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// pattern neg_format() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f("C", 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f("C", 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f("C", 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// string_type negative_sign() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.negative_sign() == std::string());
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.negative_sign() == std::string());
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.negative_sign() == std::wstring());
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.negative_sign() == std::wstring());
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.negative_sign() == L"-");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,227 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: apple-darwin
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// pattern pos_format() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f("C", 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f("C", 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f("C", 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::value);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::symbol);
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::sign);
+        assert(p.field[1] == std::money_base::symbol);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// string_type positive_sign() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.positive_sign() == std::string());
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.positive_sign() == std::string());
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.positive_sign() == std::wstring());
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.positive_sign() == std::wstring());
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.positive_sign() == "");
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.positive_sign() == L"");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,151 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class moneypunct_byname<charT, International>
+
+// charT thousands_sep() const;
+
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class Fnf
+    : public std::moneypunct_byname<char, false>
+{
+public:
+    explicit Fnf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, false>(nm, refs) {}
+};
+
+class Fnt
+    : public std::moneypunct_byname<char, true>
+{
+public:
+    explicit Fnt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<char, true>(nm, refs) {}
+};
+
+class Fwf
+    : public std::moneypunct_byname<wchar_t, false>
+{
+public:
+    explicit Fwf(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
+};
+
+class Fwt
+    : public std::moneypunct_byname<wchar_t, true>
+{
+public:
+    explicit Fwt(const std::string& nm, std::size_t refs = 0)
+        : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f("C", 1);
+        assert(f.thousands_sep() == std::numeric_limits<char>::max());
+    }
+    {
+        Fnt f("C", 1);
+        assert(f.thousands_sep() == std::numeric_limits<char>::max());
+    }
+    {
+        Fwf f("C", 1);
+        assert(f.thousands_sep() == std::numeric_limits<wchar_t>::max());
+    }
+    {
+        Fwt f("C", 1);
+        assert(f.thousands_sep() == std::numeric_limits<wchar_t>::max());
+    }
+
+    {
+        Fnf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.thousands_sep() == ',');
+    }
+    {
+        Fnt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.thousands_sep() == ',');
+    }
+    {
+        Fwf f(LOCALE_en_US_UTF_8, 1);
+        assert(f.thousands_sep() == L',');
+    }
+    {
+        Fwt f(LOCALE_en_US_UTF_8, 1);
+        assert(f.thousands_sep() == L',');
+    }
+
+    {
+        Fnf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.thousands_sep() == ' ');
+    }
+    {
+        Fnt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.thousands_sep() == ' ');
+    }
+    {
+        Fwf f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.thousands_sep() == L' ');
+    }
+    {
+        Fwt f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.thousands_sep() == L' ');
+    }
+
+    {
+        Fnf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.thousands_sep() == ' ');
+    }
+    {
+        Fnt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.thousands_sep() == ' ');
+    }
+    {
+        Fwf f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.thousands_sep() == L' ');
+    }
+    {
+        Fwt f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.thousands_sep() == L' ');
+    }
+
+    {
+        Fnf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.thousands_sep() == ',');
+    }
+    {
+        Fnt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.thousands_sep() == ',');
+    }
+    {
+        Fwf f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.thousands_sep() == L',');
+    }
+    {
+        Fwt f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.thousands_sep() == L',');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// explicit moneypunct(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/curr_symbol.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/curr_symbol.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/curr_symbol.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/curr_symbol.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// string_type curr_symbol() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.curr_symbol() == std::string());
+    }
+    {
+        Fnt f(1);
+        assert(f.curr_symbol() == std::string());
+    }
+    {
+        Fwf f(1);
+        assert(f.curr_symbol() == std::wstring());
+    }
+    {
+        Fwt f(1);
+        assert(f.curr_symbol() == std::wstring());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/decimal_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/decimal_point.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/decimal_point.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/decimal_point.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// charT decimal_point() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.decimal_point() == std::numeric_limits<char>::max());
+    }
+    {
+        Fnt f(1);
+        assert(f.decimal_point() == std::numeric_limits<char>::max());
+    }
+    {
+        Fwf f(1);
+        assert(f.decimal_point() == std::numeric_limits<wchar_t>::max());
+    }
+    {
+        Fwt f(1);
+        assert(f.decimal_point() == std::numeric_limits<wchar_t>::max());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/frac_digits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/frac_digits.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/frac_digits.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/frac_digits.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// int frac_digits() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fnt f(1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fwf f(1);
+        assert(f.frac_digits() == 0);
+    }
+    {
+        Fwt f(1);
+        assert(f.frac_digits() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/grouping.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/grouping.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/grouping.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/grouping.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// string grouping() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.grouping() == std::string());
+    }
+    {
+        Fnt f(1);
+        assert(f.grouping() == std::string());
+    }
+    {
+        Fwf f(1);
+        assert(f.grouping() == std::string());
+    }
+    {
+        Fwt f(1);
+        assert(f.grouping() == std::string());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/neg_format.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/neg_format.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/neg_format.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/neg_format.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// pattern neg_format() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(1);
+        std::money_base::pattern p = f.neg_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// string_type negative_sign() const;
+
+// The C++ and C standards are silent.
+//   On this one, commen sense is the guideline.
+//   If customers complain, I'll endeavor to minimize customer complaints
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fnt f(1);
+        assert(f.negative_sign() == "-");
+    }
+    {
+        Fwf f(1);
+        assert(f.negative_sign() == L"-");
+    }
+    {
+        Fwt f(1);
+        assert(f.negative_sign() == L"-");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/pos_format.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/pos_format.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/pos_format.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/pos_format.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// pattern pos_format() const;
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fnt f(1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwf f(1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+    {
+        Fwt f(1);
+        std::money_base::pattern p = f.pos_format();
+        assert(p.field[0] == std::money_base::symbol);
+        assert(p.field[1] == std::money_base::sign);
+        assert(p.field[2] == std::money_base::none);
+        assert(p.field[3] == std::money_base::value);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/positive_sign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/positive_sign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/positive_sign.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/positive_sign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// string_type positive_sign() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.positive_sign() == std::string());
+    }
+    {
+        Fnt f(1);
+        assert(f.positive_sign() == std::string());
+    }
+    {
+        Fwf f(1);
+        assert(f.positive_sign() == std::wstring());
+    }
+    {
+        Fwt f(1);
+        assert(f.positive_sign() == std::wstring());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/thousands_sep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/thousands_sep.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/thousands_sep.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/thousands_sep.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class moneypunct<charT, International>
+
+// charT thousands_sep() const;
+
+// The C++ and C standards are silent.
+//   POSIX standard is being followed (as a guideline).
+
+#include <locale>
+#include <limits>
+#include <cassert>
+
+typedef std::moneypunct<char> F;
+
+class Fnf
+    : public std::moneypunct<char, false>
+{
+public:
+    explicit Fnf(std::size_t refs = 0)
+        : std::moneypunct<char, false>(refs) {}
+};
+
+class Fnt
+    : public std::moneypunct<char, true>
+{
+public:
+    explicit Fnt(std::size_t refs = 0)
+        : std::moneypunct<char, true>(refs) {}
+};
+
+class Fwf
+    : public std::moneypunct<wchar_t, false>
+{
+public:
+    explicit Fwf(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, false>(refs) {}
+};
+
+class Fwt
+    : public std::moneypunct<wchar_t, true>
+{
+public:
+    explicit Fwt(std::size_t refs = 0)
+        : std::moneypunct<wchar_t, true>(refs) {}
+};
+
+int main()
+{
+    {
+        Fnf f(1);
+        assert(f.thousands_sep() == std::numeric_limits<char>::max());
+    }
+    {
+        Fnt f(1);
+        assert(f.thousands_sep() == std::numeric_limits<char>::max());
+    }
+    {
+        Fwf f(1);
+        assert(f.thousands_sep() == std::numeric_limits<wchar_t>::max());
+    }
+    {
+        Fwt f(1);
+        assert(f.thousands_sep() == std::numeric_limits<wchar_t>::max());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/money_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class money_base
+// {
+// public:
+//     enum part {none, space, symbol, sign, value};
+//     struct pattern {char field[4];};
+// };
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::money_base mb;
+    assert(mb.none == 0);
+    assert(mb.space == 1);
+    assert(mb.symbol == 2);
+    assert(mb.sign == 3);
+    assert(mb.value == 4);
+    assert(sizeof(std::money_base::pattern) == 4);
+    std::money_base::pattern p;
+    p.field[0] = std::money_base::none;
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// This test uses new symbols that were not defined in the libc++ shipped on
+// darwin11 and darwin12:
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+
+// <locale>
+
+// template <class _CharT, bool _International = false>
+// class moneypunct
+//     : public locale::facet,
+//       public money_base
+// {
+// public:
+//     typedef _CharT                  char_type;
+//     typedef basic_string<char_type> string_type;
+//     static const bool intl = International;
+
+#include <locale>
+#include <type_traits>
+
+template <class _Tp>
+void test(const _Tp &) {}
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::moneypunct<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::moneypunct<wchar_t> >::value), "");
+    static_assert((std::is_base_of<std::money_base, std::moneypunct<char> >::value), "");
+    static_assert((std::is_base_of<std::money_base, std::moneypunct<wchar_t> >::value), "");
+    static_assert((std::is_same<std::moneypunct<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::moneypunct<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::moneypunct<char>::string_type, std::string>::value), "");
+    static_assert((std::is_same<std::moneypunct<wchar_t>::string_type, std::wstring>::value), "");
+
+    test(std::moneypunct<char, false>::intl);
+    test(std::moneypunct<char, true>::intl);
+    test(std::moneypunct<wchar_t, false>::intl);
+    test(std::moneypunct<wchar_t, true>::intl);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.monetary/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.monetary/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.monetary/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.monetary/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// explicit num_put(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::num_put<char, char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_bool.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_bool.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& iob, char_type fill, bool v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual string_type do_truename() const {return "yes";}
+    virtual string_type do_falsename() const {return "no";}
+};
+
+int main()
+{
+    const my_facet f(1);
+    {
+        std::ios ios(0);
+        {
+            bool v = false;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "0");
+        }
+        {
+            bool v = true;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "1");
+        }
+    }
+    {
+        std::ios ios(0);
+        boolalpha(ios);
+        {
+            bool v = false;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "false");
+        }
+        {
+            bool v = true;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "true");
+        }
+    }
+    {
+        std::ios ios(0);
+        boolalpha(ios);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        {
+            bool v = false;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "no");
+        }
+        {
+            bool v = true;
+            char str[50];
+            output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+            std::string ex(str, iter.base());
+            assert(ex == "yes");
+        }
+    }
+}






More information about the cfe-commits mailing list